/* Admin Dashboard Styles */

:root {
    --sidebar-width: 280px;
    --header-height: 70px;
}

body.admin-body {
    background-color: #08080C; /* Slightly darker than main bg for admin */
    overflow: hidden; /* Prevent body scroll, handle in main-content */
}

.admin-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header img {
    height: 35px;
    margin-right: 10px;
}

.sidebar-header span {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 24px 16px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-left: 12px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-muted);
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(138, 43, 226, 0.1);
    color: var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 24px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    height: var(--header-height);
    background: rgba(11, 11, 15, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    backdrop-filter: blur(10px);
}

.header-search {
    position: relative;
    width: 300px;
}

.header-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 15px 10px 40px;
    border-radius: 20px;
    color: #fff;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--accent-primary);
    background: rgba(138, 43, 226, 0.05);
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* Dashboard Grid */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.dash-header h1 {
    font-size: 2rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.stat-icon.revenue { background: rgba(0, 230, 118, 0.1); color: var(--success); }
.stat-icon.users { background: rgba(0, 240, 255, 0.1); color: var(--accent-secondary); }
.stat-icon.sales { background: rgba(138, 43, 226, 0.1); color: var(--accent-primary); }

.stat-details h3 {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-details .value {
    font-size: 1.8rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.stat-details .trend {
    font-size: 0.8rem;
    margin-top: 5px;
    display: inline-block;
}

.trend.up { color: var(--success); }
.trend.down { color: #FF3B30; }

/* Tables */
.data-table-container {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.completed { background: rgba(0, 230, 118, 0.1); color: var(--success); }
.status-badge.pending { background: rgba(255, 215, 0, 0.1); color: #FFD700; }

/* Fix invisible dropdown options (white text on white browser dropdown) */
select option {
    background-color: #111115; /* Dark background to match theme */
    color: white;
}

/* ----------------------------------------------------
   Admin Mobile & Responsive Layout
---------------------------------------------------- */
.admin-mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #0D0E15;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.admin-mobile-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.admin-mobile-toggle:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: var(--accent-primary);
}

.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.admin-sidebar-backdrop.open {
    display: block;
    opacity: 1;
    pointer-events: all;
}

/* Responsive Grid Form Helpers */
.admin-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.admin-form-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 991px) {
    .admin-mobile-bar {
        display: flex;
    }

    .admin-layout {
        flex-direction: column !important;
        height: auto !important;
        min-height: 100vh;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 290px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.75) !important;
    }

    .admin-sidebar.open {
        transform: translateX(0) !important;
    }

    .admin-main {
        padding: clamp(16px, 3vw, 24px) !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        flex: 1;
    }

    .admin-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px !important;
        margin-bottom: 24px !important;
        height: auto !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    .admin-form-grid-2,
    .admin-form-grid-3 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {
    .admin-main {
        padding: 14px 10px !important;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stat-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px 14px;
        gap: 14px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

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

    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .dash-header h1 {
        font-size: 1.5rem;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    table {
        min-width: 480px;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.82rem;
    }
}
