<?php
// ============================================
// FILE: assets/css/style.css
// ============================================

/* ===== CSS Variables & Theme ===== */
:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --primary-light: #EEF2FF;
    --accent: #10B981;
    --accent-hover: #059669;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-hover: #DC2626;
    --info: #3B82F6;

    /* Light Mode */
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F5F9;
    --bg-sidebar: #0F172A;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-table-header: #F1F5F9;
    --bg-table-row: #FFFFFF;
    --bg-table-row-alt: #F8FAFC;
    --bg-hover: #F1F5F9;
    --bg-modal-overlay: rgba(0,0,0,0.5);
    --bg-tooltip: #1E293B;

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;
    --text-sidebar: #CBD5E1;
    --text-sidebar-active: #FFFFFF;
    --text-link: #6366F1;

    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    --border-input: #CBD5E1;
    --border-focus: #6366F1;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;

    --transition: all 0.3s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-sidebar: #0B1120;
    --bg-card: #1E293B;
    --bg-input: #334155;
    --bg-table-header: #334155;
    --bg-table-row: #1E293B;
    --bg-table-row-alt: #0F172A;
    --bg-hover: #334155;
    --bg-modal-overlay: rgba(0,0,0,0.7);
    --bg-tooltip: #475569;

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-tertiary: #64748B;
    --text-inverse: #0F172A;
    --text-link: #818CF8;

    --border-color: #334155;
    --border-light: #1E293B;
    --border-input: #475569;
    --border-focus: #818CF8;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

a { color: var(--text-link); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

/* ===== Layout ===== */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content.collapsed { margin-left: var(--sidebar-collapsed); }

.page-content {
    flex: 1;
    padding: 24px;
    padding-top: calc(var(--header-height) + 24px);
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--header-height);
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #A855F7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar.collapsed .brand-text { opacity: 0; width: 0; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar.collapsed .nav-section { opacity: 0; height: 0; padding: 0; }

.nav-item { position: relative; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-sidebar);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-link.active {
    background: rgba(99,102,241,0.15);
    color: var(--text-sidebar-active);
    border-left-color: var(--primary);
}

.nav-link i { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }

.nav-link .nav-text { overflow: hidden; transition: var(--transition); }
.sidebar.collapsed .nav-text { opacity: 0; width: 0; }

.nav-link .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.sidebar.collapsed .nav-badge { display: none; }

.nav-link .nav-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: var(--transition);
}

.sidebar.collapsed .nav-arrow { display: none; }

.nav-link[aria-expanded="true"] .nav-arrow { transform: rotate(90deg); }

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}

.nav-submenu.show { max-height: 500px; }

.nav-submenu .nav-link {
    padding-left: 56px;
    font-size: 13px;
    border-left: none;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
    transition: var(--transition);
}

.header.collapsed { left: var(--sidebar-collapsed); }

.header-left { display: flex; align-items: center; gap: 16px; }

.header-right { display: flex; align-items: center; gap: 12px; }

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
}

.btn-toggle-sidebar:hover { background: var(--bg-hover); color: var(--text-primary); }

.header-search {
    position: relative;
    max-width: 300px;
}

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.header-search i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 14px;
}

.header-icon-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
}

.header-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.header-icon-btn .badge-dot {
    position: absolute;
    top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-full);
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
}

.theme-toggle:hover { background: var(--bg-hover); color: var(--warning); border-color: var(--warning); }

.header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-profile:hover { background: var(--bg-hover); }

.header-profile img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

.header-profile-info { line-height: 1.2; }
.header-profile-info .name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.header-profile-info .role { font-size: 11px; color: var(--text-tertiary); }

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 100;
    overflow: hidden;
}

.profile-dropdown.show { display: block; }

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: var(--transition);
}

.profile-dropdown a:hover { background: var(--bg-hover); color: var(--text-primary); }
.profile-dropdown a i { width: 18px; text-align: center; }
.profile-dropdown .divider { height: 1px; background: var(--border-color); }
.profile-dropdown a.danger { color: var(--danger); }
.profile-dropdown a.danger:hover { background: #FEF2F2; }

[data-theme="dark"] .profile-dropdown a.danger:hover { background: rgba(239,68,68,0.1); }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { color: var(--text-tertiary); }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); }

