:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.3);
    --success: #10b981;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--primary);
    min-height: 100vh;
}

/* Luxury Background */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 23, 42, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
}

.container {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

/* Page Header Utilities */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    flex: 1;
}

.page-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions .search-box input {
        width: 100% !important;
    }
}

/* Header & Sidebar */
header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1001;
}

.logo .brand {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.025em;
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
}

.logo .brand span {
    color: white;
    font-weight: 300;
}

.logo small {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    opacity: 0.8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #cbd5e1;
    margin-top: 2px;
}

.logo i {
    font-size: 1.6rem;
    color: var(--accent);
}

/* Hamburger Menu Toggle */
.menu-toggle {
    display: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
    z-index: 1001;
    width: 40px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background: white;
    min-width: 240px;
    box-shadow: var(--shadow-lg);
    border-radius: 0.75rem;
    z-index: 1000;
    top: 100%;
    right: 0;
    /* Align to right on desktop */
    padding: 0.5rem 0;
    border: 1px solid #e2e8f0;
    margin-top: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.dropdown-content.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-content a {
    color: var(--primary);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background: #f1f5f9;
    color: var(--accent);
}

/* Grid & Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Premium Stats Cards */
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid #e2e8f0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.05);
    color: var(--primary);
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info .label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary);
}

.btn-accent:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: white;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Responsive Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f1f5f9;
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #475569;
}

td {
    padding: 1rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Mobile Sidebar Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Tweaks */
@media (max-width: 992px) {
    header {
        padding: 0.75rem 1.25rem;
    }

    .menu-toggle {
        display: block;
        order: -1;
        /* Move toggle to left */
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        /* Slide from left */
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: var(--primary);
        background: linear-gradient(180deg, var(--primary) 0%, #1e293b 100%);
        flex-direction: column;
        align-items: flex-start;
        padding: 6rem 1.25rem 2rem;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        gap: 0.25rem;
        overflow-y: auto;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-link {
        width: 100%;
        padding: 0.875rem 1.25rem;
        border-radius: 0.75rem;
        color: #e2e8f0;
        font-size: 0.95rem;
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(255, 255, 255, 0.08);
        color: var(--accent);
    }

    .nav-dropdown {
        width: 100%;
    }

    .dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.04);
        border: none;
        margin-top: 0.25rem;
        padding: 0;
        opacity: 1;
        transform: none;
        display: none;
        border-radius: 0.75rem;
    }

    .dropdown-content.show {
        display: block;
    }

    .dropdown-content a {
        color: #cbd5e1;
        padding-left: 3rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0.75rem;
    }

    .glass-card {
        padding: 1.25rem 1rem;
        border-radius: 1rem;
    }

    .stat-card {
        padding: 1rem;
        gap: 1rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .stat-info .value {
        font-size: 1.25rem;
    }

    /* Fix for cut off text in tables */
    .table-container {
        margin: 0 -0.75rem;
        width: calc(100% + 1.5rem);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    table {
        min-width: 600px;
        /* Force scrollable for small screens */
    }

    /* Guaranteed Row Layout */
    header {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.6rem 1rem !important;
        height: 65px;
    }

    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
    }

    .logo .brand {
        font-size: 1.2rem;
    }

    .logo i {
        font-size: 1.3rem;
    }

    .mobile-logout-btn {
        display: flex;
        margin-left: auto;
        z-index: 1001;
    }

    .menu-toggle {
        display: block;
        margin-right: auto;
        z-index: 1001;
    }
}

/* Mobile Logout Button (Hidden on Desktop) */
.mobile-logout-btn {
    display: none;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s;
    text-decoration: none;
}

.mobile-logout-btn:active {
    background: #ef4444;
    transform: scale(0.9);
}

@media (max-width: 768px) {
    .mobile-logout-btn {
        display: flex;
    }

    /* Premium SWAL Adjustments */
    .premium-swal-popup {
        padding: 1.5rem !important;
        border-radius: 1.5rem !important;
        width: 90% !important;
        max-width: 400px !important;
    }

    .premium-swal-title {
        font-family: 'Outfit', sans-serif !important;
        font-weight: 800 !important;
        font-size: 1.4rem !important;
    }
}