::selection {
    background-color: rgba(182, 255, 0, 0.22);
    color: #242834;
}

/* ── Typography helpers ─────────────────────────── */
.font-display {
    font-family: "Inter", "Kantumruy Pro", sans-serif;
}

/* ── Glassmorphism ──────────────────────────────── */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(36, 40, 52, 0.10);
    box-shadow: 0 1px 3px rgba(36, 40, 52, 0.04), 0 8px 24px rgba(36, 40, 52, 0.04);
}

/* ── Gradient text ──────────────────────────────── */
.text-gradient-brand {
    background: linear-gradient(135deg, #B6FF00 0%, #CDFF4D 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-slate {
    background: linear-gradient(135deg, #242834 0%, #434653 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Button utilities ── SkillDrive ─────────────── */
.btn-primary {
    background: #B6FF00;
    color: #242834;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(182, 255, 0, 0.25);
    transition: all 0.25s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(182, 255, 0, 0.35), 0 4px 12px rgba(182, 255, 0, 0.20);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: #7D53FF;
    border: 2px solid #7D53FF;
    font-weight: 700;
    border-radius: 8px;
    box-shadow: none;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: rgba(125, 83, 255, 0.06);
    box-shadow: 0 0 16px rgba(125, 83, 255, 0.15);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #242834;
    color: #FFFFFF;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background: #2e3342;
    transform: translateY(-1px);
}

/* ── Card ───────────────────────────────────────── */
.card-tech {
    background: #fff;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-tech:hover {
    box-shadow: 0 8px 24px rgba(36, 40, 52, 0.08), 0 4px 8px rgba(36, 40, 52, 0.04);
    transform: translateY(-2px);
}

/* ── Dot grid overlay ───────────────────────────── */
.dot-grid {
    background-image: radial-gradient(circle, rgba(36, 40, 52, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
}

/* ── Sidebar (always show labels) ───────────────────── */
#sidebar {
    width: 260px;
    transition: transform 0.3s ease;
    overflow-x: hidden;
    z-index: 60;
}

/* Mobile: slide-out drawer */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #sidebarOverlay {
        display: block;
    }
}

.sidebar-label {
    display: inline;
    white-space: nowrap;
}

.nav-item {
    justify-content: flex-start !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.nav-item .gap-3 {
    gap: 12px;
}

#sidebarToggleBtn {
    display: none;
}

.main-content-margin {
    margin-left: 260px;
    transition: margin-left 0.3s ease;
}

@media (max-width: 768px) {

    .main-content-margin,
    .footer-margin {
        margin-left: 0 !important;
    }
}

/* Mobile overlay */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 55;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebarOverlay.show {
    display: block;
    opacity: 1;
}

/* ── Neon badge ─────────────────────────────────── */
.badge-brand {
    background: rgba(182, 255, 0, 0.12);
    border: 1px solid rgba(182, 255, 0, 0.30);
    color: #242834;
    border-radius: 999px;
}

/* Welcome popup animation */
@keyframes popup-fade-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Line clamp utilities ───────────────────────── */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Layout Docked Mode (Option 1: The Silent Icon Dock) ── */
@media (min-width: 769px) {
    /* 1. Collapse the sidebar default width to 68px */
    .layout-docked #sidebar {
        width: 68px;
        transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease-out;
        box-shadow: 1px 0 5px rgba(0, 0, 0, 0.02);
        overflow-x: hidden;
    }

    /* 2. On Hover, expand sidebar to 260px and elevate with premium shadow overlay */
    .layout-docked #sidebar:hover {
        width: 260px;
        box-shadow: 8px 0 32px rgba(36, 40, 52, 0.08);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    /* 3. Adjust content margins to match the 68px dock without layout shifting on expansion */
    .layout-docked .main-content-margin,
    .layout-docked header div.md\:ml-64 {
        margin-left: 68px;
        transition: margin-left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    /* 4. Hide brand name label and collapse its space when collapsed */
    .layout-docked #sidebar:not(:hover) .font-display {
        max-width: 0;
        opacity: 0;
        overflow: hidden;
        white-space: nowrap;
        display: inline-block;
        pointer-events: none;
    }

    .layout-docked #sidebar .font-display {
        display: inline-block;
        max-width: 180px;
        opacity: 1;
        transition: max-width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease-out;
    }

    /* Center the logo icon and remove flex gap in the header when collapsed */
    .layout-docked #sidebar:not(:hover) a.group {
        justify-content: center;
        width: 100%;
        gap: 0;
        padding-left: 0;
    }

    .layout-docked #sidebar:hover a.group {
        justify-content: flex-start;
        gap: 10px;
    }

    /* 5. Hide navigation item text labels, category headers, and buttons when collapsed */
    .layout-docked #sidebar:not(:hover) .sidebar-label {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .layout-docked #sidebar .sidebar-label {
        transition: opacity 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    /* 6. Center the nav-item icons and adjust padding when collapsed */
    .layout-docked #sidebar:not(:hover) .nav-item {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        margin-left: auto;
        margin-right: auto;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .layout-docked #sidebar:hover .nav-item {
        width: 100%;
        justify-content: flex-start;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Adjust active state indicator to be clean and focused */
    .layout-docked #sidebar:not(:hover) .nav-item.bg-brand {
        background-color: #B6FF00;
        color: #242834;
    }

    /* 7. Hide category dividers/spacing cleanly when collapsed */
    .layout-docked #sidebar:not(:hover) nav div.h-px.bg-slate-100 {
        margin-left: 12px;
        margin-right: 12px;
    }

    /* 8. Align logout and profile buttons at the bottom */
    .layout-docked #sidebar:not(:hover) .border-t.border-slate-100 {
        padding: 12px 4px;
    }

    .layout-docked #sidebar:not(:hover) .border-t.border-slate-100 a {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        width: 44px;
        height: 44px;
        margin-left: auto;
        margin-right: auto;
        border-radius: 12px;
    }
}

