/* ===================================
   ZENEFY ADMIN PANEL — STYLESHEET
   =================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0B0D1A;
    --bg-secondary: #111322;
    --bg-sidebar: #0E1020;
    --bg-card: #161829;
    --bg-card-hover: #1E2038;
    --bg-input: #0D0F1C;
    --bg-hover: #1A1C30;
    --border: #252840;
    --border-light: #2A2D48;
    --text-primary: #E4E4F0;
    --text-secondary: #8889A4;
    --text-muted: #5C5D75;
    --accent-purple: #7C5CFC;
    --accent-purple-light: #9B82FC;
    --accent-purple-dim: rgba(124, 92, 252, 0.15);
    --accent-blue: #4C9AFF;
    --accent-blue-dim: rgba(76, 154, 255, 0.15);
    --accent-green: #00D68F;
    --accent-green-dim: rgba(0, 214, 143, 0.15);
    --accent-yellow: #FFAA00;
    --accent-yellow-dim: rgba(255, 170, 0, 0.15);
    --accent-red: #FF4D6A;
    --accent-red-dim: rgba(255, 77, 106, 0.15);
    --accent-orange: #FF7849;
    --accent-orange-dim: rgba(255, 120, 73, 0.15);
    --gradient-primary: linear-gradient(135deg, #7C5CFC, #4C9AFF);
    --gradient-danger: linear-gradient(135deg, #FF4D6A, #FF7849);
    --gradient-success: linear-gradient(135deg, #00D68F, #4C9AFF);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --transition: all 0.2s ease;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #F3F4F8;
    --bg-secondary: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0F1F5;
    --bg-input: #F3F4F8;
    --bg-hover: #F0F1F5;
    --border: #E0E2EA;
    --border-light: #D5D7E0;
    --text-primary: #1A1D2E;
    --text-secondary: #5C5D75;
    --text-muted: #8889A4;
    --accent-purple-dim: rgba(124, 92, 252, 0.1);
    --accent-blue-dim: rgba(76, 154, 255, 0.1);
    --accent-green-dim: rgba(0, 214, 143, 0.1);
    --accent-yellow-dim: rgba(255, 170, 0, 0.1);
    --accent-red-dim: rgba(255, 77, 106, 0.1);
    --accent-orange-dim: rgba(255, 120, 73, 0.1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .sidebar { border-right-color: var(--border); box-shadow: 1px 0 0 var(--border); }
[data-theme="light"] .topbar { border-bottom-color: var(--border); background: #FFFFFF; box-shadow: var(--shadow-sm); }
[data-theme="light"] .modal-container,
[data-theme="light"] .confirm-dialog { background: #FFFFFF; border-color: var(--border); }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.25); }
[data-theme="light"] .toast { background: #FFFFFF; border-color: var(--border); }
[data-theme="light"] .data-table thead { background: #F3F4F8; }
[data-theme="light"] .filter-select option { background: #FFFFFF; color: var(--text-primary); }
[data-theme="light"] .stat-card:hover { box-shadow: var(--shadow-md); }

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Layout --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width 0.3s ease;
    overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
}
.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}
.topbar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    background: var(--bg-primary);
}

/* --- Sidebar --- */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    min-height: 64px;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}
.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity 0.2s;
}
.sidebar.collapsed .logo-text { opacity: 0; width: 0; }
.sidebar-toggle {
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar.collapsed .nav-section-title { text-align: center; padding: 16px 8px 6px; }
.sidebar.collapsed .nav-section-title span { display: none; }
.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}
.nav-item a i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-item a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-item.active a {
    color: var(--accent-purple);
    background: var(--accent-purple-dim);
    border-left-color: var(--accent-purple);
}
.sidebar.collapsed .nav-item a { padding: 12px 0; justify-content: center; }
.sidebar.collapsed .nav-item a span { display: none; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}
.admin-info { display: flex; flex-direction: column; overflow: hidden; }
.admin-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.admin-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.sidebar.collapsed .admin-info { display: none; }