/* ===== Stat Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--accent); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.success .stat-icon { background: #ECFDF5; color: var(--accent); }
.stat-card.warning .stat-icon { background: #FFFBEB; color: var(--warning); }
.stat-card.danger .stat-icon { background: #FEF2F2; color: var(--danger); }
.stat-card.info .stat-icon { background: #EFF6FF; color: var(--info); }

[data-theme="dark"] .stat-card.primary .stat-icon { background: rgba(99,102,241,0.15); }
[data-theme="dark"] .stat-card.success .stat-icon { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .stat-card.warning .stat-icon { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .stat-card.danger .stat-icon { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .stat-card.info .stat-icon { background: rgba(59,130,246,0.15); }

.stat-info h3 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table thead th {
    background: var(--bg-table-header);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

table tbody tr { background: var(--bg-table-row); transition: var(--transition); }
table tbody tr:nth-child(even) { background: var(--bg-table-row-alt); }
table tbody tr:hover { background: var(--bg-hover); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-success { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-success:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #D97706; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--text-tertiary); }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 5px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.form-control::placeholder { color: var(--text-tertiary); }

.form-control:disabled, .form-control[readonly] {
    background: var(--bg-tertiary);
    opacity: 0.7;
    cursor: not-allowed;
}

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

.form-text { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .btn { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #ECFDF5; color: #059669; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-danger { background: #FEF2F2; color: #DC2626; }
.badge-info { background: #EFF6FF; color: #2563EB; }
.badge-secondary { background: var(--bg-tertiary); color: var(--text-secondary); }

[data-theme="dark"] .badge-primary { background: rgba(99,102,241,0.15); color: #A5B4FC; }
[data-theme="dark"] .badge-success { background: rgba(16,185,129,0.15); color: #6EE7B7; }
[data-theme="dark"] .badge-warning { background: rgba(245,158,11,0.15); color: #FCD34D; }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,0.15); color: #FCA5A5; }
[data-theme="dark"] .badge-info { background: rgba(59,130,246,0.15); color: #93C5FD; }

/* ===== Alerts ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert i { font-size: 18px; margin-top: 1px; flex-shrink: 0; }

.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.alert-danger { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.2); color: #6EE7B7; }
[data-theme="dark"] .alert-danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); color: #FCA5A5; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.2); color: #FCD34D; }
[data-theme="dark"] .alert-info { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.2); color: #93C5FD; }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.7;
    padding: 0;
}

.alert-close:hover { opacity: 1; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 780px; }
.modal-sm { max-width: 400px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 420px;
    animation: slideInRight 0.3s ease;
    font-size: 14px;
}

.toast i { font-size: 20px; flex-shrink: 0; }
.toast.toast-success i { color: var(--accent); }
.toast.toast-danger i { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }
.toast.toast-info i { color: var(--info); }

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    justify-content: center;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: var(--bg-card);
}

.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); }

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-tertiary);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-link {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--transition);
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ===== Charts Grid ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card { min-height: 320px; }
.chart-card canvas { width: 100% !important; }

/* ===== Avatar ===== */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 100px; height: 100px; }

/* ===== Progress Bar ===== */
.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width 0.6s ease;
}

.progress-bar.success { background: var(--accent); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ===== Dropdown ===== */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

.dropdown-menu.show { display: block; }

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-menu a:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-menu a i { width: 16px; text-align: center; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    top: -200px; right: -200px;
    border-radius: 50%;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%);
    bottom: -100px; left: -100px;
    border-radius: 50%;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .login-logo .icon-circle {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), #A855F7);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    margin-bottom: 16px;
}

.login-card .login-logo h2 { font-size: 22px; font-weight: 700; }
.login-card .login-logo p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.login-card .form-group { margin-bottom: 20px; }

.login-card .form-control {
    padding: 11px 14px 11px 42px;
}

.login-card .input-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
}

.login-card .input-wrapper { position: relative; }

.login-card .password-toggle {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.login-footer a { font-weight: 600; }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-tertiary) !important; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.d-none { display: none !important; }
.d-block { display: block !important; }

/* ===== Frontend Specific ===== */
.frontend-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.frontend-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 70px;
}

.frontend-nav .nav-links { display: flex; align-items: center; gap: 4px; }
.frontend-nav .nav-links a {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.frontend-nav .nav-links a:hover { background: var(--bg-hover); color: var(--text-primary); }

.hero-section {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #312E81 100%);
    color: #fff;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
    top: -200px; left: 50%;
    transform: translateX(-50%);
}

.hero-section h1 { font-size: 48px; font-weight: 800; margin-bottom: 16px; position: relative; }
.hero-section p { font-size: 18px; opacity: 0.8; max-width: 600px; margin: 0 auto 32px; position: relative; }

.hero-btns { display: flex; gap: 16px; justify-content: center; position: relative; }
.hero-btns .btn { padding: 14px 32px; font-size: 16px; border-radius: var(--radius-lg); }
.hero-btns .btn-outline { border-color: rgba(255,255,255,0.3); color: #fff; }
.hero-btns .btn-outline:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5); }

.frontend-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.section-header { text-align: center; margin-bottom: 40px; }
.section-header h2 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
.section-header p { font-size: 16px; color: var(--text-secondary); max-width: 500px; margin: 0 auto; }

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }

.course-card .course-img {
    height: 160px;
    background: linear-gradient(135deg, var(--primary), #A855F7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
}

.course-card .course-body { padding: 20px; }
.course-card .course-body h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.course-card .course-body p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

.course-card .course-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.course-card .price { font-size: 20px; font-weight: 800; color: var(--primary); }
.course-card .price .old-price { font-size: 14px; color: var(--text-tertiary); text-decoration: line-through; font-weight: 400; margin-left: 6px; }
.course-card .duration { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }

/* ===== Footer ===== */
.frontend-footer {
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    padding: 40px 20px;
    margin-top: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-content h4 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.footer-content a { display: block; color: var(--text-sidebar); font-size: 14px; padding: 4px 0; }
.footer-content a:hover { color: #fff; }

.footer-bottom {
    max-width: 1200px;
    margin: 24px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content, .main-content.collapsed { margin-left: 0; }
    .header, .header.collapsed { left: 0; }
    .page-content { padding: 16px; padding-top: calc(var(--header-height) + 16px); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-search { display: none; }
    .hero-section h1 { font-size: 32px; }
    .hero-btns { flex-direction: column; align-items: center; }
    .footer-content { grid-template-columns: 1fr; }
    .course-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .frontend-nav .nav-links { display: none; }
    .mobile-menu-btn { display: flex !important; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px; }
}

.mobile-menu-btn {
    display: none !important;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.mobile-overlay.show { display: block; }

/* ===== Print ===== */
@media print {
    .sidebar, .header, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding-top: 0 !important; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}