:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0891b2;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #fc466b 0%, #3f5efb 100%);
    --gradient-warning: linear-gradient(135deg, #fdbb2d 0%, #22c1c3 100%);
    --shadow-light: 0 2px 15px rgba(0,0,0,0.08);
    --shadow-medium: 0 4px 25px rgba(0,0,0,0.15);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
    line-height: 1.6;
}

.main-container {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    margin: 20px;
    padding: 0;
    box-shadow: var(--shadow-medium);
    min-height: calc(100vh - 40px);
}

.dashboard-header {
    background: var(--gradient-primary);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.dashboard-subtitle {
    opacity: 0.9;
    font-size: 1.1rem;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.content-wrapper {
    padding: 30px;
}

.filters-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0,0,0,0.05);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.kpi-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.kpi-card.success::before {
    background: var(--gradient-success);
}

.kpi-card.danger::before {
    background: var(--gradient-danger);
}

.kpi-card.warning::before {
    background: var(--gradient-warning);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.kpi-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: white;
    font-size: 1.2rem;
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 10px 0;
    color: var(--dark-color);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.analytics-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0,0,0,0.05);
}

.analytics-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.analytics-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.analytics-list li:last-child {
    border-bottom: none;
}

.analytics-list .store-name {
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

.analytics-list .store-value {
    font-weight: 600;
    white-space: nowrap;
}

.analytics-list .positive {
    color: var(--success-color);
}

.analytics-list .negative {
    color: var(--danger-color);
}

.analytics-list .neutral {
    color: var(--info-color);
}

/* Tabelas com linhas alteradas */
.data-table-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(0,0,0,0.05);
}

.table-header {
    background: var(--gradient-primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.export-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.export-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
}

.table-responsive {
    padding: 0;
}

.modern-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    background: #f8fafc;
    padding: 15px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark-color);
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modern-table th.text-center {
    text-align: center;
}

.modern-table th .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.modern-table th .header-main {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.modern-table th .header-sub {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.modern-table th .header-total {
    font-size: 0.8rem;
    color: var(--success-color);
    font-weight: 600;
}

.modern-table td {
    padding: 12px;
    font-size: 0.9rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.modern-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.modern-table tbody tr:nth-child(odd) {
    background-color: white;
}

.modern-table tbody tr {
    transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
    background-color: #e0f2fe !important;
    transform: scale(1.01);
}

.value-positive {
    color: var(--success-color);
    font-weight: 600;
}

.value-negative {
    color: var(--danger-color);
    font-weight: 600;
}

.value-neutral {
    color: var(--info-color);
    font-weight: 600;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.form-control, .form-select {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.select2-container .select2-selection--multiple {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    min-height: 45px !important;
}

.select2-container .select2-selection--multiple:focus-within {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15) !important;
}

.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--danger-color);
}

.breakdown-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85rem;
}

.breakdown-list li:last-child {
    border-bottom: none;
}

.holiday-list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.holiday-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.holiday-list li:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .main-container {
        margin: 10px;
        min-height: calc(100vh - 20px);
    }

    .dashboard-title {
        font-size: 2rem;
    }

    .content-wrapper {
        padding: 20px;
    }

    .kpi-grid, .analytics-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .kpi-value {
        font-size: 1.8rem;
    }

    .modern-table th,
    .modern-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .dashboard-title {
        font-size: 1.5rem;
    }

    .dashboard-subtitle {
        font-size: 1rem;
    }

    .content-wrapper {
        padding: 15px;
    }

    .filters-card {
        padding: 20px;
    }
}