/* =====================================================
   SISTEMA NORELI - ESTILOS PRINCIPAIS
   ===================================================== */

:root {
    /* Cores específicas da Noreli */
    --primary-color: #66482b;      /* Marrom escuro esfumaçado - Noreli */
    --secondary-color: #3498db;    /* Azul */
    --success-color: #27ae60;      /* Verde */
    --warning-color: #f39c12;      /* Laranja */
    --danger-color: #e74c3c;       /* Vermelho */
    --light-color: #f8f9fa;        /* Cinza muito claro */
    --border-color: #e9ecef;       /* Cinza claro para bordas */
    --text-color: #2c3e50;         /* Cinza escuro para texto */
    --text-light: #6c757d;         /* Cinza médio para texto secundário */
    --background-color: #f8f9fa;   /* Fundo principal */
    --card-background: #ffffff;    /* Fundo dos cards */
    --shadow: 0 2px 10px rgba(0,0,0,0.1); /* Sombra suave */
    
    /* Cores específicas para cada seção da Noreli */
    --vendas-color: var(--primary-color);
    --compras-color: var(--primary-color);
    --cte-color: var(--primary-color);
    --cte2-color: var(--primary-color);
    --servicos-color: var(--primary-color);
}

/* =====================================================
   LAYOUT PRINCIPAL
   ===================================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: relative;
    transition: all 0.3s ease;
    margin: 20px;
    min-height: calc(100vh - 40px);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 50%, var(--primary-color) 100%);
    opacity: 0.05;
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

/* =====================================================
   TÍTULOS E CABEÇALHOS
   ===================================================== */

h1 {
    text-align: center;
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 15px 20px;
    border-bottom: 3px solid var(--primary-color);
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 249, 250, 0.8) 100%);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    transition: all 0.3s ease;
}

h1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0.08;
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

/* =====================================================
   PAINÉIS DE NAVEGAÇÃO
   ===================================================== */

.paineis-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(248, 249, 250, 0.7) 100%);
    border-radius: 16px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: relative;
    transition: all 0.3s ease;
    flex-wrap: wrap;
}

.paineis-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 50%, var(--primary-color) 100%);
    opacity: 0.04;
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

.painel {
    flex: 1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    padding: 15px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    border: 2px solid rgba(102, 72, 43, 0.3);
    min-width: 150px;
    max-width: 200px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.painel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0.05;
    border-radius: 12px;
    pointer-events: none;
    z-index: -1;
}

.painel:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.painel.ativo {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.95) 0%, rgba(240, 240, 240, 0.95) 100%);
    box-shadow: 0 4px 15px rgba(102, 72, 43, 0.2);
    transform: translateY(-2px);
}

.painel.ativo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0.1;
    border-radius: 12px;
    pointer-events: none;
}

.painel i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.painel:hover i {
    transform: scale(1.1);
}

.painel h2 {
    font-size: 14px;
    color: var(--text-color);
    margin: 0;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.painel:hover h2,
.painel.ativo h2 {
    color: var(--primary-color);
}

/* =====================================================
   CONTROLES E BOTÕES
   ===================================================== */

.controls {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    transition: all 0.3s ease;
}

.controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0.08;
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

.main-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

/* =====================================================
   INPUTS DE ARQUIVO
   ===================================================== */

input[type="file"] {
    display: none;
}

.file-input-wrapper {
    position: relative;
    text-align: center;
}

.file-counter {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    display: none;
    box-shadow: 0 3px 8px rgba(39, 174, 96, 0.4);
    z-index: 1;
    border: 2px solid white;
    min-width: 20px;
    text-align: center;
}

.file-counter.active {
    display: inline-block;
    animation: scaleIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(-90deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.file-input-label {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5a2b 100%);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    white-space: nowrap;
    min-width: 120px;
    position: relative;
    height: 40px;
    box-shadow: 0 3px 10px rgba(102, 72, 43, 0.4);
    overflow: hidden;
    letter-spacing: 0.1px;
}

.file-input-label:hover {
    background: linear-gradient(135deg, #8b5a2b 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 72, 43, 0.6);
}

.file-input-label i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.file-input-label:hover i {
    transform: scale(1.1);
}

/* =====================================================
   BOTÕES GERAIS
   ===================================================== */

button {
    background: transparent;
    color: var(--primary-color);
    padding: 6px 8px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: auto;
    justify-content: center;
    white-space: nowrap;
    box-shadow: none;
    height: auto;
    position: relative;
    overflow: visible;
    letter-spacing: 0.1px;
    flex-shrink: 0;
}

button:hover {
    background: transparent;
    color: #8b5a2b;
    transform: none;
    box-shadow: none;
    opacity: 0.8;
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 72, 43, 0.5);
}

button i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

button:hover i {
    transform: scale(1.1);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    transform: none;
    filter: none;
}

/* =====================================================
   BOTÕES ESPECÍFICOS
   ===================================================== */

/* .print-btn - usa estilo padrão limpo */

/* .import-btn - usa estilo padrão limpo */

/* .clear-btn - usa estilo padrão limpo */

/* .cadastro-btn - usa estilo padrão limpo */

/* .debug-btn - usa estilo padrão limpo */

/* .print-all-btn - usa estilo padrão limpo */

/* .scanner-btn - usa estilo padrão limpo */

.btn-canceladas {
    min-width: 200px;
    padding: 8px 12px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Estilos específicos para botões de serviços */
.file-input-label[for="pdfFileServicos"] {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
}

.file-input-label[for="xmlFileServicos"] {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%) !important;
}

/* =====================================================
   TABELAS
   ===================================================== */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    transition: all 0.3s ease;
}

table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, transparent 100%);
    opacity: 0.06;
    border-radius: 16px;
    pointer-events: none;
    z-index: -1;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 15px;
    text-align: center;
    vertical-align: middle;
}

