/* ========================================
   AETHER VISION 2.0 - Dark Theme
   Desenvolvido por: INFOTECH SOLUÇÕES TECNOLÓGICAS
   Cliente: PÃO E CIA
   ======================================== */

/* === VARIÁVEIS CSS === */
:root {
    /* Cores Principais */
    --primary: #4a9eff;
    --primary-dark: #3278d4;
    --primary-light: #6eb1ff;
    
    /* Cores de Fundo */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --bg-hover: #21262d;
    --card-bg: #161b22;
    --modal-bg: #161b22;
    
    /* Cores de Texto */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    /* Cores de Borda */
    --border-color: #30363d;
    --border-hover: #484f58;
    
    /* Cores de Status */
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --info: #58a6ff;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    
    /* Transições */
    --transition: all 0.3s ease;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    
    /* Z-index */
    --z-sidebar: 1000;
    --z-topbar: 999;
    --z-overlay: 9999;
}

/* === RESET E BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: var(--z-sidebar);
}

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

.sidebar-header h2 {
    font-size: 1.3rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 0.25rem 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-tertiary);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-submenu .nav-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s;
}
.nav-submenu.open .nav-arrow {
    transform: rotate(180deg);
}
.nav-submenu-list {
    list-style: none;
    padding-left: 2.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-submenu.open .nav-submenu-list {
    max-height: 500px;
}
.nav-submenu-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.nav-submenu-list a:hover {
    color: var(--primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.user-info i {
    font-size: 2rem;
    color: var(--primary);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.btn-logout {
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--danger);
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(248, 81, 73, 0.1);
}

/* === MAIN CONTENT === */
.main-content {
    transition: var(--transition);
}

.main-content.authenticated {
    margin-left: var(--sidebar-width);
}

.top-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
}

