/* ==========================================================================
   1. VARIAVEIS E RESET
   ========================================================================== */
:root {
    --primary-color: #2c3e50;    /* Azul escuro (Sidebar/Header) */
    --secondary-color: #34495e;  /* Azul médio (Hover) */
    --accent-color: #27ae60;     /* Verde (Botões/Sucesso) */
    --bg-color: #f4f7f6;         /* Cinza claro (Fundo) */
    --text-color: #333;          /* Cinza escuro (Texto) */
    --white: #ffffff;
    --border-color: #ddd;
}

h1 { font-size: 1.5rem; margin-bottom: 15px; }
h3 { font-size: 1.1rem; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   2. ESTRUTURA E LAYOUT (RESPONSIVO)
   ========================================================================== */

/* Container principal que recebe o conteúdo das páginas */
.container {
    flex: 1;
    padding: 20px;
    width: 100%;
    transition: all 0.3s;
}

/* Ajuste de margem para Desktop (quando o menu é lateral) */
@media (min-width: 769px) {
    .container {
        margin-left: 240px; /* Largura da sidebar */
        padding: 20px 40px;
        max-width: 1000px;  /* ADICIONE ISSO: Impede que os cards fiquem gigantes em telas Ultra-Wide */
    }
    
    /* Opcional: Diminuir a largura da própria sidebar também */
    .sidebar {
        width: 240px; 
    }
}

/* Ajuste nos CARDS para não ficarem tão altos */
.card {
    padding: 15px; /* Diminuí de 25px para 15px */
    min-height: 150px; /* Define uma altura mínima controlada */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card i {
    font-size: 1.5rem !important; /* Diminui um pouco o ícone se estiver muito grande */
    margin-bottom: 10px;

}

/* ==========================================================================
   3. SIDEBAR (MENU DE NAVEGAÇÃO)
   ========================================================================== */
.sidebar {
    background-color: var(--primary-color);
    color: var(--white);
    z-index: 1000;
}

/* Sidebar no Desktop */
@media (min-width: 769px) {
    .sidebar {
        width: 260px;
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
    }
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    background: #1a252f;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: 0.3s;
}

.nav-links li a i {
    width: 30px;
    font-size: 1.2rem;
}

.nav-links li a:hover {
    background: var(--secondary-color);
    color: var(--white);
}

/* Menu Mobile (Barra Superior/Sticky) */
@media (max-width: 768px) {
    .sidebar {
        position: sticky;
        top: 0;
        width: 100%;
    }
    .sidebar-header { display: none; } /* Ganha espaço no celular */
    .nav-links {
        display: flex;
        justify-content: space-around;
    }
    .nav-links li a {
        flex-direction: column;
        font-size: 0.75rem;
        padding: 10px 5px;
        text-align: center;
    }
    .nav-links li a i { margin-bottom: 5px; width: auto; }
}

/* ==========================================================================
   4. COMPONENTES: CARDS E BOTÕES
   ========================================================================== */

/* Cards do Painel Admin */
.grid-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: center;
    border-bottom: 4px solid #3498db;
    transition: transform 0.2s;
}

.card:active { transform: scale(0.98); } /* Feedback de toque no celular */

/* Botões Estilizados */
button, .btn-import {
    background-color: var(--accent-color);
    color: var(--white);
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%; /* Mobile-first */
    transition: background 0.3s;
}

button:hover { background-color: #219150; }

/* ==========================================================================
   5. FORMULÁRIOS E INPUTS
   ========================================================================== */
input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px; /* Importante para evitar zoom no iPhone */
    background: #fff;
}

/* ==========================================================================
   6. PÁGINA DE LOGIN
   ========================================================================== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--primary-color);
    padding: 20px;
}

.login-form {
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.login-form h2 {
    margin-bottom: 25px;
    text-align: center;
    color: var(--primary-color);
}

/* ==========================================================================
   7. LISTAGEM DE PRODUTOS (SKU EDITÁVEL)
   ========================================================================== */
.card-produto {
    background: var(--white);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 5px solid #3498db;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.card-produto strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.card-produto small {
    color: #7f8c8d;
}

/* Estilo das Âncoras */
.btn-anchor {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 5px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    border: 1px solid #bdc3c7;
    transition: 0.2s;
}
.btn-anchor:hover {
    background: #3498db;
    color: white;
}

/* Estilo da Tabela */
.tabela-fiscal {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    font-size: 0.9rem;
}

.tabela-fiscal th, .tabela-fiscal td {
    padding: 12px;
    border: 1px solid #eee;
    text-align: left;
}

.tabela-fiscal th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
}

.tabela-fiscal tr:hover {
    background-color: #fcfcfc;
}

/* Botão de salvar menor para caber na tabela */
.btn-save-table {
    padding: 5px 10px !important;
    font-size: 0.8rem !important;
    width: auto !important;
}

/* Ajuste para não "pular" atrás do menu fixo ao clicar na âncora */
.fornecedor-secao {
    scroll-margin-top: 80px; /* Ajuste isso de acordo com a altura do seu menu mobile */
}

/* ==========================================================================
   8. ALERTAS E FEEDBACK
   ========================================================================== */
.alert-success {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.error {
    color: #e74c3c;
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
}

.header-fornecedor {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px 8px 0 0;
    font-size: 1.1rem;
    margin-bottom: 0;
}

.tabela-wrapper {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow-x: auto;
}

.input-table {
    margin: 0 !important;
    padding: 8px !important;
    border: 1px solid #ccc !important;
    font-size: 0.9rem !important;
    background: #fffdf5 !important; /* Cor levemente diferente para destacar campo editável */
}

.badge {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #666;
    display: inline-block;
    margin-top: 2px;
}

/* Ajuste das âncoras para parecerem botões de menu */
.btn-anchor {
    padding: 8px 15px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--primary-color);
    font-weight: 500;
}