/* =========================================================
   CURVED ANIMATED SIDEBAR (LEFT-SIDE COMPACT REFINED LAYOUT)
   ========================================================= */

/* Toggle Button (Fixed at Top Left - Frosted Glass) */
.curved-sidebar-toggle-btn {
    position: fixed;
    top: 12px;
    left: 14px;
    right: auto;
    z-index: 99999;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.76, 0, 0.24, 1), box-shadow 0.3s ease, background-color 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.curved-sidebar-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.95);
}

.curved-sidebar-toggle-btn:active {
    transform: scale(0.95);
}

/* 3-Bar Hamburger Morph */
.curved-sidebar-burger {
    position: relative;
    width: 15px;
    height: 11px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.curved-sidebar-burger span {
    display: block;
    height: 1.8px;
    width: 100%;
    background: #0f172a;
    border-radius: 2px;
    transition: transform 0.35s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.2s ease;
}

.curved-sidebar-toggle-btn.is-active .curved-sidebar-burger span:nth-child(1) {
    transform: translateY(4.5px) rotate(45deg);
}

.curved-sidebar-toggle-btn.is-active .curved-sidebar-burger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.curved-sidebar-toggle-btn.is-active .curved-sidebar-burger span:nth-child(3) {
    transform: translateY(-4.5px) rotate(-45deg);
}

/* Backdrop Overlay (Active on Mobile / Semi-overlay on Desktop) */
.curved-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.76, 0, 0.24, 1);
}

.curved-sidebar-backdrop.is-active {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1024px) {
    /* On desktop, keep page interactive without blocking screen when sidebar is open */
    .curved-sidebar-backdrop.is-active {
        opacity: 0;
        pointer-events: none;
    }
}

/* Body scroll lock when sidebar is active on mobile */
body.curved-sidebar-open {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Sidebar Menu Drawer (Left Side - Premium Frosted Glass Layout) */
.curved-sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    height: 100vh;
    height: 100dvh;
    width: 270px;
    max-width: 85vw;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
    border-right: 1.5px solid rgba(255, 255, 255, 0.85) !important;
    border-radius: 0 20px 20px 0 !important;
    z-index: 99995;
    transform: translateX(calc(-100% - 90px));
    transition: transform 0.75s cubic-bezier(0.76, 0, 0.24, 1);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 20px 45px rgba(15, 23, 42, 0.08), 8px 0 25px rgba(0, 0, 0, 0.04) !important;
    display: flex;
    flex-direction: column;
    overflow: visible;
    overscroll-behavior: contain;
}

.curved-sidebar-panel.is-active {
    transform: translateX(0);
}

/* Curved Morphing SVG on Right Edge (Clean transition without smudge artifact) */
.curved-sidebar-svg {
    position: absolute;
    top: 0;
    right: -69px;
    left: auto;
    width: 70px;
    height: 100%;
    stroke: none;
    fill: rgba(255, 255, 255, 0.85);
    opacity: 0;
    pointer-events: none;
    overflow: visible;
    transition: opacity 0.2s ease;
}

/* Sidebar Inner Scroll Container (Fix flexbox scroll clipping) */
.curved-sidebar-inner {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 58px 14px 18px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    z-index: 10;
    -ms-overflow-style: none;
    scrollbar-width: none;
    box-sizing: border-box;
}

.curved-sidebar-inner::-webkit-scrollbar {
    display: none;
}

/* Navigation Header */
.curved-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding-bottom: 6px;
    margin-bottom: 8px;
    margin-top: 2px;
}

.curved-sidebar-header p {
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

.curved-sidebar-close-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    color: #64748b;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.curved-sidebar-close-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: rotate(90deg) scale(1.05);
}

/* Nav Link Items */
.curved-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.curved-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: none;
    padding: 5px 8px;
    border-radius: 10px;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    transition: all 0.25s ease;
}

.curved-nav-item:hover {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.curved-nav-content {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* 3D Glossy Claymorphic Icon Styling */
.curved-nav-3d-wrap {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.08));
}

.curved-nav-3d-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.curved-nav-item:hover .curved-nav-3d-wrap {
    transform: translateY(-2px) scale(1.15) rotate(3deg);
    filter: drop-shadow(0 4px 10px rgba(234, 88, 12, 0.2));
}

