:root {
    --bg-main: #0b1120;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.03);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 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);
    --radius: 12px;
}

body.theme-light {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #7c3aed;
    --border: #e2e8f0;
    --input-bg: #f8fafc;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s, color 0.1s;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0f172a;
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.05), transparent 25%);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #f8fafc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-align: center;
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    border-color: var(--border);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.9);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    /* Increased padding */
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Animated Logo */
.logo {
    font-size: 1.8rem;
    /* Increased logo size */
    font-weight: 800;
    background: linear-gradient(to right, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
    background-size: 300% auto;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.03em;
    margin-right: 2rem;
    animation: shine 5s linear infinite;
}

@keyframes shine {
    to {
        background-position: 300% center;
    }
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Dropdown Menu - FIXED */
.dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    min-width: 200px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    flex-direction: column;
    margin-top: 0.5rem;
}

.dropdown:hover .dropdown-content {
    display: flex;
    animation: slideDown 0.2s ease;
}

.dropdown-content a {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: 8px;
    white-space: nowrap;
    display: block;
    width: 100%;
    text-align: left;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
    border: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin Sidebar */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - 65px);
}

.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar h4 {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sidebar a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    background: var(--bg-main);
    overflow-y: auto;
}

/* Cards */
.card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.card h3 {
    margin-top: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.grid-sidebar {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .grid-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Enhanced Forms */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
    /* Increased visibility */
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    appearance: none;
    /* Removes default OS styling */
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Fix generic white boxes */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e293b inset !important;
    -webkit-text-fill-color: white !important;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-layout {
        position: relative;
        /* Context for absolute sidebar */
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        /* Hide by default */
        width: 280px;
        height: 100vh;
        z-index: 2000;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
        transition: left 0.3s ease;
        border-right: 1px solid var(--border);
        border-bottom: none;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-close-btn {
        display: block;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
    }

    .main-content {
        padding: 1.5rem;
        width: 100%;
    }

    /* Mobile Dashboard Header with Toggle */
    .dashboard-mobile-header {
        display: flex;
        align-items: center;
        padding: 1rem;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        margin-bottom: 1rem;
    }
}

.sidebar-close-btn {
    display: none;
    /* Hidden on desktop */
}

.dashboard-mobile-header {
    display: none;
    /* Hidden on desktop */
}

/* Mobile Menu */
.navbar {
    position: relative;
    z-index: 1001;
    /* Ensure nav is above page content */
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    z-index: 1002;
    /* Ensure button is clickable */
}

.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: var(--bg-card);
        flex-direction: column;
        padding: 2rem;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        align-items: flex-start;
    }

    .nav-links.active {
        right: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 2rem;
        border-bottom: 1px solid var(--border);
        padding-bottom: 1rem;
    }
}