/* ═══════════════════════════════════════════════════════════
           BRAND COLOUR TOKENS — change here, applies everywhere
           Primary   : #5a50a2  (purple)
           Secondary : #f36d21  (orange)
        ═══════════════════════════════════════════════════════════ */
:root {
    --color-primary: #5a50a2;
    --color-primary-hover: #4a4191;
    /* slightly darker */
    --color-primary-light: rgba(90, 80, 162, .09);
    /* tint bg */
    --color-secondary: #f36d21;
    --color-secondary-hover: #e05e14;
    --color-secondary-light: rgba(243, 109, 33, .09);
}

/* ── BUTTON COLOUR — #f36d21 (orange) used for ALL buttons ──
           Override Bootstrap's btn-primary here so every btn-primary
           across the admin panel automatically shows orange.          */
.btn-primary {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: #fff !important;
    border-radius: 8px !important;
    /* rounded-3 */
    padding-left: 1.5rem !important;
    /* px-4 */
    padding-right: 1.5rem !important;
    /* px-4 */
    padding-top: 0.5rem !important;
    /* py-2 */
    padding-bottom: 0.5rem !important;
    /* py-2 */
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .07) !important;
    /* shadow-sm */
    transition: all 0.2s ease;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--color-secondary-hover) !important;
    border-color: var(--color-secondary-hover) !important;
    box-shadow: 0 4px 12px rgba(243, 109, 33, .25) !important;
    transform: translateY(-1px);
}

/* outline variant */
.btn-outline-primary {
    color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    border-radius: 8px !important;
    /* rounded-3 */
    padding-left: 1.5rem !important;
    /* px-4 */
    padding-right: 1.5rem !important;
    /* px-4 */
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(243, 109, 33, .15) !important;
    transform: translateY(-1px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f7f8fc;
}

/* ============================================================
           ROOT LAYOUT: two columns side by side, full viewport height
           LEFT  = sidebar (full height)
           RIGHT = main (navbar on top + scrollable content below)
        ============================================================ */
#layout-root {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
    width: 220px;
    min-width: 220px;
    height: 100vh;
    padding: 15px;
    /* background: #fff; */
    /* border-right: 1px solid #e9ecef; */
    display: flex;
    flex-direction: column;
    transition: width 0.22s ease, min-width 0.22s ease;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 100;
}

#sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

/* ── MAIN COLUMN (right side) ── */
#main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 15px 15px 15px 0;
}

/* ── TOP NAVBAR (inside main col) ── */
#top-navbar {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    z-index: 50;
    border-radius: 7px 7px 0 0;
}

/* ── PAGE CONTENT (scrollable) ── */
#page-content {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    padding: 20px 10px;
    border-radius: 0 0 7px 7px;
}

/* hide scrollbar, keep scroll working */
#page-content::-webkit-scrollbar {
    display: none;
}

#page-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ── Sidebar scroll (hidden scrollbar, still scrollable) ── */
#sidebar-nav-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#sidebar-nav-scroll::-webkit-scrollbar {
    width: 0;
    background: transparent;
}


.nav-recharge-btn {
    background: var(--color-secondary);
    box-shadow: 0 2px 8px rgba(243, 109, 33, 0.30);
    transition: background 0.15s;
}

.nav-recharge-btn:hover {
    background: var(--color-secondary-hover);
}

/* ── User avatar: primary color (purple) ── */
.nav-avatar {
    background: var(--color-primary);
}

/* ── Quick link hover: primary color ── */
.nav-top-link {
    transition: background 0.15s, color 0.15s;
}

.nav-top-link:hover {
    background: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
}

/* ── Icon buttons hover: primary color ── */
.nav-top-icon {
    transition: background 0.15s, color 0.15s;
}

.nav-top-icon:hover {
    background: var(--color-primary-light);
    color: var(--color-primary) !important;
}

/* ── User dropdown hover ── */
#userDropdownBtn:hover {
    border-color: var(--color-primary) !important;
}

/* ── Dropdown items hover ── */
.dropdown-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.hover-translate-y:hover {
    transform: translateY(-5px);
}

.transition-all {
    transition: all 0.3s ease;
}

.btn-white {
    background: white;
    color: #1e293b;
}

/* ── Brand icon uses primary color ── */
.sb-brand-icon {
    background: var(--color-primary);
}

/* ── Toggle button ── */
.sb-toggle-btn {
    color: #888;
    transition: background 0.15s, color 0.15s;
}

.sb-toggle-btn:hover {
    background: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
}

/* ── Nav link base ── */
.sb-nav-link {
    color: #5c6880;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

/* ── Hover: primary tint ── */
.sb-nav-link:hover {
    background: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
}

.sb-nav-link:hover .sb-icon,
.sb-nav-link:hover .sb-label {
    color: var(--color-primary) !important;
}

/* ── Active: primary tint + primary text ── */
.sb-nav-link.sb-active {
    background: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
    font-weight: 600;
}

.sb-nav-link.sb-active .sb-icon,
.sb-nav-link.sb-active .sb-label {
    color: var(--color-primary) !important;
}

/* ── Logout: danger color ── */
.sb-logout {
    color: #dc3545 !important;
}

.sb-logout .sb-icon,
.sb-logout .sb-label {
    color: #dc3545 !important;
}

.sb-logout:hover {
    background: #fff0f0 !important;
    color: #dc3545 !important;
}

/* ── Collapsed: center icons, hide labels ── */
#sidebar.collapsed .sb-nav-link {
    justify-content: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#sidebar.collapsed .sb-brand {
    justify-content: center;
}

