:root {
    --bg-color: #f0f7f9;
    --surface-color: #ffffff;
    --primary-blue: #0284c7;
    --primary-blue-hover: #0369a1;
    --mint-green: #10b981;
    --mint-green-hover: #059669;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-family: 'Prompt', sans-serif;
    --target-red: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    background-image: radial-gradient(circle at 10% 20%, rgb(239, 246, 255) 0%, rgb(224, 242, 254) 90%);
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.dashboard-header {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--primary-blue);
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.status-badge.syncing {
    background-color: #fef3c7;
    color: #d97706;
}

.status-badge.success {
    background-color: #d1fae5;
    color: #059669;
}

.status-badge.error {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Navigation Menu */
.top-nav {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-blue);
    background-color: rgba(2, 132, 199, 0.08);
}

.nav-link.active {
    font-weight: 600;
}

.nav-item-dropdown {
    position: relative;
}

.nav-item-dropdown .chevron {
    transition: transform 0.2s ease;
}

.nav-item-dropdown:hover .chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    min-width: 240px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 50;
    padding: 0.5rem 0;
}

.nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-menu li a:hover {
    background-color: rgba(2, 132, 199, 0.08);
    color: var(--primary-blue);
}

/* Glass Panel Base */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    box-shadow: var(--shadow-lg);
}

/* Filter Section */
.filter-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-primary);
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:hover:not(:disabled) {
    border-color: var(--primary-blue);
}

select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

select:disabled {
    background-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Chart Section */
.chart-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.chart-header-left {
    flex: 1;
    min-width: 200px;
}

.chart-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.chart-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.target-badge {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--target-red);
    padding: 0.35rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Print PDF Button */
.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue), #6366f1);
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
    transition: all 0.25s ease;
}

.btn-print:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    background: linear-gradient(135deg, var(--primary-blue-hover), #4f46e5);
}

.btn-print:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25);
}

/* Print Info (hidden on screen, visible only on print) */
.print-info {
    display: none;
}

.chart-container {
    position: relative;
    height: 450px;
    width: 100%;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.syncing {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .chart-container {
        height: 350px;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .nav-list {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* ======================== */
/*  PRINT STYLESHEET        */
/* ======================== */
@media print {
    /* Reset background for print */
    body {
        background: #fff !important;
        background-image: none !important;
        color: #1e293b !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .dashboard-container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Hide non-essential UI elements */
    .top-nav,
    .filter-section,
    .header-status,
    .btn-print {
        display: none !important;
    }

    /* Style the header for print */
    .header-content {
        background: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 0 0.5rem 0 !important;
        border-bottom: 2px solid var(--primary-blue) !important;
    }

    .logo-area h1 {
        font-size: 1.3rem !important;
    }

    /* Show print info block */
    .print-info {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 2rem;
        padding: 0.75rem 0;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #e2e8f0;
        font-size: 0.85rem;
        color: #334155;
    }

    .print-info .print-date {
        grid-column: 1 / -1;
        color: #94a3b8;
        font-size: 0.8rem;
    }

    /* Glass panel adjustments */
    .glass-panel {
        background: #fff !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
    }

    .chart-section {
        page-break-inside: avoid;
    }

    .chart-header {
        border-bottom-color: #cbd5e1 !important;
        padding-bottom: 0.5rem !important;
    }

    /* Fit chart nicely */
    .chart-container {
        height: 380px !important;
    }

    /* Target badge print style */
    .target-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