/* ── Mobile Native Styles ───────────────────────── */
@media (max-width: 768px) {
    /* Safe Area padding offset for persistent bottom nav bar */
    .pb-safe-nav {
        padding-bottom: 96px !important;
    }
    
    /* Hide scrollbars for horizontal carousels */
    .carousel-container {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        gap: 16px !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    .carousel-container::-webkit-scrollbar {
        display: none; /* Safari and Chrome */
    }
    
    /* Scroll snap child elements */
    .carousel-container .carousel-item {
        scroll-snap-align: start;
        flex-shrink: 0;
        width: 80% !important; /* Allow the next card to peek */
    }

    /* M3 Active icon capsule highlight */
    .m3-nav-capsule {
        transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 9999px;
        padding: 4px 16px;
    }
    
    .active-tab .m3-nav-capsule {
        background-color: rgba(125, 83, 255, 0.12) !important;
        color: #7D53FF !important;
    }
    
    .active-tab span {
        color: #7D53FF !important;
        font-variation-settings: 'FILL' 1;
    }

    /* M3 Card styles */
    .m3-card-elevated {
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0px 4px 12px rgba(36, 40, 52, 0.03), 0px 1px 3px rgba(36, 40, 52, 0.01);
        border: 1px solid rgba(226, 232, 240, 0.8);
    }
    
    .m3-card-outlined {
        background: #ffffff;
        border-radius: 16px;
        border: 1.5px solid #e2e8f0;
    }
    
    .m3-card-filled {
        background: #f8fafc;
        border-radius: 16px;
        border: none;
    }

    /* Book cover mock-up (Library App style) */
    .book-cover-mock {
        width: 100px;
        height: 135px;
        border-radius: 4px 12px 12px 4px;
        box-shadow: 3px 5px 12px rgba(36, 40, 52, 0.15);
        position: relative;
        overflow: hidden;
        flex-shrink: 0;
    }
    
    .book-cover-spine {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 6px;
        background: rgba(0, 0, 0, 0.18);
        box-shadow: 1px 0 3px rgba(0, 0, 0, 0.15) inset;
        z-index: 2;
    }
    
    .book-cover-shading {
        position: absolute;
        inset: 0;
        background: linear-gradient(to right, rgba(255,255,255,0.12) 0%, rgba(0,0,0,0.06) 5%, rgba(255,255,255,0.08) 10%, transparent 20%, rgba(0,0,0,0.15) 95%, rgba(0,0,0,0.25) 100%);
        pointer-events: none;
        z-index: 3;
    }

    /* M3 Swipable Promo Banner */
    .carousel-container .m3-promo-banner {
        width: 82% !important;
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .m3-promo-banner {
        height: 130px;
        border-radius: 16px;
        overflow: hidden;
        position: relative;
        color: white;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 16px;
        width: 100%;
    }

    /* Scrollbar-none helper */
    .scrollbar-none::-webkit-scrollbar {
        display: none !important;
    }
    .scrollbar-none {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
}

