/* === PREMIUM DASHBOARD DESIGN SYSTEM === */

:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --border-radius-sm: 8px;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Modern shadow definitions */
    --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
    --shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.12), 0 12px 24px -4px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    
    /* Glassmorphism properties */
    --glass-blur: blur(12px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

/* === DARK THEME (Sleek Slate/Aurora) === */
[data-theme="dark"] {
    --bg-primary: #09090b; /* Zinc 950 */
    --bg-secondary: #18181b; /* Zinc 900 */
    --bg-tertiary: #27272a; /* Zinc 800 */
    --bg-elevated: rgba(24, 24, 27, 0.7);
    --bg-surface: rgba(39, 39, 42, 0.8);
    
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #cbd5e1; /* Slate 300 */
    --text-tertiary: #94a3b8; /* Slate 400 */
    --text-muted: #64748b; /* Slate 500 */
    
    --border-primary: rgba(255, 255, 255, 0.08);
    --border-secondary: rgba(255, 255, 255, 0.12);
    
    /* Rich Indigo & Violet Gradients */
    --accent-primary: #6366f1; /* Indigo 500 */
    --accent-secondary: #8b5cf6; /* Violet 500 */
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    
    --success: #10b981; /* Emerald 500 */
    --warning: #f59e0b; /* Amber 500 */
    --error: #ef4444; /* Red 500 */
    --info: #3b82f6; /* Blue 500 */
    
    --sidebar-bg: rgba(9, 9, 11, 0.85);
    --sidebar-border: rgba(255,255,255,0.05);
    
    --card-bg: rgba(24, 24, 27, 0.65);
    --input-bg: rgba(39, 39, 42, 0.5);
    --hover-bg: rgba(255, 255, 255, 0.06);
    
    --blob-1: rgba(99, 102, 241, 0.15);
    --blob-2: rgba(139, 92, 246, 0.15);
    
    /* Request by user for secondary texts in dark mode */
    --bs-secondary-color: #f0ff07cf !important;
}

/* === LIGHT THEME (Crisp Alpine) === */
[data-theme="light"] {
    --bg-primary: #f8fafc; /* Slate 50 */
    --bg-secondary: #ffffff; 
    --bg-tertiary: #f1f5f9; /* Slate 100 */
    --bg-elevated: rgba(255, 255, 255, 0.85);
    --bg-surface: #00000026;
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #334155; /* Slate 700 */
    --text-tertiary: #475569; /* Slate 600 */
    --text-muted: #64748b; /* Slate 500 */
    
    --border-primary: rgba(0, 0, 0, 0.06);
    --border-secondary: rgba(0, 0, 0, 0.12);
    
    --accent-primary: #4f46e5; /* Indigo 600 */
    --accent-secondary: #7c3aed; /* Violet 600 */
    --accent-hover: #4338ca;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    
    --success: #059669; /* Emerald 600 */
    --warning: #d97706; /* Amber 600 */
    --error: #dc2626; /* Red 600 */
    --info: #2563eb; /* Blue 600 */
    
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --sidebar-border: rgba(0,0,0,0.05);
    
    --card-bg: rgba(255, 255, 255, 0.8);
    --input-bg: rgba(241, 245, 249, 0.7);
    --hover-bg: rgba(0, 0, 0, 0.04);
    
    --glass-border: 1px solid rgba(255, 255, 255, 0.5);
    
    --blob-1: rgba(99, 102, 241, 0.12);
    --blob-2: rgba(139, 92, 246, 0.12);
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Background Blobs for Glassmorphism Effect */
body::before, body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.8;
    pointer-events: none;
    animation: float 20s infinite ease-in-out alternate;
}

body::before {
    background: var(--blob-1);
    top: -200px;
    left: -200px;
}

body::after {
    background: var(--blob-2);
    bottom: -200px;
    right: -200px;
    animation-delay: -10s;
}

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

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

p { margin-bottom: 1rem; color: var(--text-secondary); }
a { text-decoration: none; color: var(--accent-primary); transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* === LAYOUT & SIDEBAR === */
.dashboard-container {
    display: contents;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem 1rem;
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: var(--text-primary);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-gradient);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-menu::-webkit-scrollbar-thumb { background: var(--border-secondary); border-radius: 4px; }

.nav-group { margin-bottom: 2rem; }

.nav-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--accent-primary);
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
    border-radius: var(--border-radius-sm);
}

.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::before { opacity: 0.05; }