.curved-nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(241, 245, 249, 0.7);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.35s cubic-bezier(0.76, 0, 0.24, 1);
}

.curved-nav-item:hover .curved-nav-icon {
    background: #fff7ed;
    color: #ea580c;
    border-color: #fed7aa;
    transform: translateX(2px) scale(1.06);
    box-shadow: 0 3px 8px rgba(234, 88, 12, 0.12);
}

.curved-nav-index {
    font-size: 0.85rem;
    font-weight: 300;
    color: #cbd5e1;
    transition: color 0.35s cubic-bezier(0.76, 0, 0.24, 1), transform 0.35s cubic-bezier(0.76, 0, 0.24, 1);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.curved-nav-item:hover .curved-nav-index {
    color: #ea580c;
    transform: translateX(2px);
}

.curved-nav-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

/* Kinetic Staggered Letter Wave (Clean Title Case) */
.curved-nav-heading {
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.curved-nav-item:hover .curved-nav-heading {
    transform: translateX(2px);
    color: #ea580c;
}

.curved-nav-word {
    display: inline-flex;
    margin-right: 0.25em;
    white-space: nowrap;
}

.curved-nav-letter {
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease;
}

.curved-nav-item:hover .curved-nav-letter {
    transform: translateX(1px);
    color: #ea580c;
}

/* Subheading hint (if present) */
.curved-nav-subheading {
    font-size: 0.66rem;
    font-weight: 500;
    text-transform: none;
    color: #94a3b8;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer Section */
.curved-sidebar-footer {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(241, 245, 249, 0.9);
    flex-shrink: 0;
}

.curved-sidebar-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: -0.01em;
}

.curved-sidebar-footer-version {
    font-size: 0.58rem;
    font-weight: 800;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    letter-spacing: 0.05em;
}

/* Mobile only nav items in sidebar (hidden on desktop screens >= 768px, matching Tailwind md breakpoint) */
@media (min-width: 768px) {
    .curved-nav-mobile-only {
        display: none !important;
    }
}
@media (max-width: 767.98px) {
    .curved-nav-category.has-divider-mobile {
        border-top: 1px solid rgba(245, 158, 11, 0.2);
        margin-top: 8px;
        padding-top: 10px;
    }
}

/* =========================================================
   PAGE CONTENT SHIFT & RESPONSIVE LAYOUT ADJUSTMENT
   ========================================================= */
.page-wrapper-for-sidebar,
.curved-page-container {
    width: 100%;
    min-width: 0;
    transition: margin-left 0.75s cubic-bezier(0.76, 0, 0.24, 1), width 0.75s cubic-bezier(0.76, 0, 0.24, 1);
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    /* Default desktop behavior: sidebar is OPEN by default and content is shifted right */
    .curved-sidebar-panel {
        transform: translateX(0);
    }
    
    .page-wrapper-for-sidebar,
    .curved-page-container {
        margin-left: 270px;
        width: calc(100% - 270px);
    }

    /* When sidebar is explicitly collapsed by user on desktop */
    body.curved-sidebar-desktop-collapsed .curved-sidebar-panel {
        transform: translateX(calc(-100% - 90px)) !important;
    }

    body.curved-sidebar-desktop-collapsed .page-wrapper-for-sidebar,
    body.curved-sidebar-desktop-collapsed .curved-page-container {
        margin-left: 0;
        width: 100%;
    }

    /* Header title smooth glide when collapsed vs open */
    .page-wrapper-for-sidebar header .header-title-shift,
    .curved-page-container header .header-title-shift {
        padding-left: 0;
        transition: padding-left 0.75s cubic-bezier(0.76, 0, 0.24, 1);
    }

    body.curved-sidebar-desktop-collapsed .page-wrapper-for-sidebar header .header-title-shift,
    body.curved-sidebar-desktop-collapsed .curved-page-container header .header-title-shift {
        padding-left: 3.25rem;
    }
}

@media (max-width: 1023.98px) {
    .page-wrapper-for-sidebar,
    .curved-page-container {
        margin-left: 0 !important;
        width: 100% !important;
    }
}
