/* ==========================================================================
   KheyalGhor V2 - Extej Dashboard Layout System
   Applicable for: Superadmin, Admin, Expert Doctor, and Vendor
   Matches exact layout, sidebar menu, item placings, and orange accent style
   ========================================================================== */

:root {
    --extej-bg: #f4f6fa;
    --extej-card-bg: #ffffff;
    --extej-text-primary: #1e293b;
    --extej-text-secondary: #64748b;
    --extej-text-muted: #94a3b8;
    --extej-border: #eef2f6;
    --extej-border-dark: #e2e8f0;
    --extej-orange: #ff7a18;
    --extej-orange-dark: #ff5200;
    --extej-orange-gradient: linear-gradient(135deg, #ff7a18 0%, #ff5200 100%);
    --extej-orange-glow: 0 4px 16px 0 rgba(255, 107, 0, 0.35);
    --extej-sidebar-w: 270px;
    --extej-topbar-h: 68px;
}

/* Base Body */
body.extej-body {
    background-color: var(--extej-bg);
    color: var(--extej-text-primary);
    font-family: 'Hind Siliguri', 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Application Layout Frame */
.extej-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background-color: var(--extej-bg);
    position: relative;
}

/* ==========================================================================
   LEFT SIDEBAR (Exact Match to Extej)
   ========================================================================== */
.extej-sidebar {
    width: var(--extej-sidebar-w);
    min-width: var(--extej-sidebar-w);
    background: #ffffff;
    border-right: 1px solid var(--extej-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 45;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.extej-sidebar::-webkit-scrollbar {
    width: 4px;
}
.extej-sidebar::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 4px;
}

/* Sidebar Top Brand Header */
.extej-sidebar-brand {
    height: var(--extej-topbar-h);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--extej-border);
    flex-shrink: 0;
}
.extej-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--extej-text-primary);
}
.extej-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--extej-orange-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.28);
    flex-shrink: 0;
}
.extej-logo-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.1;
}
.extej-logo-subtitle {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--extej-text-muted);
}
.extej-collapse-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--extej-border);
    background: #f8fafc;
    color: var(--extej-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}
.extej-collapse-btn:hover {
    background: #eef2f6;
    color: var(--extej-text-primary);
}

/* Sidebar Nav Body */
.extej-sidebar-nav {
    flex: 1;
    padding: 12px 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.extej-nav-group {
    display: flex;
    flex-direction: column;
}
.extej-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 8px 20px 6px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Navigation Items (.tab-btn and .extej-nav-item) */
.extej-sidebar .tab-btn,
.extej-sidebar .extej-nav-item {
    width: calc(100% - 20px);
    margin: 2px 10px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    box-sizing: border-box;
}
.extej-sidebar .tab-btn:hover,
.extej-sidebar .extej-nav-item:hover {
    background: #f8fafc;
    color: #0f172a;
}
.extej-sidebar .tab-btn .nav-left,
.extej-sidebar .extej-nav-item .nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.extej-sidebar .tab-btn i.tab-icon,
.extej-sidebar .tab-btn i:first-child,
.extej-sidebar .extej-nav-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 15px;
    color: #94a3b8;
    transition: color 0.18s;
    flex-shrink: 0;
}
.extej-sidebar .tab-btn span.tab-title,
.extej-sidebar .tab-btn span.flex-1,
.extej-sidebar .extej-nav-item span.tab-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13.5px;
}
.extej-sidebar .tab-btn .nav-right,
.extej-sidebar .extej-nav-item .nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}
.extej-sidebar .tab-btn .badge-count,
.extej-sidebar .tab-btn span.rounded-full,
.extej-sidebar .tab-btn span.rounded,
.extej-sidebar .extej-nav-item .badge-count {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.18s;
}
.extej-sidebar .tab-btn i.fa-chevron-right,
.extej-sidebar .tab-btn .chevron-right,
.extej-sidebar .extej-nav-item i.fa-chevron-right {
    font-size: 10px;
    color: #cbd5e1;
    transition: all 0.18s;
}

/* ==========================================================================
   ACTIVE TAB HIGHLIGHT (Exact Extej Style: Orange Gradient Pill with Glow)
   ========================================================================== */
