@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Deep Dark Palette */
    --bg-main: #060d1b;
    --bg-surface: #0d1829;
    --sidebar-bg: rgba(10, 18, 36, 0.95);
    --card-bg: rgba(15, 25, 50, 0.7);
    --card-bg-solid: #0f1932;

    /* Accent */
    --accent: #6366f1;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.4);

    /* Text — High Contrast */
    --text-primary: #f1f5f9;    /* Almost white */
    --text-secondary: #cbd5e1;  /* Light slate */
    --text-muted: #94a3b8;      /* Muted slate */
    --text-subtle: #64748b;     /* Subtle hint text */

    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Borders */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shine: rgba(255, 255, 255, 0.04);

    /* Spacing & Radius */
    --radius-fluid: 18px;
    --radius-sm: 10px;
    --radius-pill: 50px;

    --shadow-premium: 0 8px 32px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(ellipse at 10% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 100%, rgba(168, 85, 247, 0.12) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ───── Floating Sidebar ───── */
.sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium), inset 0 1px 0 rgba(255,255,255,0.06);
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h4 {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.15rem;
}

.sidebar-header .org-name {
    font-size: 0.75rem;
    color: var(--text-subtle);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

/* Super Admin sidebar section group headers */
.sidebar-menu li.sidebar-section-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: var(--text-subtle);
    font-weight: 800;
    padding: 14px 14px 4px;
    margin-bottom: 0;
    pointer-events: none;
}

/* Coming-soon nav items */
.sidebar-menu li a.nav-coming-soon {
    opacity: 0.45;
    cursor: default;
}
.sidebar-menu li a.nav-coming-soon:hover {
    background: transparent !important;
    transform: none !important;
    color: var(--text-secondary) !important;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    gap: 0.85rem;
    transition: var(--transition);
}

.sidebar-menu li a i {
    width: 20px;
    font-size: 1rem;
    opacity: 0.7;
    transition: var(--transition);
}

.sidebar-menu li a:hover {
    background: var(--glass-shine);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-menu li a:hover i { opacity: 1; }

.sidebar-menu li a.active {
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 20px -5px rgba(99, 102, 241, 0.45);
}

.sidebar-menu li a.active i { opacity: 1; }

.sidebar-footer {
    padding: 1rem 0.75rem 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 10px;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ───── Main Wrapper ───── */
.main-wrapper {
    margin-left: 292px;
    padding: 32px 32px 32px 0;
    min-height: 100vh;
    transition: var(--transition);
}

/* ───── Top Navbar ───── */
.navbar {
    padding: 0 0 2rem 0;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar .page-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.navbar .page-subtitle {
    font-size: 0.8rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-top: 2px;
}

/* ───── Glass Cards ───── */
.card-premium {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-fluid);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    transition: var(--transition);
}

.card-premium:hover {
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.card-header {
    padding: 1.25rem 1.75rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    color: var(--text-primary);
}

/* ───── Stat Cards ───── */
.stat-card {
    padding: 2rem 1.75rem;
    border-radius: var(--radius-fluid);
    background: var(--card-bg-solid);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent-gradient);
    pointer-events: none;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,0.06), transparent 70%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(99,102,241,0.15);
}

.stat-card .label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
}

.stat-card .value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .stat-meta {
    font-size: 0.8rem;
    color: var(--text-subtle);
    font-weight: 500;
}

.stat-card .icon-wrapper {
    position: absolute;
    top: 1.75rem; right: 1.75rem;
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    opacity: 0.75;
    box-shadow: 0 8px 20px rgba(99,102,241,0.3);
}

/* ───── Buttons ───── */
.btn-primary-custom {
    background: var(--accent-gradient);
    border: none;
    color: #fff !important;
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary-custom:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.5);
    color: #fff !important;
}

.btn-glass {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary) !important;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.82rem;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-glass:hover {
    background: rgba(255,255,255,0.1);
    color: #fff !important;
    border-color: rgba(255,255,255,0.15);
}

/* ───── Tables ───── */

/* Kill Bootstrap 5's white table CSS variables */
:root {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-active-bg: transparent;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--glass-border);
}

.table-container {
    background: transparent;
    border-radius: var(--radius-fluid);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    --bs-table-bg: transparent;
}

/* Force every table cell background to transparent — do NOT touch color here
   so badge text-success / text-warning / text-danger colours are preserved */