th {
    background: linear-gradient(135deg, var(--primary-color) 0%, rgba(139, 90, 43, 0.9) 100%);
    color: white;
    font-weight: 600;
    white-space: nowrap;
    font-size: 14px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    position: relative;
}

th::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

/* Estilos específicos para cada seção */
#secao-vendas th { background: var(--vendas-color); }
#secao-compras th { background: var(--compras-color); }
#secao-cte th { background: var(--cte-color); }
#secao-cte2 th { background: var(--cte2-color); }
#secao-servicos th { background: var(--servicos-color); }

tr:nth-child(even) {
    background: var(--light-color);
}

tr:hover {
    background: #e8f4fd;
}

.valor {
    text-align: right;
    white-space: nowrap;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--success-color);
}

.prazo {
    font-family: 'Consolas', monospace;
    white-space: pre-line;
    font-size: 13px;
    color: var(--text-color);
    text-align: left;
}

.a-vista {
    color: var(--danger-color);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

.cliente-info {
    line-height: 1.4;
    text-align: left;
}

.cliente-info small {
    color: var(--text-light);
    font-size: 12px;
}

/* =====================================================
   CONTAINER DA TABELA COM SCROLL
   ===================================================== */

.table-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #8b5a2b;
}

.table-container table {
    margin: 0;
    border-collapse: collapse;
    width: 100%;
}

.table-container thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--primary-color);
}

.table-container thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    border: 1px solid #ddd;
}

.table-container tbody tr {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.table-container tbody tr:hover {
    background-color: #f8f9fa;
}

.table-container tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.table-container tbody tr:nth-child(even):hover {
    background-color: #f0f0f0;
}

.table-container td {
    padding: 10px 8px;
    border: 1px solid #eee;
}

/* =====================================================
   SEÇÕES DE CONTEÚDO
   ===================================================== */

.secao-conteudo {
    display: none;
}

.secao-conteudo.ativa {
    display: block;
}

/* =====================================================
   MODAIS
   ===================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.modal h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
    font-weight: 600;
    font-size: 24px;
}

.modal-buttons {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =====================================================
   FORMULÁRIOS
   ===================================================== */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 72, 43, 0.1);
    transform: translateY(-1px);
}

/* =====================================================
   STATUS INDICATORS
   ===================================================== */

.pago {
    color: var(--success-color);
    font-weight: 500;
}

.pago-info {
    color: var(--secondary-color);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
    }
    
    .paineis-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .painel {
        max-width: none;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .main-buttons {
        gap: 4px;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
        scrollbar-width: thin;
    }
    
    .file-input-label,
    button {
        font-size: 11px;
        padding: 5px 8px;
        height: 32px;
        gap: 4px;
        min-width: auto;
        flex-shrink: 0;
        width: auto;
    }
    
    button i,
    .file-input-label i {
        font-size: 12px;
    }
    
    .btn-canceladas {
        min-width: 150px;
        font-size: 10px;
        padding: 6px 8px;
    }
    
    /* Scrollbar para mobile */
    .main-buttons::-webkit-scrollbar {
        height: 4px;
    }
    
    .main-buttons::-webkit-scrollbar-track {
        background: rgba(102, 72, 43, 0.1);
        border-radius: 2px;
    }
    
    .main-buttons::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 4px;
    }
    
    h1 {
        font-size: 20px;
        padding: 10px 15px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 5px;
        padding: 10px;
    }
    
    h1 {
        font-size: 18px;
        padding: 8px 12px;
    }
    
    .painel {
        padding: 10px 8px;
    }
    
    .painel i {
        font-size: 24px;
    }
    
    .painel h2 {
        font-size: 12px;
    }
    
    .controls {
        padding: 15px;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 3px;
    }
}

/* =====================================================
   ESTILOS PARA IMPRESSÃO
   ===================================================== */

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        font-size: 12px !important;
        line-height: 1.2 !important;
    }

    @page {
        margin: 0.5cm !important;
        size: A4 landscape !important;
    }

    .container {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    .controls, 
    .paineis-container,
    .modal,
    button,
    input[type="file"] {
        display: none !important;
    }

    .secao-conteudo {
        display: block !important;
        page-break-before: auto !important;
        margin: 10px 0 !important;
        padding: 10px !important;
        border: 1px solid #ccc !important;
    }

    h1 {
        font-size: 18px !important;
        margin: 10px 0 !important;
        color: #000 !important;
        text-align: center !important;
        border-bottom: 2px solid #000 !important;
        padding-bottom: 5px !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin: 5px 0 !important;
        font-size: 11px !important;
    }

    th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        padding: 5px 3px !important;
        font-weight: bold !important;
        text-align: center !important;
        border: 1px solid #000 !important;
    }

    td {
        padding: 3px 2px !important;
        border: 1px solid #000 !important;
        text-align: center !important;
        vertical-align: top !important;
        font-size: 10px !important;
    }

    .valor {
        text-align: right !important;
        font-weight: bold !important;
    }

    .cliente-info, .prazo {
        text-align: left !important;
    }

    th:last-child,
    td:last-child {
        display: none !important;
    }
}
