:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --sidebar-bg: #0f172a;
    --card-bg: #1e293b;
    --body-bg: #0f172a;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────────────────────── */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex; align-items: center;
    padding: 1.5rem 1.25rem;
    font-size: 1.25rem; font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.sidebar-user {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.875rem; color: white;
    flex-shrink: 0;
}

.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }

.sidebar-nav { padding: 0.75rem 0; }

.nav-section {
    font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    border-radius: 0;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 0.9rem; }
.sidebar-nav .nav-link:hover { color: var(--text); background: rgba(99,102,241,0.1); }
.sidebar-nav .nav-link.active { color: white; background: linear-gradient(90deg, rgba(99,102,241,0.2), transparent); border-left: 3px solid var(--primary); padding-left: calc(1.25rem - 3px); }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* ─── Navbar ─────────────────────────────────────────────────────────── */
.top-navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle { background: none; border: none; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; padding: 0.25rem; }
.navbar-right { margin-left: auto; display: flex; align-items: center; }
.admin-name { font-size: 0.875rem; font-weight: 500; }

.breadcrumb { margin: 0; --bs-breadcrumb-divider-color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text); }

/* ─── Content Area ───────────────────────────────────────────────────── */
.content-area { padding: 1.5rem; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: fadeInUp 0.3s ease;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    color: var(--text) !important;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex; align-items: center; gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeInUp 0.3s ease;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; flex-shrink: 0;
}

.bg-primary-soft { background: rgba(99,102,241,0.15); }
.bg-success-soft { background: rgba(16,185,129,0.15); }
.bg-warning-soft { background: rgba(245,158,11,0.15); }
.bg-info-soft    { background: rgba(59,130,246,0.15); }
.bg-danger-soft  { background: rgba(239,68,68,0.15); }

.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── Tables ─────────────────────────────────────────────────────────── */
.table { color: var(--text); }
.table > :not(caption) > * > * { background: transparent; border-bottom-color: var(--border); color: var(--text); padding: 0.75rem 1rem; }
.table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid var(--border); }
.table-hover tbody tr:hover > * { background: rgba(99,102,241,0.05); }

/* DataTables dark overrides */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--body-bg); color: var(--text); border: 1px solid var(--border);
    border-radius: 6px; padding: 0.25rem 0.5rem;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--text-muted); }
.dataTables_wrapper .paginate_button { color: var(--text-muted) !important; border-radius: 6px !important; }
.dataTables_wrapper .paginate_button.current { background: var(--primary) !important; border-color: var(--primary) !important; color: white !important; }
.dataTables_wrapper .paginate_button:hover { background: rgba(99,102,241,0.2) !important; color: var(--text) !important; }

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-control, .form-select {
    background: var(--body-bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
}
.form-control:focus, .form-select:focus {
    background: var(--body-bg); color: var(--text);
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
.input-group-text { background: var(--card-bg); border-color: var(--border); color: var(--text-muted); }
.form-label { color: var(--text-muted); font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-label { color: var(--text); }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: white; }

/* ─── Badges ─────────────────────────────────────────────────────────── */
.role-badge-super_admin { background: rgba(168,85,247,0.2); color: #c084fc; font-size: 0.65rem; }
.role-badge-editor      { background: rgba(59,130,246,0.2);  color: #60a5fa; font-size: 0.65rem; }
.role-badge-viewer      { background: rgba(148,163,184,0.2); color: #94a3b8; font-size: 0.65rem; }

.status-sent      { background: rgba(16,185,129,0.2); color: #34d399; }
.status-failed    { background: rgba(239,68,68,0.2);  color: #f87171; }
.status-scheduled { background: rgba(59,130,246,0.2); color: #60a5fa; }
.status-pending   { background: rgba(245,158,11,0.2); color: #fbbf24; }
.status-new       { background: rgba(99,102,241,0.2); color: #818cf8; }
.status-read      { background: rgba(148,163,184,0.2);color: #94a3b8; }
.status-resolved  { background: rgba(16,185,129,0.2); color: #34d399; }
.status-active    { background: rgba(16,185,129,0.2); color: #34d399; }
.status-expired   { background: rgba(239,68,68,0.2);  color: #f87171; }

/* ─── Loading Spinner ────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

/* ─── Toast ─────────────────────────────────────────────────────────── */
.toast-custom {
    background: var(--card-bg); border: 1px solid var(--border);
    color: var(--text); border-radius: 10px;
    min-width: 300px;
}

/* ─── Image Preview ──────────────────────────────────────────────────── */
.img-preview { max-width: 200px; max-height: 200px; border-radius: 8px; border: 2px solid var(--border); object-fit: cover; }

/* ─── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--body-bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── Animations ─────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* ─── Glassmorphism Cards ────────────────────────────────────────────── */
.glass-card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 12px;
}

/* ─── Premium Gradient Accents ───────────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    border-image: linear-gradient(135deg, var(--primary), #818cf8) 1;
}

/* Premium banner */
.premium-banner {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 12px; padding: 1rem 1.5rem; color: white;
}