.nav-link.active {
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-link.active::before { opacity: 0.1; }

.nav-link.active::after {
    content: '';
    position: absolute;
    left: 0; top: 15%; bottom: 15%; width: 4px;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: var(--transition);
}

.nav-link.active .nav-icon {
    transform: scale(1.1);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    width: calc(100% - 280px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === TOP BAR === */
.top-bar {
    background: var(--bg-elevated);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    padding: 1rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

/* Theme Toggle Slider */
.theme-toggle {
    position: relative;
    width: 54px; height: 30px;
}
.theme-toggle input { opacity: 0; width: 0; height: 0; }
.theme-slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--input-bg);
    border: 1px solid var(--border-primary);
    transition: var(--transition);
    border-radius: 30px;
    display: flex; align-items: center; padding: 0 4px;
}
.theme-slider:before {
    position: absolute; content: "";
    height: 22px; width: 22px;
    background: var(--text-primary);
    transition: var(--transition);
    border-radius: 50%;
    z-index: 2;
    box-shadow: var(--shadow-sm);
}
input:checked + .theme-slider { border-color: var(--accent-primary); }
input:checked + .theme-slider:before {
    transform: translateX(24px);
    background: var(--accent-primary);
}
.theme-icon {
    position: absolute; font-size: 0.8rem; top: 50%; transform: translateY(-50%); z-index: 1;
}
.theme-icon.moon { right: 8px; color: var(--text-muted); }
.theme-icon.sun { left: 8px; color: var(--warning); }
input:checked + .theme-slider .theme-icon.moon { opacity: 0; }
input:not(:checked) + .theme-slider .theme-icon.sun { opacity: 0; }

.content-area {
    flex: 1;
    padding: 0.3rem; 
}

/* === PREMIUM CARDS === */
.card {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--border-secondary);
}

.card-header {
    background: transparent;
    padding: 1.5rem 1.75rem 0;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0; font-size: 1.25rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.75rem;
}

.card-header h3 i {
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.card-body {
    padding: 1.5rem 1.75rem;
}

/* Metric Stats Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem;
}

.stat-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    background: var(--blob-1);
    color: var(--accent-primary);
}

.stat-details h6 { color: var(--text-muted); margin-bottom: 0.25rem; font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-details h2 { font-size: 2.25rem; margin: 0; letter-spacing: -0.03em; }

/* Gradient Banner Cards */
.banner-card {
    background: var(--accent-gradient);
    color: white;
    border: none;
}
.banner-card h3, .banner-card p { color: white; }
.banner-card:hover {
    box-shadow: var(--shadow-glow);
}

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600; font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn i { font-size: 1.125rem; }

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
    color: white;
}

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

.btn-outline:hover {
    background: var(--hover-bg);
    border-color: var(--text-primary);
}

/* === FORMS & INPUTS === */
.form-label {
    font-weight: 600; color: var(--text-primary); font-size: 0.875rem; margin-bottom: 0.5rem;
}

.form-control, .form-select {
    background: var(--input-bg);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* === NEWS LIST CUSTOM UI === */
.news-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--border-radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#news .card-body {
    width: 100%;
    margin: 0 auto;
}

#newsPaginationContainer {
    background: rgba(39, 39, 42, 0.4);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    border-top: 1px solid var(--border-primary);
    margin-top: 2rem !important;
}

.pagination {
    margin: 0;
}

.page-link {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-secondary) !important;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: 8px !important;
}

.page-item.active .page-link {
    background: var(--accent-gradient) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: var(--shadow-glow);
}

.page-item.disabled .page-link {
    background: transparent !important;
    opacity: 0.3;
}

.page-link:hover:not(.active):not(.disabled) {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.news-item::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--accent-primary);
    opacity: 0; transition: var(--transition);
}

.news-item:hover {
    border-color: var(--border-secondary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.news-item:hover::before { opacity: 1; }

.news-item.selected {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.04);
}
.news-item.selected::before { opacity: 1; width: 6px; }

.news-item-title { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: var(--text-primary); 
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.news-meta { 
    font-size: 0.85rem; 
    color: var(--text-tertiary); 
    display: flex; 
    gap: 1.25rem; 
    margin-bottom: 1rem; 
}
.news-desc { 
    color: var(--text-secondary); 
    font-size: 0.95rem; 
    line-height: 1.6; 
    opacity: 0.9;
}

/* === TABS VISIBILITY === */
.tab-content { display: none; opacity: 0; transition: opacity 0.4s ease; }
.tab-content.active { display: block; opacity: 1; }

/* === MODALS === */
.login-modal, .custom-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: none; align-items: center; justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: var(--bg-primary);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    padding: 1.5rem;
    max-height: 92vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-modal.show .modal-card, .custom-modal.show .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* === NOTIFICATIONS === */
.app-notification {
    position: fixed; top: 2rem; right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex; align-items: center; gap: 0.75rem;
    font-weight: 500;
}

.app-notification.show { transform: translateX(0); }
.app-notification.success { border-left: 4px solid var(--success); }
.app-notification.error { border-left: 4px solid var(--error); }
.app-notification.info { border-left: 4px solid var(--info); }
.app-notification.warning { border-left: 4px solid var(--warning); }

/* === RESPONSIVE UTILS === */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); width: 260px;}
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 1.5rem; }
    .mobile-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
        z-index: 999; opacity: 0; visibility: hidden; transition: var(--transition);
    }
    .mobile-overlay.show { opacity: 1; visibility: visible; }
    .mobile-menu-btn {
        display: block; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer;
    }
}
@media (min-width: 1025px) { .mobile-menu-btn, .mobile-overlay { display: none; } }

/* Utility Classes */
.opacity-50 { opacity: 0.5 !important; transition: opacity 0.2s; }
.hover-opacity-100:hover { opacity: 1 !important; }
.btn-link { text-decoration: none; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* === DROPDOWN MENUS === */
.dropdown-menu {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-primary) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-lg) !important;
}

.dropdown-item {
    color: var(--text-primary) !important;
    transition: var(--transition);
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--hover-bg) !important;
    color: var(--accent-primary) !important;
}

.dropdown-item.text-danger:hover {
    color: var(--error) !important;
}

.dropdown-divider {
    border-color: var(--border-secondary) !important;
}
