:root {
    --bg-dark: #0A0F0D;
    --bg-sidebar: #060908;
    --gold: #C5A046;
    --gold-hover: #D4AF37;
    --card-bg: rgba(255, 255, 255, 0.03);
    --text-main: #FFFFFF;
    --text-muted: #A0A5A3;
    --border-color: rgba(197, 160, 70, 0.2);
    --shadow-soft: 0 4px 20px rgba(0,0,0,0.4);
    --radius: 8px;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --transition: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }

/* =============================================
   SIDEBAR
   ============================================= */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    padding: 2rem 0;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    /* Ensure scrollbar doesn't eat into layout */
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 160, 70, 0.3) transparent;
}

.admin-sidebar::-webkit-scrollbar {
    width: 4px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 70, 0.3);
    border-radius: 4px;
}

.admin-sidebar .brand {
    text-align: center;
    color: var(--gold);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    padding: 0 1.5rem;
    letter-spacing: 1px;
}

/* Mobile X close button inside sidebar */
.sidebar-close-btn {
    display: none; /* desktop: hidden */
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(197, 160, 70, 0.1);
    border: 1px solid rgba(197, 160, 70, 0.25);
    color: var(--gold);
    font-size: 0.95rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.sidebar-close-btn:hover {
    background: rgba(197, 160, 70, 0.25);
    border-color: var(--gold);
}

@media (max-width: 768px) {
    .sidebar-close-btn {
        display: flex;
    }
}

.nav-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    gap: 0.9rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--gold);
    background: rgba(197, 160, 70, 0.06);
    border-left-color: var(--gold);
}

.nav-link.logout-link {
    color: #ff6b6b;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.admin-main {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    transition: margin var(--transition);
    min-width: 0;
}

/* =============================================
   MOBILE TOP BAR (only visible on mobile)
   ============================================= */
.admin-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    box-shadow: 0 2px 15px rgba(0,0,0,0.5);
}

.admin-topbar .topbar-brand {
    color: var(--gold);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.admin-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    background: rgba(197, 160, 70, 0.1);
    border: 1px solid rgba(197, 160, 70, 0.3);
    color: var(--gold);
    font-size: 1rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mobile-toggle:hover {
    background: rgba(197, 160, 70, 0.2);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 999;
    backdrop-filter: blur(3px);
}

.sidebar-overlay.active {
    display: block;
}

/* =============================================
   TYPOGRAPHY & TITLES
   ============================================= */
.page-title {
    font-size: 1.6rem;
    color: var(--text-main);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* =============================================
   CARDS & STATS
   ============================================= */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--gold); }
.stat-card h3 { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 1px; }
.stat-card .value { font-size: 1.8rem; color: var(--gold); font-weight: bold; }

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    margin-top: 2rem;
    overflow-x: auto;
}

/* =============================================
   TABLES
   ============================================= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px;
}
.admin-table th, .admin-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}
.admin-table th {
    color: var(--gold);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}
.admin-table tbody tr { transition: var(--transition); }
.admin-table tbody tr:hover { background: rgba(197, 160, 70, 0.04); }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }
.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,160,70,0.1); }
textarea.form-control { min-height: 100px; resize: vertical; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    text-align: center;
}
.btn-primary { background: var(--gold); color: #000; font-weight: 600; }
.btn-primary:hover { background: var(--gold-hover); transform: translateY(-2px); }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255,255,255,0.18); }
.btn-danger { background: rgba(220, 53, 69, 0.2); color: #ff6b6b; border: 1px solid rgba(220,53,69,0.3); }
.btn-danger:hover { background: rgba(220, 53, 69, 0.35); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.action-links a { margin-right: 0.5rem; }

/* =============================================
   BADGES
   ============================================= */
.badge { padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.72rem; text-transform: uppercase; font-weight: bold; }
.badge-pending { background: rgba(255,193,7,0.2); color: #ffc107; }
.badge-completed { background: rgba(40,167,69,0.2); color: #28a745; }
.badge-cancelled { background: rgba(220,53,69,0.2); color: #dc3545; }

/* =============================================
   LOGIN
   ============================================= */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
}
.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    text-align: center;
}
.login-box h2 { color: var(--gold); margin-bottom: 2rem; font-size: 1.8rem; }
.error-msg { background: rgba(220,53,69,0.2); color: #ff6b6b; padding: 0.8rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }

/* =============================================
   TOAST
   ============================================= */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.admin-toast {
    background: #111815; color: var(--text-main); padding: 12px 20px; border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); display: flex; align-items: center; gap: 10px;
    transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--gold); max-width: 300px;
}
.admin-toast.success { border-left-color: #28a745; }
.admin-toast.error { border-left-color: #dc3545; }
.admin-toast.show { transform: translateX(0); }

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    /* Show top bar, hide inline toggle */
    .admin-topbar { display: flex; }

    /* Sidebar: hidden off-screen, slides in */
    .admin-sidebar {
        transform: translateX(-100%);
        top: 0;
        z-index: 1001;
        width: 260px;
        box-shadow: 4px 0 30px rgba(0,0,0,0.8);
    }

    .admin-sidebar.show { transform: translateX(0); }

    /* Main content: full width, below topbar */
    .admin-main {
        margin-left: 0;
        padding: 1.5rem 1rem;
        margin-top: var(--topbar-height);
    }

    /* Hide the old inline mobile toggle button in main */
    .admin-main > .mobile-toggle { display: none !important; }

    /* Page title font shrink */
    .page-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    /* Stats grid: 2 col */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card .value { font-size: 1.5rem; }

    /* Forms full width */
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Tables scroll */
    .content-card {
        padding: 1rem;
        margin-top: 1.2rem;
    }

    /* Buttons in page title - full stretch */
    .page-title .btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    /* Login box */
    .login-box {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    /* Toast: left side on mobile */
    .toast-container { left: 10px; right: 10px; top: 70px; }
    .admin-toast { max-width: 100%; }
}