.extej-sidebar .tab-btn.active,
.extej-sidebar .extej-nav-item.active {
    background: var(--extej-orange-gradient) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: var(--extej-orange-glow) !important;
    border-color: transparent !important;
}
.extej-sidebar .tab-btn.active i.tab-icon,
.extej-sidebar .tab-btn.active i:first-child,
.extej-sidebar .tab-btn.active .nav-icon {
    color: #ffffff !important;
}
.extej-sidebar .tab-btn.active span.tab-title,
.extej-sidebar .tab-btn.active span.flex-1 {
    color: #ffffff !important;
}
.extej-sidebar .tab-btn.active .badge-count,
.extej-sidebar .tab-btn.active span.rounded-full,
.extej-sidebar .tab-btn.active span.rounded {
    background: rgba(255, 255, 255, 0.28) !important;
    color: #ffffff !important;
}
.extej-sidebar .tab-btn.active i.fa-chevron-right,
.extej-sidebar .tab-btn.active .chevron-right {
    color: #ffffff !important;
    opacity: 0.95 !important;
}

/* ==========================================================================
   MAIN CONTENT WRAPPER & TOP NAVBAR
   ========================================================================== */
.extej-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Top Navbar (Aligned exactly like in image) */
.extej-topbar {
    height: var(--extej-topbar-h);
    background: #ffffff;
    border-bottom: 1px solid var(--extej-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 35;
    flex-shrink: 0;
}
.extej-topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    max-width: 500px;
}
.extej-search-box {
    position: relative;
    width: 100%;
    max-width: 360px;
}
.extej-search-box input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 38px;
    background: #f8fafc;
    border: 1px solid var(--extej-border-dark);
    border-radius: 12px;
    font-size: 13px;
    color: #334155;
    outline: none;
    transition: all 0.2s;
}
.extej-search-box input:focus {
    background: #ffffff;
    border-color: var(--extej-orange);
    box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.12);
}
.extej-search-box i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #94a3b8;
}

.extej-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.extej-action-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--extej-border-dark);
    background: #ffffff;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.18s;
}
.extej-action-icon:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}
.extej-action-icon .dot-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--extej-orange-dark);
    border: 1.5px solid #ffffff;
}

/* User Profile Badge (Matching image: Avatar + Name + Subtitle) */
.extej-profile-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.18s;
}
.extej-profile-pill:hover {
    background: #f8fafc;
}
.extej-profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--extej-border-dark);
    flex-shrink: 0;
}
.extej-profile-meta {
    text-align: left;
    display: none;
}
@media (min-width: 640px) {
    .extej-profile-meta {
        display: block;
    }
}
.extej-profile-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.extej-profile-role {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.2;
}

/* iOS Pill Switch (Toggle) */
.extej-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.extej-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.extej-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: .25s;
    border-radius: 24px;
}
.extej-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.extej-switch input:checked + .extej-slider {
    background-color: var(--extej-orange);
}
.extej-switch input:checked + .extej-slider:before {
    transform: translateX(16px);
}

/* Flag / Country Selector Pill */
.extej-flag-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--extej-border-dark);
    background: #ffffff;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.18s;
}
.extej-flag-btn:hover {
    background: #f8fafc;
    color: #0f172a;
}

/* Mobile Sidebar Drawer Overlay */
.extej-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.extej-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   WORKSPACE CONTENT & CARDS (Item Placings from Image)
   ========================================================================== */
.extej-content {
    flex: 1;
    padding: 28px;
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.extej-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.extej-title {
    font-size: 26px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.extej-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 3px;
}

/* Generic Card Container */
.extej-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid var(--extej-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 24px;
    position: relative;
    box-sizing: border-box;
}

/* Top Feature Cards Grid */
.extej-top-cards {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 1024px) {
    .extej-top-cards {
        grid-template-columns: 1fr;
    }
}

/* Card 1: Balance / Primary Metric */
.card-balance {
    grid-column: span 6;
}
@media (max-width: 1280px) {
    .card-balance {
        grid-column: span 6;
    }
}
@media (max-width: 1024px) {
    .card-balance {
        grid-column: span 12;
    }
}

/* Card 2: Secondary Metric + 3 Orange Action Pills */
.card-secondary {
    grid-column: span 4;
}
@media (max-width: 1280px) {
    .card-secondary {
        grid-column: span 4;
    }
}
@media (max-width: 1024px) {
    .card-secondary {
        grid-column: span 12;
    }
}

/* Card 3: + ADD / Preview Card */
.card-preview {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #cbd5e1;
    background: #fbfcfe;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 180px;
}
.card-preview:hover {
    border-color: var(--extej-orange);
    background: #fff7ed;
    color: var(--extej-orange);
}
@media (max-width: 1280px) {
    .card-preview {
        grid-column: span 2;
    }
}
@media (max-width: 1024px) {
    .card-preview {
        grid-column: span 12;
        min-height: 100px;
    }
}

/* Extej Orange Pill Buttons */
.extej-btn-orange {
    background: var(--extej-orange-gradient);
    color: #ffffff !important;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: 12px;
    padding: 8px 16px;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(255, 107, 0, 0.25);
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}
.extej-btn-orange:hover {
    background: linear-gradient(135deg, #ea6c0e 0%, #e64a00 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(255, 107, 0, 0.35);
}

/* Time Range Filter Pills (1D, 7D, 1M, 3M, 6M, 1Y, ALL) */
.extej-filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--extej-border);
}
.extej-filter-pill {
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 8px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.extej-filter-pill:hover {
    color: #0f172a;
}
.extej-filter-pill.active {
    background: var(--extej-orange);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 122, 24, 0.3);
}

