/* ============================================================
   CONFIGURAÇÕES GERAIS E VARIÁVEIS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --cor-primaria: #e81d1d;
    --cor-dark: #2c343a;
    --cor-bg: #f8f9fa;
    --cor-card: #ffffff;
    --cor-texto: #333333;
    --border-color: #ddd;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--cor-bg);
    color: var(--cor-texto);
    margin: 0;
}

/* --- ESTRUTURA PRINCIPAL --- */
.container-principal {
    display: flex;
    flex: 1;
    height: calc(100vh - 80px);
    /* Ajuste considerando o cabeçalho */
    width: 100%;
    overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    background: linear-gradient(180deg, #FF0000 0%, #0000FF 100%);
    width: 250px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.logo {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    background: white;
    margin-bottom: 20px;
}

.menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-nav {
    display: block;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    transition: var(--transition);
}

.btn-nav:hover {
    background-color: var(--cor-dark);
    transform: translateX(8px);
}

/* --- ÁREA DA TABELA (DASHBOARD) --- */
.dashboard {
    flex: 1;
    padding: 30px;
    background-color: #f0f2f5;
    overflow-y: auto;
}

.upload-section {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
    text-align: center;
}

.search-container {
    margin: 10px 0 !important;
}

.botoes-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

/* --- BOTÕES DE AÇÃO --- */
.btn-importar {
    background-color: var(--cor-dark);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid transparent;
    display: inline-block;
}

.btn-importar:hover {
    background-color: #3d4852;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#input-excel {
    display: none;
}

.btn-excel-estilo {
    background-color: #1d6f42;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-excel-estilo:hover {
    background-color: #145a32;
    transform: translateY(-2px);
}

.btn-imprimir-estilo {
    background-color: #2c343a;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: none;
    /* Mostrado via JS */
}

/* --- FILTROS RÁPIDOS --- */
.btn-filtro {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.btn-filtro:hover,
.btn-filtro.ativo {
    background-color: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
}

.btn-todos {
    background-color: #eee;
}

/* --- TABELA --- */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    background-color: var(--cor-dark);
    color: white;
    padding: 12px;
    text-align: left;
}

td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #f1f1f1;
}

/* --- DESIGN BOTÃO COPIAR (REPLICADO PNEUS) --- */
.coluna-codigo-copy {
    padding: 0 !important;
}

.celula-codigo-conteudo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

.celula-codigo-conteudo span {
    olor: #2c343a;
    font-weight: inherit;
    white-space: nowrap;
}

.btn-copiar-conferencia {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 4px;
}

.btn-copiar-conferencia:hover {
    color: #e31d1a;
}

.btn-copiar-conferencia.copiado {
    color: #28a745 !important;
    transform: scale(1.2);
}

.btn-copiar-conferencia svg {
    stroke: currentColor;
}

/* --- TOAST NOTIFICAÇÃO --- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
}

.toast-container.mostrar {
    opacity: 1;
    visibility: visible;
}

/* --- MEDIA QUERIES (TELA) --- */
@media (max-width: 900px) {
    .container-principal {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
    }

    .logo {
        width: 60px;
        margin-bottom: 0;
    }
}

/* Estilo para linha conferida (clicada) */
tr.linha-conferida {
    background-color: #d4edda !important; /* Verde claro */
    transition: background-color 0.3s ease;
}

/* Garante que o hover não sobreponha a cor de conferido */
tr.linha-conferida:hover {
    background-color: #c3e6cb !important;
}

/* --- IMPRESSÃO (ESTILOS FINAIS) --- */
@media print {

    /* 1. ESCONDER ELEMENTOS INTERNOS E INTERFACE */
    .cabecalho,
    .sidebar,
    .upload-section,
    .rodape-sidebar,
    #btn-imprimir,
    .btn-copiar,
    .btn-copiar-conferencia,
    .toast-container,
    #toast-container {
        display: none !important;
    }

    /* 2. CONFIGURAÇÃO DA PÁGINA E CONTÊINERES */
    body,
    .container-principal,
    .dashboard {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background-color: white !important;
        background-image: none !important;
        /* Remove gradientes/cores de fundo */
    }

    .dashboard {
        padding: 0.5cm !important;
    }

    /* Forçar fidelidade de cores e fundos */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 3. FORMATAÇÃO DA TABELA */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: fixed !important;
    }

    th,
    td {
        border: 1px solid #000 !important;
        padding: 0 4px !important;
        font-size: 8pt !important;
        /* Padronizado conforme sua última regra */
        line-height: 0.01 !important;
        height: 15pt !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }

    th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
    }

    /* Estilo da primeira coluna (Numeração) */
    td:first-child {
        background-color: #eee !important;
        font-weight: bold !important;
        text-align: center !important;
    }

    /* 4. AJUSTE DE LARGURA DAS COLUNAS */
    th:nth-child(1) {
        width: 5%;
        text-align: center;
    }

    th:nth-child(2) {
        width: 15%;
    }

    th:nth-child(3) {
        width: 15%;
    }

    th:nth-child(4) {
        width: 35%;
    }

    th:nth-child(5) {
        width: 10%;
    }

    th:nth-child(6) {
        width: 10%;
    }

    th:nth-child(7) {
        width: 10%;
    }

    /* 5. CORREÇÃO DA CÉLULA DE CÓDIGO (BOTÃO COPIAR) */
    .celula-codigo-conteudo {
        display: block !important;
        /* Remove o flexbox */
    }

    .celula-codigo-conteudo span {
        display: inline !important;
    }
}