/* FrankoData Sidebar - Premium Theme (Cobalt Blue #0047AB, Navy #000080, Sky Blue #82C8E5, Slate #6D8196) */

/* =========================================
   1. VARIABLES & BASICS
   ========================================= */
:root {
    --sidebar-width: 280px;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f0f7ff;
    --sidebar-active: #e2f0fb;
    --accent-color: #0047AB;
    --accent-glow: rgba(0, 71, 171, 0.3);
    --accent-dark: #000080;
    --accent-light: #82C8E5;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #6D8196;
    --border-color: #dbe5ee;
    --transition-speed: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. CONTAINER & LAYOUT (Desktop)
   ========================================= */
.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;

    display: flex;
    flex-direction: column;

    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed);

    /* SCROLLBAR LOGIC */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(13, 148, 136, 0.2) transparent;
}

/* Push content to the right on Desktop */
@media (min-width: 993px) {
    .main-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
        transition: margin-left var(--transition-speed);
        padding: 2rem;
    }
}

/* Scrollbar Styling */
.sidebar-container::-webkit-scrollbar {
    width: 6px;
}

.sidebar-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-container::-webkit-scrollbar-thumb {
    background-color: rgba(13, 148, 136, 0.2);
    border-radius: 4px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(13, 148, 136, 0.4);
}

/* =========================================
   3. HEADER AREA
   ========================================= */
.sidebar-header {
    padding: 1.5rem;
    padding-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    margin-bottom: 0;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-container {
    width: auto;
    min-width: 40px;
    height: 48px;
    background: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
    padding: 6px 10px;
}

.brand-logo {
    width: auto;
    height: 36px;
    max-width: 160px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo-container:hover .brand-logo {
    transform: scale(1.1);
}

.brand-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
    letter-spacing: 0.5px;
}

.close-sidebar-btn {
    display: none;
}

/* =========================================
   4. WALLET CARD - Premium Teal Gradient
   ========================================= */
.sidebar-wallet-card {
    position: relative;
    margin: 0.5rem 1.25rem 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #0047AB 0%, #000080 100%);
    color: white;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 71, 171, 0.35);
    overflow: hidden;
    border: none;
    flex-shrink: 0;
}

/* Decorative circle background */
.sidebar-wallet-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    transform: rotate(45deg);
    pointer-events: none;
}

.sidebar-wallet-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.sidebar-wallet-card .label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.9;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}

.sidebar-wallet-card .amount {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0.25rem 0 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
}

