/* 
 * Sistema de Gerenciamento de Estoque
 * Arquivo CSS padronizado para todo o projeto
 * Criado em: Junho 2025
 */

/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Headers e títulos */
.header {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

h1 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 2.2rem;
}

h2, h3 {
    color: #212529;
    margin-bottom: 1rem;
}

/* Cards e containers */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-container, .busca-container, .filters {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.section-title {
    color: #212529;
    font-weight: bold;
    margin-bottom: 1rem;
    display: block;
    font-size: 1.1rem;
}

/* Formulários */
.form-group, .filter-group, .form-adicionar, .busca-form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: end;
    margin: 0;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #212529;
}

/* Inputs */
.form-input, .busca-input, .filter-item select, .filter-item input,
input[type="text"], input[type="number"], input[type="date"], select {
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
    min-width: 150px;
}

.form-input:focus, .busca-input:focus, .filter-item select:focus, .filter-item input:focus,
input[type="text"]:focus, input[type="number"]:focus, input[type="date"]:focus, select:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 2px rgba(73, 80, 87, 0.25);
}

input[type="number"] {
    min-width: 120px;
    width: 120px;
}

/* Botões */
.btn, button[type="submit"], .btn-adicionar, .btn-buscar, .btn-limpar, 
.btn-atualizar, .btn-primary, .btn-success, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* Botão primário (principal) */
.btn-primary, .btn-adicionar, .btn-atualizar {
    background: #212529;
    color: white;
    border: 1px solid #212529;
    text-shadow: none;
}

.btn-primary:hover, .btn-adicionar:hover, .btn-atualizar:hover {
    background: #000;
    border-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Botão de sucesso */
.btn-success, .btn-buscar {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-success:hover, .btn-buscar:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

/* Botão secundário */
.btn-secondary, .btn-limpar {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    text-shadow: none;
}

.btn-secondary:hover, .btn-limpar:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Botão info */
.btn-info {
    background: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-info:hover {
    background: #138496;
    border-color: #117a8b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

/* Botão de perigo */
.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Estados dos botões */
.btn:disabled, .btn-atualizar:disabled {
    background: #e9ecef !important;
    color: #6c757d !important;
    border-color: #dee2e6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Tabelas */
.table-container, .logs-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

tr:hover {
    background-color: #f8f9fa;
}

/* Formulários inline */
form.inline {
    display: inline;
    margin: 0;
}

/* Status e badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success {
    background-color: #c6f6d5;
    color: #22543d;
}

.status-error {
    background-color: #fed7d7;
    color: #742a2a;
}

.status-mensagem {
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: 5px;
    font-size: 0.875rem;
}

.status-sucesso {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-erro {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Alertas */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border: 1px solid;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Estatísticas */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #212529;
}

.stat-label {
    color: #6c757d;
    margin-top: 0.5rem;
}

/* JSON Details */
.json-details {
    max-width: 300px;
    max-height: 100px;
    overflow: auto;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    border: 1px solid #dee2e6;
}

/* Modal para detalhes JSON */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: none;
    border-radius: 10px;
    width: 90%;
    max-width: 1000px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.close:hover,
.close:focus {
    opacity: 1;
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Seções do JSON */
.json-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.json-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.json-section h3 {
    color: #212529;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.json-section h4 {
    color: #495057;
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1rem;
}

/* Tabelas JSON */
.json-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.json-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: top;
}

.json-table td:first-child {
    background-color: #f8f9fa;
    font-weight: 600;
    width: 200px;
    color: #495057;
}

.json-table td:last-child {
    background-color: white;
}

/* Tabela de variações */
.json-table-variations {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.json-table-variations thead {
    background: #f8f9fa;
}

.json-table-variations th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.9rem;
}

.json-table-variations td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: top;
    font-size: 0.9rem;
}

.json-table-variations tr:hover {
    background-color: #f8f9fa;
}

.json-table-variations code {
    background-color: #f1f3f4;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #495057;
}

/* Botão pequeno para o modal */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #495057;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-sm:hover {
    background: #343a40;
}

/* Responsividade */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .form-group, .filter-group, .form-adicionar, .busca-form {
        flex-direction: column;
        align-items: stretch;
    }

    .form-input, .busca-input {
        margin-bottom: 0.5rem;
        min-width: auto;
    }

    .table-container, .logs-table {
        overflow-x: auto;
    }

    table {
        min-width: 800px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1.5rem;
        max-height: 70vh;
    }
    
    .json-table td:first-child {
        width: 120px;
        font-size: 0.875rem;
    }
    
    .json-table-variations {
        font-size: 0.8rem;
    }
    
    .json-table-variations th,
    .json-table-variations td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card, .form-container, .busca-container, .filters {
        padding: 1rem;
    }
}

/* Utilitários */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Cores de texto */
.text-primary { color: #212529; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-info { color: #17a2b8; }
.text-muted { color: #6c757d; }

/* Backgrounds */
.bg-primary { background-color: #212529; }
.bg-success { background-color: #28a745; }
.bg-danger { background-color: #dc3545; }
.bg-warning { background-color: #ffc107; }
.bg-info { background-color: #17a2b8; }
.bg-light { background-color: #f8f9fa; }
.bg-white { background-color: white; }