/* --- Topbar --- */
.topbar-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
}
.mobile-menu-btn:hover { background: var(--bg-card); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-separator { color: var(--text-muted); font-size: 11px; }
.breadcrumb-item i { font-size: 12px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    min-width: 240px;
}
.topbar-search i { color: var(--text-muted); font-size: 13px; }
.topbar-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    outline: none;
    width: 100%;
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
}
.topbar-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--accent-red);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    position: relative;
    transition: var(--transition);
}
.topbar-user:hover { background: var(--bg-card); }
.topbar-user > i { font-size: 10px; color: var(--text-muted); }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 6px;
    display: none;
    z-index: 200;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    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.text-danger { color: var(--accent-red); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Stat Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-icon.purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.stat-icon.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.stat-icon.green { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-icon.yellow { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.stat-icon.red { background: var(--accent-red-dim); color: var(--accent-red); }
.stat-icon.orange { background: var(--accent-orange-dim); color: var(--accent-orange); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
}
.stat-change.up { color: var(--accent-green); background: var(--accent-green-dim); }
.stat-change.down { color: var(--accent-red); background: var(--accent-red-dim); }

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.grid-equal { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* --- Tables --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.table-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-toolbar-right { display: flex; align-items: center; gap: 10px; }
.table-title { font-size: 15px; font-weight: 600; }
.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    color: var(--text-primary);
    outline: none;
    min-width: 200px;
    transition: var(--transition);
}
.search-input:focus { border-color: var(--accent-purple); }
.search-input::placeholder { color: var(--text-muted); }
.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238889A4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.filter-select:focus { border-color: var(--accent-purple); }
.filter-select option { background: var(--bg-card); color: var(--text-primary); }

.data-table { width: 100%; }
.data-table thead { background: var(--bg-primary); }
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--border);
}
.data-table th:hover { color: var(--text-secondary); }
.data-table th i { margin-left: 4px; font-size: 10px; }
.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-checkbox { width: 16px; height: 16px; accent-color: var(--accent-purple); cursor: pointer; }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: var(--transition);
}
.page-btn:hover { background: var(--bg-card-hover); }
.page-btn.active { background: var(--accent-purple); color: #fff; border-color: var(--accent-purple); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Bulk Actions Bar */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--accent-purple-dim);
    border-bottom: 1px solid var(--accent-purple);
    font-size: 13px;
    color: var(--accent-purple-light);
}
.bulk-bar.hidden { display: none; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-primary { background: var(--accent-purple); color: #fff; }
.btn-primary:hover { background: var(--accent-purple-light); }
.btn-secondary { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--accent-yellow); color: #000; }
.btn-warning:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-card); color: var(--text-primary); }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    gap: 4px;
}
.badge-success { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-warning { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.badge-danger { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-info { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.badge-orange { background: var(--accent-orange-dim); color: var(--accent-orange); }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }

/* --- Avatar --- */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-xs { width: 24px; height: 24px; }
.avatar-lg { width: 48px; height: 48px; }
.avatar-xl { width: 64px; height: 64px; }
.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.status-online { background: var(--accent-green); }
.status-offline { background: var(--text-muted); }
.status-busy { background: var(--accent-red); }

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    background: none;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent-purple); border-bottom-color: var(--accent-purple); }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent-purple); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238889A4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Toggle Switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: var(--transition);
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent-purple); }
.toggle input:checked + .toggle-slider::after { left: 21px; }
.toggle-label { font-size: 13px; color: var(--text-secondary); }

/* Slider */
.range-slider { width: 100%; }
.range-slider input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}
.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
}
.range-value {
    font-size: 12px;
    color: var(--accent-purple);
    font-weight: 600;
    margin-top: 4px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}
.modal-container.modal-lg { max-width: 900px; }
.modal-container.modal-xl { max-width: 1200px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Confirm Dialog */
.confirm-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    animation: modalIn 0.2s ease;
}
.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px;
}
.confirm-dialog h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.confirm-dialog p { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
    font-size: 13px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.toast-success .toast-icon { color: var(--accent-green); }
.toast.toast-error .toast-icon { color: var(--accent-red); }
.toast.toast-warning .toast-icon { color: var(--accent-yellow); }
.toast.toast-info .toast-icon { color: var(--accent-blue); }
.toast-close {
    margin-left: auto;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    padding: 4px;
}
.toast-close:hover { color: var(--text-primary); }

/* --- Progress Bar --- */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.progress-bar.purple { background: var(--gradient-primary); }
.progress-bar.green { background: var(--accent-green); }
.progress-bar.blue { background: var(--accent-blue); }
.progress-bar.yellow { background: var(--accent-yellow); }
.progress-bar.red { background: var(--accent-red); }

/* --- Chart Container --- */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-width: 100%; }

/* --- Map --- */
.map-container { width: 100%; height: 400px; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.map-container .leaflet-container { background: var(--bg-primary) !important; }

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.page-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* --- Section Spacing --- */
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* --- Flex Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* --- Text Utilities --- */
.text-purple { color: var(--accent-purple); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-yellow { color: var(--accent-yellow); }
.text-red { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --- Activity Feed --- */
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.activity-icon.purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.activity-icon.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.activity-icon.green { background: var(--accent-green-dim); color: var(--accent-green); }
.activity-icon.yellow { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.activity-icon.red { background: var(--accent-red-dim); color: var(--accent-red); }
.activity-icon.orange { background: var(--accent-orange-dim); color: var(--accent-orange); }
.activity-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* --- Grid Equal --- */
.grid-equal { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

/* --- Grid 2 Equal --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

/* --- Range Slider --- */
input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
}
.range-slider input[type="range"] { width: 100%; }
.range-value { font-size: 12px; color: var(--accent-purple); font-weight: 600; margin-top: 4px; }

/* --- Loading --- */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    color: var(--text-muted);
    gap: 12px;
}
.loading-spinner i { font-size: 24px; color: var(--accent-purple); }

/* --- Responsive --- */
@media (max-width: 1200px) {
    .sidebar { width: var(--sidebar-collapsed); }
    .sidebar .logo-text,
    .sidebar .nav-item a span,
    .sidebar .nav-section-title span,
    .sidebar .admin-info { display: none; }
    .sidebar .nav-section-title { text-align: center; padding: 16px 8px 6px; }
    .sidebar .nav-item a { padding: 12px 0; justify-content: center; }
    .sidebar .sidebar-toggle i { transform: rotate(180deg); }
    .main-wrapper { margin-left: var(--sidebar-collapsed); width: calc(100% - var(--sidebar-collapsed)); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar.mobile-open .logo-text,
    .sidebar.mobile-open .nav-item a span,
    .sidebar.mobile-open .nav-section-title span,
    .sidebar.mobile-open .admin-info { display: block; }
    .sidebar.mobile-open .nav-section-title { text-align: left; padding: 16px 20px 6px; }
    .sidebar.mobile-open .nav-item a { padding: 9px 20px; justify-content: flex-start; }
    .sidebar.mobile-open .sidebar-toggle i { transform: none; }
    .main-wrapper { margin-left: 0; width: 100%; }
    .mobile-menu-btn { display: flex; }
    .topbar-search { display: none; }
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