.table > :not(caption) > * > * {
    background-color: transparent !important;
    box-shadow: none;
}

.table thead th {
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    border-bottom: 1px solid var(--glass-border) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
    background: transparent !important;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

.table tbody tr:last-child { border-bottom: none; }

.table td,
.table th {
    padding: 1rem 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    vertical-align: middle;
    border-color: var(--glass-border) !important;
    background: transparent !important;
}

.table td .fw-bold,
.table td .text-white {
    color: var(--text-primary) !important;
}

/* ───── Forms ───── */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    transition: var(--transition) !important;
}

.form-control::placeholder { color: var(--text-subtle) !important; }

.form-control:focus, .form-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    outline: none !important;
}

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.form-select option { background: #1e293b; color: var(--text-primary); }

/* ───── Badges ───── */
.badge {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 0.45em 0.85em;
}

/*
 * Bootstrap's semantic text utilities use dark colours designed for light UIs.
 * Override them globally with vivid, high-contrast variants for our dark theme.
 */
.text-success { color: #34d399 !important; }   /* bright emerald  */
.text-warning { color: #fbbf24 !important; }   /* bright amber    */
.text-danger  { color: #f87171 !important; }   /* bright rose     */
.text-info    { color: #60a5fa !important; }   /* bright sky-blue */
.text-muted   { color: var(--text-muted) !important; }

/*
 * bg-success/bg-warning/bg-danger with bg-opacity-* helpers:
 * Ensure the colour variables point to our vivid status colours.
 */
:root {
    --bs-success-rgb: 16, 185, 129;     /* matches --success: #10b981 */
    --bs-warning-rgb: 245, 158, 11;     /* matches --warning: #f59e0b */
    --bs-danger-rgb:  239, 68, 68;      /* matches --danger:  #ef4444 */
    --bs-info-rgb:    59, 130, 246;     /* matches --info:    #3b82f6 */
}

/* ───── Avatar ───── */
.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

/* ───── Text utilities ───── */
.text-accent { color: var(--accent) !important; }
.text-primary-custom { color: var(--text-primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-subtle { color: var(--text-subtle) !important; }

/* ───── Glass morphism utility ───── */
.glass-morphism {
    background: rgba(15, 25, 50, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* ───── Animations ───── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in:nth-child(1) { animation-delay: 0.05s; }
.animate-fade-in:nth-child(2) { animation-delay: 0.1s; }
.animate-fade-in:nth-child(3) { animation-delay: 0.15s; }

/* ───── Scrollbar ───── */
::-webkit-scrollbar { width: 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); }


/* ───── Responsive ───── */
@media (max-width: 992px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 9999 !important;
        transform: translateX(-100%) !important;
        animation: none !important; /* CRITICAL: Prevent entry animation from overriding transform */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.8) !important;
        background: var(--bg-surface) !important; /* Solid background for mobile */
        opacity: 1 !important;
        visibility: visible !important;
    }

    .sidebar.show {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, 0.7) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 9998 !important;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease !important;
    }

    .sidebar-overlay.show {
        display: block !important;
        opacity: 1 !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
        padding: 20px !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .navbar {
        padding-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

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

@media (max-width: 576px) {
    .main-wrapper {
        padding: 15px;
    }

    .navbar {
        padding-bottom: 1rem;
    }

    .card-premium {
        border-radius: 12px;
    }

    .table-responsive {
        border-radius: 8px;
    }
}

/* ───── Universal High-Contrast Form Controls & Modals ───── */
.modal .form-control,
.modal .form-select,
.form-control,
.form-select {
    background-color: #0d1829 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: none !important;
}

.modal .form-control:focus,
.modal .form-select:focus,
.form-control:focus,
.form-select:focus {
    background-color: #132238 !important;
    color: #ffffff !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25) !important;
}

.modal .form-control::placeholder,
.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
    opacity: 1 !important;
}

select.form-select option,
.modal select.form-select option {
    background-color: #0d1829 !important;
    color: #ffffff !important;
    padding: 10px 14px;
}

/* ───── Universal Modal Stacking & Interactivity Fix ───── */
.modal {
    z-index: 3000 !important;
    background: rgba(2, 6, 23, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

.modal-dialog {
    z-index: 3001 !important;
    pointer-events: auto !important;
    position: relative !important;
}

.modal-backdrop {
    display: none !important;
}