/* ══════════════════════════════════════════════
   NAVBAR & SIDEBAR CUSTOM CLASSES (Replacing inline styles)
   ══════════════════════════════════════════════ */

/* -- Navbar Options -- */
.nav-top-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #5c6880;
    transition: background 0.15s, color 0.15s;
}

.nav-top-icon-box:hover {
    background: var(--color-primary-light);
    color: var(--color-primary) !important;
}

.nav-badge {
    font-size: 0.5rem;
    padding: 2px 5px;
    top: 4px;
    right: 4px;
    border: 2px solid #fff;
    line-height: 1.2;
}

.user-dropdown-btn {
    font-size: 0.82rem;
    font-weight: 500;
}

.user-avatar-small {
    width: 28px;
    height: 28px;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

.user-dropdown-chevron {
    font-size: 0.7rem;
}

.user-dropdown-menu {
    border-radius: 12px;
    min-width: 185px;
}

.dropdown-header-custom {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* -- Sidebar Custom Classes -- */
.sb-brand-container {
    height: 56px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    border-radius: 7px;
}

.sb-brand-icon-box {
    width: 32px;
    height: 32px;
}

.sb-brand-text {
    font-size: 1.05rem;
    letter-spacing: -0.2px;
}

.sb-toggle-btn-box {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-chevron-icon {
    font-size: 0.85rem;
}

.sb-nav-icon {
    font-size: 1.05rem;
    width: 18px;
    text-align: center;
}

.sb-nav-text {
    font-size: 0.875rem;
    white-space: nowrap;
}

.sb-footer-container {
    border-top: 1px solid #f0f0f0;
}

/* ══════════════════════════════════════════════
   STAT CARDS — horizontal scrollable row
   Matches the compact card design in the UI
   ══════════════════════════════════════════════ */

/* 9-column grid on desktop, 2-column on mobile */
.stat-scroll-row {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 10px;
}

@media (max-width: 768px) {
    .stat-scroll-row {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .stat-scroll-row::-webkit-scrollbar {
        display: none;
    }

    .stat-card {
        flex: 0 0 calc(50% - 5px);
        min-width: calc(50% - 5px);
    }
}

/* Individual card */
.stat-card {
    background: #f7f8fc;
    border: 1px solid #e9e9f4;
    border-radius: 7px;
    padding: 12px;
    cursor: pointer;
    min-width: 0;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.stat-card:hover {
    border-color: var(--color-secondary);
    box-shadow: 0 2px 12px rgba(243, 109, 33, 0.13);
    transform: translateY(-2px);
}

/* Icon wrapper — orange tinted circle */
.stat-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgb(233 233 244);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--color-primary);
    font-size: 1rem;
}

/* Label */
.stat-title {
    font-size: 0.65rem;
    color: #8a94a6;
    font-weight: 400;
    margin-bottom: 3px;
    white-space: nowrap;
    line-height: 1.2;
}

/* Number */
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1;
}

/* ══════════════════════════════════════════════
   CHART CARDS
   ══════════════════════════════════════════════ */
.chart-card {
    background: #fff;
    border: 1px solid #f0ede8;
    border-radius: 14px;
    padding: 20px 20px 16px;
    height: 100%;
}

.chart-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chart-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.chart-card-sub {
    font-size: 0.72rem;
    color: #8a94a6;
    margin: 0;
}

.chart-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(243, 109, 33, .10);
    color: var(--color-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.chart-body {
    position: relative;
    width: 100%;
}

/* ══════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION & BOTTOM SHEET
   ══════════════════════════════════════════════ */

/* ── Hide sidebar/sidebar-brand on small screens ── */
@media (max-width: 768px) {
    #sidebar {
        display: none !important;
    }

    #main-col {
        padding: 5px !important;
    }

    #top-navbar {
        border-radius: 7px !important;
        margin-bottom: 15px;
    }

    #page-content {
        border-radius: 7px !important;
    }
}

/* ── Bottom Nav Bar ── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    z-index: 2005;
    /* Keeps navigation visible above the bottom sheet */
    justify-content: space-around;
    align-items: flex-end;
    padding-bottom: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }

    #layout-root {
        padding-bottom: 80px;
    }
}

.nav-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-decoration: none;
    color: #8a94a6;
    font-size: 0.60rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    transition: color 0.1s;
    flex: 1;
}

.nav-item-mobile i {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.nav-item-mobile.active,
.nav-item-mobile.active-orange {
    color: var(--color-secondary) !important;
}

/* ── Center Dashboard Wrapper ── */
.nav-center-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-decoration: none;
    color: var(--color-secondary);
    font-size: 0.60rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    flex: 1;
}

