/* ==========================================================================
   HUB SOLUÇÕES - DESIGN SYSTEM & ESTÉTICA GLASSMORPHISM (style.css)
   ========================================================================== */

/* 1. Variáveis e Tokens de Design */
:root {
    --font-primary: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    /* Harmonious HSL Tailored Color Palette (Deep Indigo & Ultraviolet Neon) */
    --bg-dark: hsl(230, 25%, 8%);
    --bg-surface: hsla(230, 20%, 15%, 0.4);
    --bg-sidebar: hsla(230, 25%, 10%, 0.65);
    
    --primary: hsl(224, 76%, 58%);       /* Azul Cobalto */
    --primary-glow: hsla(224, 76%, 58%, 0.35);
    --secondary: hsl(271, 91%, 65%);     /* Ultravioleta Néon */
    --secondary-glow: hsla(271, 91%, 65%, 0.35);
    
    --success: hsl(142, 70%, 45%);       /* Verde Esmeralda */
    --info: hsl(196, 90%, 48%);          /* Azul Turquesa */
    --warning: hsl(38, 92%, 50%);        /* Laranja Quente */
    --danger: hsl(354, 85%, 55%);        /* Vermelho Vibrante */
    
    --text-main: hsl(220, 20%, 95%);     /* Branco Gelo */
    --text-muted: hsl(220, 12%, 65%);    /* Cinza Claro */
    
    --glass-border: hsla(0, 0%, 100%, 0.08);
    --glass-highlight: hsla(0, 0%, 100%, 0.03);
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
}

/* 2. Reset e Estilo Geral */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-dark);
    /* Fundo gradiente fluido com profundidade */
    background-image: 
        radial-gradient(at 10% 20%, hsla(224, 76%, 58%, 0.12) 0px, transparent 50%),
        radial-gradient(at 90% 10%, hsla(271, 91%, 65%, 0.1) 0px, transparent 40%),
        radial-gradient(at 50% 80%, hsla(230, 25%, 8%, 1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* 3. Estrutura do Layout Grid da Aplicação */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* 4. Sidebar Lateral Premium */
.sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
}

.logo-glow {
    position: absolute;
    width: 45px;
    height: 45px;
    background: var(--secondary);
    filter: blur(25px);
    opacity: 0.45;
    border-radius: 50%;
    z-index: -1;
}

.logo-icon {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand h2 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.brand h2 span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 4rem;
    flex-grow: 1;
}

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.85rem 1.1rem;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-menu a i {
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.nav-menu a:hover {
    color: var(--text-main);
    background: hsla(0, 0%, 100%, 0.04);
    border-color: var(--glass-border);
}

.nav-menu a.active {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(168, 85, 247, 0.15));
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.05);
}

.nav-menu a.active i {
    color: var(--secondary);
}

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 1.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.avatar {
    font-size: 2.2rem;
    color: var(--text-muted);
}

.user-profile h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-profile p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 5. Painel de Conteúdo Principal */
.main-content {
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* 6. Topbar Superior */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-text h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-main) 30%, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.welcome-text p {
    color: var(--text-muted);
    font-size: 1rem;
}

.date-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1.1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.date-badge i {
    color: var(--primary);
}

/* 7. Glassmorphism Panels */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.panel-header h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.panel-header h3 i {
    color: var(--secondary);
}

/* 8. KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.kpi-header span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kpi-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-main);
}

.kpi-icon.icon-blue i { color: var(--primary); }
.kpi-icon.icon-purple i { color: var(--secondary); }
.kpi-icon.icon-orange i { color: var(--warning); }

.kpi-value {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0.8rem 0;
    letter-spacing: -0.5px;
}

.kpi-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Destaque para KPI Bruto */
.kpi-bruto {
    background: linear-gradient(135deg, hsla(224, 76%, 58%, 0.15), hsla(271, 91%, 65%, 0.15));
    border-color: rgba(168, 85, 247, 0.35);
}

