/* ===== DASHBOARD LAYOUT & CORE ===== */
:root {
    --sidebar-width: 270px;
    --sidebar-collapsed: 80px;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.dashboard-layout {
    display: flex;
    min-height: 100vh; /* Fallback */
    min-height: 100dvh;
    background: radial-gradient(circle at top right, #0F0F1A, #05050A);
    width: 100%;
    overflow-x: hidden;
    font-family: var(--font-sans);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(6, 6, 12, 0.65);
    /* backdrop-filter disabled for performance */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 2000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 20px 0 60px rgba(0,0,0,0.9);
    }
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.sidebar-header {
    padding: 30px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 90px;
    flex-shrink: 0;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .link-text,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-section-label {
    display: none;
}

.sidebar-nav {
    padding: 20px 14px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px;
    margin: 24px 0 12px;
    opacity: 0.6;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    border: 1px solid transparent;
    overflow: hidden;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.03), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.sidebar-link:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.sidebar-link:hover::before {
    opacity: 1;
}

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(0, 217, 165, 0.05));
    border: 1px solid rgba(124, 58, 237, 0.3);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.2), inset 0 0 10px rgba(124, 58, 237, 0.1);
    font-weight: 700;
}

.sidebar-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}

.sidebar-link .link-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== DASHBOARD MAIN ===== */
.dashboard-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .dashboard-main {
    margin-left: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
    .dashboard-main {
        margin-left: 0 !important;
    }
}

/* ===== TOP BAR ===== */
.topbar {
    height: 72px;
    background: rgba(6, 6, 12, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* backdrop-filter disabled for performance */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: var(--glass-border);
    transform: scale(1.05);
}

/* ===== DASHBOARD CONTENT ===== */
.dashboard-content {
    padding: 32px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== PREMIUM CARDS & GLASSMORPHISM ===== */
.card {
    background: var(--glass-bg);
    /* backdrop-filter disabled for performance */
    
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.section-title span {
    font-size: 24px;
    filter: drop-shadow(0 0 8px var(--primary));
}

/* Service Grid Specifics */
.service-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.service-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-light);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px rgba(124, 58, 237, 0.1);
}

.service-card:hover::after { opacity: 1; }

.service-icon-box {
    width: 64px;
    height: 64px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.service-card:hover .service-icon-box {
    transform: rotate(10deg);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 30px var(--primary);
}

.service-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    z-index: 1;
}

.service-status {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    z-index: 1;
}

/* Grid Layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .dashboard-content { padding: 24px 16px; }
    .topbar { padding: 0 20px; }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    /* backdrop-filter disabled for performance */
    z-index: 1500;
}

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

/* ===== WALLET & POLICY CARDS ===== */
.policy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.micro-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 14px 10px;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}



/* --- SIDEBAR SUB-MENU STYLES --- */
.sidebar-sub-menu {
    margin-left: 15px;
    margin-top: 4px;
    margin-bottom: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-sub-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0 8px 8px 0;
    position: relative;
}

.sidebar-sub-link::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-sub-link:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sidebar-sub-link.active {
    color: var(--primary-light);
    font-weight: 700;
    background: rgba(108, 99, 255, 0.05);
}

.sidebar-sub-link.active::before {
    background: var(--primary);
    width: 10px;
}

.micro-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 15px rgba(124, 58, 237, 0.1);
}

.micro-card .icon {
    font-size: 22px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.3));
}

.micro-card .value {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.micro-card .label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    margin-top: 4px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    /* backdrop-filter disabled for performance */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content {
    background: #0A0A10;
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    width: 100%;
    max-width: 440px;
    padding: 36px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
}

.modal-overlay.active .modal-content {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.amount-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 8px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.amount-btn:hover, .amount-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}@media (max-width: 768px) {
    .dashboard-main {
        padding-bottom: 100px;
    }
}


@media (max-width: 900px) {
    .topbar {
        padding: 0 12px !important;
        gap: 8px;
        overflow-x: auto;
    }
    
    .sidebar-toggle-btn {
        width: 44px !important;
        height: 44px !important;
        background: rgba(108, 99, 255, 0.2) !important;
        border: 1px solid rgba(108, 99, 255, 0.4) !important;
        color: #fff !important;
        box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3) !important;
        font-size: 24px !important;
    }

    .topbar-right {
        gap: 8px !important;
    }
    
    .topbar-right > div {
        gap: 8px !important;
        padding: 6px 12px !important;
        border-radius: 14px !important;
    }

    #topbarVendorName {
        font-size: 13px !important;
        max-width: 90px !important;
    }
    
    #topbarVendorId {
        font-size: 9px !important;
    }

    #topbarKycBadge {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }

    #kycBadgeText {
        font-size: 9px !important;
    }

    #topbarStatusToggle {
        padding: 0 20px 0 10px !important;
        font-size: 12px !important;
    }
    
    .topbar-title {
        font-size: 16px !important;
    }
    
    .topbar-subtitle {
        display: none !important;
    }

    .topbar-right > button.shimmer {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}


@media (max-width: 900px) {
    .sidebar {
        padding-bottom: 150px !important; /* Ensure logout button is fully visible */
        overflow-y: auto !important;
    }
    
    .sidebar-menu {
        padding-bottom: 40px !important;
    }
    
    /* Make topbar horizontally scrollable if needed */
    .topbar {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
    }
    
    .topbar::-webkit-scrollbar {
        display: none;
    }
    
    .topbar-right {
        margin-left: auto !important;
        flex-shrink: 0 !important;
    }
    
    /* Hide text on Sync Region button to save space */
    .topbar-right > button.shimmer {
        padding: 8px !important;
        width: 36px !important;
        height: 36px !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }
    
    .topbar-right > button.shimmer span, 
    .topbar-right > button.shimmer i:last-child {
        display: none !important;
    }
    
    /* Shrink the right side glass panel */
    .topbar-right > div {
        padding: 4px 10px !important;
        gap: 6px !important;
    }
}

/* Toggle Switch Styling */
.switch { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.1); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(14px); }
.slider.round { border-radius: 34px; }