/* ── Floating Center Button ── */
.fab-center {
    position: absolute;
    bottom: 22px;
    width: 52px;
    height: 52px;
    background: var(--color-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 8px rgba(243, 109, 33, 0.25);
    z-index: 2006;
}

/* ── Bottom Sheet (More Options) ── */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(2px);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.show {
    display: block;
    opacity: 1;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 2001;
    transition: bottom 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 24px 24px 10px 24px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.show {
    bottom: 0;
}

.sheet-handle {
    width: 38px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    margin: 0 auto 24px;
}

.sheet-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

/* ── Grid Menu ── */
/* ── Swipeable Menu Carousel ── */
.menu-carousel-wrapper {
    position: relative;
    margin: 0 -10px;
    /* offset bottom-sheet padding for full-width swipe */
}

.menu-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 10px;
}

.menu-carousel::-webkit-scrollbar {
    display: none;
}

.menu-page {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-bottom: 20px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 5px;
    padding-bottom: 10px;
}

.carousel-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.3s;
}

.carousel-dots .dot.active {
    background: var(--color-secondary);
    width: 12px;
    border-radius: 4px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    border-radius: 16px;
    background: #f8fafc;
    text-decoration: none;
    transition: transform 0.15s, background 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.menu-item:active {
    transform: scale(0.95);
    background: #f1f5f9;
}

.menu-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.menu-label {
    font-size: 0.62rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    color: #1e293b;
    letter-spacing: 0.2px;
}

/* ── Icon Background Variants ── */
.bg-orange-light {
    background: #fff7ed;
    color: #ea580c;
}

.bg-purple-light {
    background: #f5f3ff;
    color: #7c3aed;
}

.bg-teal-light {
    background: #f0fdf4;
    color: #10b981;
}

.bg-blue-light {
    background: #eff6ff;
    color: #3b82f6;
}

.bg-yellow-light {
    background: #fefce8;
    color: #eab308;
}

.bg-red-light {
    background: #fef2f2;
    color: #ef4444;
}

.bg-grey-light {
    background: #f1f5f9;
    color: #64748b;
}

/* ══════════════════════════════════════════════
   PREMIUM TABLE & UI COMPONENTS
   ══════════════════════════════════════════════ */

.table-header-premium {
    background: #fdfdfd !important;
    border-top: 1px solid #f1f3f9 !important;
    border-bottom: 2px solid #f1f3f9 !important;
}

.table-header-premium th {
    color: #475569 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.8px !important;
    padding: 16px 20px !important;
    vertical-align: middle !important;
}

/* Custom Premium Toggle */
.premium-switch {
    padding-left: 0 !important;
}

.premium-switch .form-check-input {
    width: 2.8rem !important;
    height: 1.4rem !important;
    border: 1.5px solid #e2e8f0 !important;
    background-color: #f1f5f9 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2394a3b8'/%3e%3c/svg%3e") !important;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    margin-top: 0 !important;
}

.premium-switch .form-check-input:checked {
    background-color: #10b981 !important;
    /* Green for active status */
    border-color: #10b981 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.premium-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
}

/* Action Buttons Premium */
.btn-action {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    font-size: 1rem !important;
}

.btn-action-edit {
    background-color: #f1f5f9 !important;
    color: var(--color-primary) !important;
}

.btn-action-edit:hover {
    background-color: var(--color-primary) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(90, 80, 162, 0.2) !important;
}

.btn-action-delete {
    background-color: #fff1f2 !important;
    color: #e11d48 !important;
}

.btn-action-delete:hover {
    background-color: #e11d48 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.2) !important;
}

/* ══════════════════════════════════════════════
   PREMIUM FORM COMPONENTS
   ══════════════════════════════════════════════ */

.premium-input {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px 12px 45px;
    transition: all 0.3s ease;
    background-color: #f8fafc;
    color: #1e293b;
    font-size: 0.95rem;
}

.premium-input:focus {
    border-color: var(--color-primary) !important;
    box-shadow: none !important;
    background-color: #fff;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    color: #94a3b8;
    transition: color 0.3s ease;
    font-size: 1.1rem;
}

.premium-input:focus+i,
.input-icon-wrapper:focus-within i {
    color: var(--color-primary);
}

.form-label-custom {
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: block;
}

.file-upload-wrapper {
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8fafc;
    cursor: pointer;
}

.file-upload-wrapper:hover {
    border-color: var(--color-primary);
    background: #f1f5f9;
}

.btn-premium {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    border: none;
    border-radius: 12px;
    padding: 12px 32px;
    font-weight: 600;
    color: white;
    transition: all 0.4s ease;
    box-shadow: 0 4px 12px rgba(90, 80, 162, 0.2);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 80, 162, 0.3);
    color: white;
}

.btn-back {
    border-radius: 8px !important;
    padding: 10px 24px !important;
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .03) !important;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Select Styling */
.premium-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px;
}