/* Ícone gradiente do KPI bruto (usado no HTML como kpi-icon-grad) */
.kpi-icon-grad,
.kpi-bruto .kpi-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    border: none !important;
    color: var(--text-main) !important;
    box-shadow: 0 4px 10px var(--secondary-glow);
}

.kpi-bruto .kpi-value {
    background: linear-gradient(to right, #ffffff, #dcd6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 9. Drag & Drop Upload Zone */
.upload-container {
    width: 100%;
}

.drop-zone {
    border: 2px dashed rgba(168, 85, 247, 0.3);
    background: hsla(230, 20%, 12%, 0.3);
    border-radius: var(--border-radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    transition: var(--transition-smooth);
    user-select: none;
    -webkit-user-select: none;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--secondary);
    background: hsla(271, 91%, 65%, 0.04);
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.08) inset;
}

.drop-zone-glow {
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--secondary);
    filter: blur(80px);
    opacity: 0;
    z-index: -1;
    transition: var(--transition-smooth);
}

.drop-zone:hover .drop-zone-glow, .drop-zone.dragover .drop-zone-glow {
    opacity: 0.25;
}

.drop-icon {
    font-size: 3.2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
}

.drop-zone:hover .drop-icon {
    transform: translateY(-4px);
}

.drop-zone h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
}

.drop-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 420px;
    margin-bottom: 0.8rem;
}

/* .file-input agora usa inline style no HTML para evitar conflito com display:none */

.btn-import {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: var(--text-main);
    padding: 0.75rem 1.6rem;
    font-family: var(--font-primary);
    font-weight: 600;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 15px var(--secondary-glow);
    transition: var(--transition-smooth);
}

.btn-import:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
}

/* Barra de progresso para upload de lotes grandes */
.progress-bar-container {
    margin-top: 1.5rem;
    display: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 0.15s ease-out;
}

/* 10. Analytics Grid (Gráficos) */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-panel {
    min-height: 380px;
}

.chart-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 11. Tabela Premium de Resultados */
.tabela-container {
    width: 100%;
}

.table-actions {
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-box input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    width: 250px;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    outline: none;
    border-color: var(--secondary);
    background: rgba(255, 255, 255, 0.08);
}

.filter-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary);
}

.btn-export {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-export:hover {
    background: var(--text-main);
    color: var(--bg-dark);
    border-color: var(--text-main);
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
    margin-top: 1rem;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.premium-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.1rem 1.2rem;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.premium-table td {
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 500;
}

.premium-table tbody tr {
    transition: var(--transition-smooth);
}

.premium-table tbody tr:hover {
    background: hsla(0, 0%, 100%, 0.02);
}

/* Badges para tipos de notas */
.badge {
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-nfe {
    background: rgba(59, 130, 246, 0.12);
    color: hsl(220, 90%, 65%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-nfse {
    background: rgba(168, 85, 247, 0.12);
    color: hsl(270, 90%, 75%);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.badge-nfce {
    background: rgba(6, 182, 212, 0.12);
    color: hsl(190, 90%, 65%);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.actions-col {
    text-align: right;
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.btn-action:hover {
    background: var(--secondary);
    color: var(--text-main);
    border-color: var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
    transform: scale(1.08);
}

/* 12. Modal Overlay e Card (Glassmorphism) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 8, 14, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: hsla(230, 25%, 12%, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 1.6rem 2.2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
}

.modal-header h2 span {
    color: var(--secondary);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 2.2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1.2rem;
}

.modal-info-grid h5 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.modal-info-grid p {
    font-weight: 600;
    font-size: 0.95rem;
}

.modal-info-grid small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-items-section h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-items-section h3 i {
    color: var(--primary);
}

.modal-table-scroll {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
}

.items-table th {
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
}

.items-table td {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
}

.num-col {
    text-align: right;
}

/* Estilização da barra de rolagem */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 13. Responsividade Geral */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 850px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* Em telas muito pequenas simplificamos o sidebar */
    }
    .main-content {
        padding: 1.5rem;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .modal-info-grid {
        grid-template-columns: 1fr;
    }
}