.btn-topup {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    color: #0047AB;
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-topup:hover {
    background: #0f172a;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.user-profile-section {
    padding: 0 1.5rem 1.5rem;
    text-align: left;
    flex-shrink: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.user-name {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Hide old elements if they exist */
.user-role,
.user-email {
    display: none;
}

/* =========================================
   5. NAVIGATION MENU
   ========================================= */
.sidebar-menu {
    flex: 1;
    padding: 0 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #64748b !important;
    margin: 1.5rem 0 0.5rem;
    padding-left: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: #475569 !important;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 600;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.menu-item span {
    color: inherit !important;
}

.menu-item .icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #64748b !important;
}

/* Hover State */
.menu-item:hover {
    color: #0f172a !important;
    background: #f0f7ff !important;
}

.menu-item:hover .icon {
    color: #0047AB !important;
    transform: scale(1.1);
}

/* Active State */
.menu-item.active {
    background: #e2f0fb !important;
    color: #0047AB !important;
    font-weight: 700;
}

.menu-item.active .icon {
    color: #0047AB !important;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: #0047AB;
    border-radius: 0 4px 4px 0;
}

/* Theme Button - Hidden (Single Theme) */
.menu-item.theme-btn {
    display: none !important;
}

/* Logout Button */
.menu-item.logout {
    margin-top: auto;
    color: #ef4444;
}

.menu-item.logout .icon {
    color: #ef4444;
}

.menu-item.logout:hover {
    background: #fee2e2;
    color: #dc2626;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 1.5rem 0;
    flex-shrink: 0;
}

/* =========================================
   6. MOBILE RESPONSIVE & HEADER
   ========================================= */
.mobile-header-bar {
    display: none;
    /* Hidden on Desktop */
}

@media (max-width: 991px) {

    /* Mobile Header Bar - Teal Gradient */
    .mobile-header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: linear-gradient(135deg, #0047AB 0%, #000080 100%);
        padding: 0 1.25rem;
        z-index: 99990;
        border-bottom: none;
        box-shadow: 0 4px 20px rgba(0, 71, 171, 0.3);
        transition: all var(--transition-speed);
    }

    .mobile-brand {
        font-weight: 800;
        font-size: 1.2rem;
        color: white;
        letter-spacing: -0.5px;
    }

    /* Mobile Balance */
    .mob-balance {
        color: white;
        font-weight: 600;
    }

    /* Theme Toggle - Hidden */
    .mobile-toggle-btn {
        display: none !important;
    }

    /* Hamburger Button */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 12px;
        border: none;
        font-size: 1.5rem;
        color: white;
        cursor: pointer;
        backdrop-filter: blur(4px);
        transition: all 0.2s ease;
    }

    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.05);
    }

    /* Sidebar Transformation */
    .sidebar-container {
        transform: translateX(-100%);
        box-shadow: none;
        width: 85%;
        max-width: 300px;
        z-index: 9999999; /* Overlays mobile header */
        height: 100vh;
        height: 100dvh;
        top: 0;
        bottom: 0;
        background: var(--sidebar-bg);
    }

    /* Active State (Slide In) */
    body.sidebar-open .sidebar-container {
        transform: translateX(0);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.15);
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 9999998; /* Under sidebar but over header */
        opacity: 0;
        transition: opacity var(--transition-speed);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }

    /* Prevent Scrolling of body when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }

    /* Close Button */
    .close-sidebar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: #e2f0fb;
        border-radius: 50%;
        border: none;
        font-size: 1.5rem;
        color: #0047AB;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .close-sidebar-btn:hover {
        background: #82C8E5;
        color: #000080;
        transform: rotate(90deg);
    }

    /* Push content down depending on header */
    .main-content {
        margin-left: 0 !important;
        padding-top: 80px !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Fix mobile card overflow */
    .els-main-grid {
        grid-template-columns: 1fr !important;
    }
    .els-table {
        min-width: unset !important;
        font-size: 0.8rem;
    }
    .els-stats-row {
        grid-template-columns: 1fr 1fr !important;
    }
    .els-card-body[style*="flex"] {
        flex-wrap: wrap !important;
    }
}

/* =========================================
   7. EXTRA ENHANCEMENTS
   ========================================= */

/* Subtle animation on sidebar load */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Ensure menu items are always visible */
.sidebar-menu .menu-item {
    animation: slideIn 0.3s ease forwards;
    opacity: 1;
    /* Always visible, animation is just for effect */
}

/* Animation delays for staggered effect only */
@media (prefers-reduced-motion: no-preference) {
    .sidebar-menu .menu-item {
        opacity: 0;
        animation: slideIn 0.3s ease forwards;
    }

    .sidebar-menu .menu-item:nth-child(1) { animation-delay: 0.05s; }
    .sidebar-menu .menu-item:nth-child(2) { animation-delay: 0.1s; }
    .sidebar-menu .menu-item:nth-child(3) { animation-delay: 0.15s; }
    .sidebar-menu .menu-item:nth-child(4) { animation-delay: 0.2s; }
    .sidebar-menu .menu-item:nth-child(5) { animation-delay: 0.25s; }
    .sidebar-menu .menu-item:nth-child(6) { animation-delay: 0.3s; }
    .sidebar-menu .menu-item:nth-child(7) { animation-delay: 0.35s; }
    .sidebar-menu .menu-item:nth-child(8) { animation-delay: 0.4s; }
    .sidebar-menu .menu-item:nth-child(9) { animation-delay: 0.45s; }
    .sidebar-menu .menu-item:nth-child(10) { animation-delay: 0.5s; }
}