:root {
    /* Colors - COAAT Light Theme */
    --bg-color: #f4f7f6;
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(255, 255, 255, 0.4);
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --accent-1: #AB172D; /* COAAT Red */
    --accent-2: #7a111a; /* COAAT Dark Red */
    --accent-3: #f59e0b; /* Amber */
    --accent-4: #0ea5e9; /* Sky blue for contrast */

    --font-family: 'Plus Jakarta Sans', sans-serif;
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background elements imitating the portal */
.bg-decor-1 {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 400px;
    background: linear-gradient(to bottom, rgba(171, 23, 45, 0.05), transparent);
    z-index: -10;
}
.bg-decor-2 {
    position: fixed;
    top: -20%; right: -10%; width: 50%; height: 50%;
    border-radius: 50%;
    background: rgba(171, 23, 45, 0.05);
    filter: blur(120px);
    z-index: -10;
}
.bg-decor-3 {
    position: fixed;
    bottom: 10%; left: -10%; width: 40%; height: 40%;
    border-radius: 50%;
    background: rgba(171, 23, 45, 0.05);
    filter: blur(100px);
    z-index: -10;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-right: 1px solid rgba(0,0,0,0.05);
    border-radius: 0;
    z-index: 10;
    background: var(--sidebar-bg);
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.logo img {
    height: 64px;
    object-fit: contain;
    align-self: flex-start;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent-1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

select {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    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%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

select:hover, select:focus {
    border-color: var(--accent-1);
    outline: none;
    box-shadow: 0 0 0 3px rgba(171, 23, 45, 0.1);
}

.sidebar-footer {
    margin-top: auto;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary:hover {
    box-shadow: 0 10px 20px -5px rgba(171, 23, 45, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-height: 100vh;
    overflow-y: auto;
}

.top-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

.kpi-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 40px -15px rgba(171, 23, 45, 0.15);
    border-color: rgba(171, 23, 45, 0.2);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent-1);
}
.kpi-card.gradient-2::before { background: var(--accent-3); }
.kpi-card.gradient-3::before { background: var(--accent-4); }
.kpi-card.gradient-4::before { background: #10b981; }

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(171, 23, 45, 0.05);
    color: var(--accent-1);
    transition: var(--transition);
}

.kpi-card:hover .kpi-icon {
    background-color: var(--accent-1);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.kpi-info h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.kpi-value .unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Charts */
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

.chart-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}

.chart-title-icon {
    width: 24px;
    height: 24px;
    background-color: var(--accent-1);
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    min-height: 250px;
    width: 100%;
}
.pie-wrapper {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Table */
.table-container {
    padding: 24px;
    margin-bottom: 40px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.05);
}

.table-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.table-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid rgba(0,0,0,0.05);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    color: var(--text-main);
}

tr:hover td {
    background: rgba(171, 23, 45, 0.02);
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    .main-content {
        padding: 20px;
    }
}