.page-title {
    font-size: 1.5rem;
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.notification-badge {
    position: relative;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.notification-badge:hover {
    color: var(--text-primary);
}

.notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
}

.current-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === PAGE CONTENT === */
.page-content {
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

/* === CARDS === */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.card-header h3 {
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* === DASHBOARD === */
.filters-section {
    margin-bottom: 2rem;
}

.store-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.store-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.store-checkbox:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.store-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.bg-primary { background: var(--primary); }
.stat-icon.bg-success { background: var(--success); }
.stat-icon.bg-warning { background: var(--warning); }
.stat-icon.bg-info { background: var(--info); }
.stat-icon.bg-danger { background: var(--danger); }

.stat-content h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.charts-grid .card-body {
    height: 300px;
}

.charts-grid canvas {
    max-height: 100%;
}

/* === TABELAS === */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.rank-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-mysql {
    background: rgba(75, 192, 192, 0.2);
    color: #4bc0c0;
    border: 1px solid #4bc0c0;
}

.badge-sqlserver {
    background: rgba(255, 206, 86, 0.2);
    color: #ffce56;
    border: 1px solid #ffce56;
}

/* === BOTÕES === */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* === FORMS === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    margin: 0;
    cursor: pointer;
}

/* === ALERTS === */
.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(248, 81, 73, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(210, 153, 34, 0.15);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid var(--info);
    color: var(--info);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
}

/* === LOADING OVERLAY === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: var(--z-overlay);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* === FOOTER === */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-content p {
    margin: 0.25rem 0;
}

.version {
    color: var(--text-muted);
}

/* === LOGIN PAGE === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-container {
    z-index: 1;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: inline-block;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    color: white;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.login-form {
    margin: 2rem 0;
}

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.developed-by {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.background-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    opacity: 0.1;
    animation: float 20s infinite;
}

.circle-1 {
    width: 400px;
    height: 400px;
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.circle-2 {
    width: 600px;
    height: 600px;
    bottom: -300px;
    right: -300px;
    animation-delay: 5s;
}

.circle-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    /* Sidebar Mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Overlay para fechar sidebar no mobile */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
    
    .main-content.authenticated {
        margin-left: 0;
    }
    
    .btn-menu {
        display: block;
    }
    
    /* Top Bar Mobile */
    .top-bar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .top-bar-left {
        flex: 1;
        min-width: 0;
    }
    
    .page-title {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .top-bar-right {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    
    .current-time {
        font-size: 0.75rem;
        display: none; /* Ocultar relógio em telas muito pequenas */
    }
    
    .notification-badge {
        font-size: 1rem;
    }
    
    /* Page Content Mobile */
    .page-content {
        padding: 0.75rem;
    }
    
    /* Grids Mobile */
    .stats-grid,
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Cards Mobile */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* Tabelas Mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 600px; /* Força scroll horizontal se necessário */
    }
    
    th, td {
        padding: 0.5rem 0.75rem;
    }
    
    /* Botões Mobile */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px; /* Touch-friendly */
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    /* Dropdowns Mobile */
    .dropdown-menu {
        max-width: calc(100vw - 2rem);
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    /* Store Selector Mobile */
    .store-selector-compact {
        padding: 0.75rem;
    }
    
    .selector-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .selector-row .dropdown-container,
    .selector-row .date-picker-container {
        width: 100%;
    }
    
    /* Footer Mobile */
    .footer {
        padding: 1rem;
        text-align: center;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Loading Overlay Mobile */
    .loading-overlay {
        padding: 2rem 1rem;
    }
    
    .loading-content {
        padding: 2rem 1.5rem;
        max-width: 90%;
    }
    
    .loading-spinner {
        width: 60px;
        height: 60px;
    }
}

/* Mobile Extra Small (telas muito pequenas) */
@media (max-width: 480px) {
    .page-title {
        font-size: 1rem;
    }
    
    .top-bar-right {
        gap: 0.5rem;
    }
    
    .btn-theme-toggle {
        width: 36px;
        height: 36px;
        margin-right: 0.5rem;
    }
    
    .notification-badge {
        font-size: 0.9rem;
    }
    
    .card {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    table {
        font-size: 0.8rem;
        min-width: 500px;
    }
    
    th, td {
        padding: 0.4rem 0.5rem;
    }
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* === SELETOR COMPACTO DE LOJAS === */
.store-selector-compact {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.selector-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.selector-row .dropdown-container {
    flex: 1;
}

.btn-refresh {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--success), #2ea043);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.btn-refresh:hover {
    background: linear-gradient(135deg, #2ea043, var(--success));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-refresh i {
    font-size: 1rem;
}

/* Date Picker */
.date-picker-container {
    display: flex;
    align-items: center;
    position: relative;
}

.btn-date-picker {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--info), #4a8fd4);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.btn-date-picker:hover {
    background: linear-gradient(135deg, #4a8fd4, var(--info));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-date-picker i {
    font-size: 1rem;
}

/* Input de data (oculto, mas funcional) */
#datePicker {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Forçar calendário a abrir no lugar certo */
#datePicker::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    color: transparent;
    background: transparent;
    cursor: pointer;
}

.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.dropdown-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.dropdown-toggle i:first-child {
    color: var(--primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 0;
    overflow: hidden;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    max-height: 600px;
    opacity: 1;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-hover);
}

.dropdown-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-sm.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-sm.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-sm.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-sm.btn-secondary:hover {
    background: var(--bg-hover);
}

.dropdown-items {
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
}

.dropdown-items::-webkit-scrollbar {
    width: 8px;
}

.dropdown-items::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.dropdown-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.dropdown-items::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px;
    margin-bottom: 0.25rem;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.store-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 45px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.store-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.store-type {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-type.mysql {
    background: rgba(74, 158, 255, 0.15);
    color: #6eb1ff;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.store-type.sqlserver {
    background: rgba(248, 81, 73, 0.15);
    color: #ff8a80;
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.dropdown-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-block {
    width: 100%;
    display: block;
}

/* === CARD SUBTITLE === */
.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: normal;
}

/* === STORE CODE === */
.store-code {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-weight: 600;
    font-family: monospace;
    font-size: 0.9rem;
}

/* === THEME TOGGLE === */
.btn-theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 1rem;
}

.btn-theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: scale(1.05);
}

.btn-theme-toggle i {
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: var(--transition);
}

:root[data-theme="light"] .btn-theme-toggle i:before {
    content: "\f186"; /* fa-moon */
}

/* ===================================
   LOADING OVERLAY ELEGANTE
   =================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 27, 42, 0.98), rgba(27, 38, 59, 0.98));
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.loading-content {
    text-align: center;
    max-width: 500px;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    border: 6px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.loading-message {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    min-height: 30px;
    font-weight: 500;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-progress {
    margin-top: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px var(--primary);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

.progress-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================================
   PADRÃO DE MODAIS - SISTEMA COMPLETO
   =================================== */

/* Overlay do modal - fundo escuro com transparência */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}

/* Conteúdo do modal - fundo sólido e discreto */
.modal-content {
    background: var(--modal-bg);
    margin: 50px auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    position: relative;
    animation: fadeInUp 0.3s ease;
}

/* Modal grande para telas maiores */
.modal-large {
    max-width: 1200px;
}

/* Modal pequeno para formulários simples */
.modal-small {
    max-width: 500px;
}

/* Cabeçalho do modal */
.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 12px 12px 0 0;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-header h3 {
    font-size: 1.2rem;
}

/* Botão de fechar */
.close,
.modal-close,
.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.close:hover,
.modal-close:hover,
.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Corpo do modal - fundo sólido */
.modal-body {
    padding: 25px;
    background: var(--modal-bg);
    color: var(--text-primary);
    min-height: 100px;
}

/* Rodapé do modal */
.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-tertiary);
    border-radius: 0 0 12px 12px;
}

/* Animações para modais */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Garantir que o conteúdo do modal tenha fundo sólido */
.modal-content * {
    box-sizing: border-box;
}

/* Grid de detalhes (usado em modais de visualização) */
.detalhes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    background: var(--modal-bg);
}

.detalhes-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detalhes-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detalhes-item span {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Modal específico para emissão de NFS-e semanal - mantém estilo original (transparente, suspenso no topo) */
#emitirNfseModalSemanal {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(2px) !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: 100px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#emitirNfseModalSemanal .modal-content {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    max-width: 500px !important;
    width: 90% !important;
    flex-shrink: 0 !important;
}

#emitirNfseModalSemanal .modal-header {
    background: transparent !important;
    border-bottom: none !important;
    padding-bottom: 10px !important;
}

#emitirNfseModalSemanal .modal-header h2 {
    color: var(--text-primary) !important;
}

#emitirNfseModalSemanal .modal-body {
    background: transparent !important;
}

#emitirNfseModalSemanal .modal-footer {
    background: transparent !important;
    border-top: none !important;
    padding-top: 10px !important;
}

#emitirNfseModalSemanal .close-modal {
    color: var(--text-primary) !important;
}

/* Responsividade para modais */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }
}