/* "My Card" Row (Matching Bottom of Screenshot) */
.extej-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 16px;
}
@media (max-width: 900px) {
    .extej-cards-row {
        grid-template-columns: 1fr;
    }
}
.extej-bank-card {
    border-radius: 18px;
    background: #ffffff;
    border: 1.5px solid var(--extej-border);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.extej-bank-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}
.extej-bank-card.active {
    border-color: var(--extej-orange);
    box-shadow: 0 4px 16px rgba(255, 122, 24, 0.15);
}
.card-active-check {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--extej-orange);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* ==========================================================================
   SIDEBAR COLLAPSED STATE (Desktop icon-only mode)
   ========================================================================== */
.extej-sidebar.sidebar-collapsed {
    width: 80px !important;
    min-width: 80px !important;
}
.extej-sidebar.sidebar-collapsed .extej-logo-title,
.extej-sidebar.sidebar-collapsed .extej-logo-subtitle,
.extej-sidebar.sidebar-collapsed .extej-section-title,
.extej-sidebar.sidebar-collapsed .tab-title,
.extej-sidebar.sidebar-collapsed .tab-btn span.flex-1,
.extej-sidebar.sidebar-collapsed .nav-right,
.extej-sidebar.sidebar-collapsed #sidebarRolePill {
    display: none !important;
}
.extej-sidebar.sidebar-collapsed .extej-sidebar-brand {
    padding: 0 14px !important;
    justify-content: center !important;
}
.extej-sidebar.sidebar-collapsed .extej-collapse-btn {
    transform: rotate(180deg);
}
.extej-sidebar.sidebar-collapsed .tab-btn,
.extej-sidebar.sidebar-collapsed .extej-nav-item {
    width: 48px !important;
    margin: 4px auto !important;
    padding: 10px !important;
    justify-content: center !important;
}
.extej-sidebar.sidebar-collapsed .nav-left {
    justify-content: center !important;
    flex: none !important;
}
.extej-sidebar.sidebar-collapsed .tab-icon,
.extej-sidebar.sidebar-collapsed .tab-btn i:first-child {
    margin: 0 !important;
    font-size: 17px !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets and Mobiles)
   ========================================================================== */
@media (max-width: 1023px) {
    .extej-layout {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    .extej-sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        height: 100vh !important;
        width: var(--extej-sidebar-w) !important;
        min-width: var(--extej-sidebar-w) !important;
        z-index: 50 !important;
        transform: translateX(-100%) !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .extej-sidebar.open {
        transform: translateX(0) !important;
    }
    .extej-main-wrapper {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        left: 0 !important;
        overflow-x: hidden !important;
    }
    .extej-topbar {
        padding: 0 16px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .extej-content {
        padding: 16px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}


/* ==========================================================================
   COMPACT STAT STRIP (For Sub-Tabs: Products, Orders, Roles, Doctor, etc.)
   Takes less than 44px height, giving 100% viewport space to tables/forms
   ========================================================================== */
.extej-compact-strip {
    background: #ffffff;
    border: 1px solid var(--extej-border);
    border-radius: 12px;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    margin-bottom: 4px;
}
.extej-compact-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--extej-text-primary);
}
.extej-compact-left i {
    color: var(--extej-orange);
    font-size: 14px;
}
.extej-compact-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
}
.extej-compact-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.extej-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
}
.extej-stat-pill strong {
    color: #0f172a;
    font-weight: 700;
}
.extej-stat-pill.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}
.extej-stat-pill.success strong {
    color: #15803d;
}
.extej-stat-pill.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.extej-stat-pill.warning strong {
    color: #b45309;
}
.extej-stat-pill.info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.extej-stat-pill.info strong {
    color: #2563eb;
}
.extej-stat-pill.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.extej-stat-pill.danger strong {
    color: #b91c1c;
}
