:root {
    /* Color Palette - Premium Dark SaaS */
    --primary: #6366f1;
    /* Electric Purple */
    --primary-hover: #4f46e5;
    --secondary: #06b6d4;
    /* Neon Cyan */
    --accent: #f472b6;
    /* Pink */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --bg-input: rgba(51, 65, 85, 0.5);
    /* Slate 700 */

    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --border-color: rgba(148, 163, 184, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-neon: 0 0 15px rgba(99, 102, 241, 0.3);
    /* Glowing effect */

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base */
* {
    box_sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 20%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
    letter-spacing: -0.02em;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--primary);
}

/* Glassmorphism Utilities */
.glass-effect {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-neon);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Layout */
.wrapper {
    display: flex;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 30px;
    margin-left: 260px;
    /* Sidebar width */
    transition: margin-left 0.3s ease;
    width: 100%;
    max-width: 1600px;
}

/* Sidebar Styles - Centralized */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 12px;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
    color: var(--primary);
    /* Use primary color for text */
    -webkit-text-fill-color: initial;
    /* Reset gradient text if set globally */
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-icon {
    margin-right: 12px;
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-input);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    border: 1px solid var(--glass-border);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s;
}

/* Topbar Styles */
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.sidebar-toggle {
    display: none;
    /* Hidden on desktop */
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-bottom: 80px;
        /* Space for PWA vibes if needed */
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .admin-topbar {
        display: flex;
        align-items: center;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-topbar-title h1 {
        font-size: 1.25rem;
        margin: 0;
    }

    /* Enhance cards on mobile */
    .glass-card {
        padding: 20px;
        border-radius: 12px;
    }
}

/* Inputs & Forms */
.form-group {
    margin-bottom: 20px;
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    width: 100%;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 0.95rem;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.35);
    transform: translateY(-2px);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
    white-space: nowrap;
    /* Prevent wrapping on small screens */
}

.table th,
.table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.2);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.35em 0.8em;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.025em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}