/* ============================================
   SIDEPANE NAVIGATION
   ============================================ */

/* Sidepane Container - Base styles (apply to all screen sizes) */
.sidepane {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        #f9f7f4 0%,
        #fef9f2 50%,
        #fef8f1 100%
    );
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    z-index: 998;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    overflow-x: hidden;
    transition: transform 0.3s ease;
    box-sizing: border-box;
    padding-bottom: 0px;
}

/* Sidepane Navigation Items - Base styles */
.sidepane-nav {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.sidepane-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #262e2e;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    font-family: 'Work Sans', sans-serif;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
}

.sidepane-nav-item:hover {
    background-color: #f5f1eb;
    color: #324848;
}

.sidepane-nav-item.active {
    background-color: #f5f1eb;
    color: #324848;
    font-weight: 500;
}

.sidepane-nav-item i {
    width: 20px;
    font-size: 16px;
    color: #626262;
    flex-shrink: 0;
}

.sidepane-nav-item.active i,
.sidepane-nav-item:hover i {
    color: #324848;
}

/* Sidepane Section Divider */
.sidepane-section-divider {
    height: 1px;
    background-color: #e3dcd6;
    margin: 8px 20px;
}

/* Sidepane Section Title */
.sidepane-section-title {
    padding: 16px 20px 8px 20px;
    font-size: 12px;
    font-weight: 600;
    color: #626262;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Work Sans', sans-serif;
}

/* Sidepane FAQ Audience Toggle */
.sidepane-faq-audience-toggle {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    margin-bottom: 8px;
}

.sidepane-faq-audience-btn {
    flex: 1;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border: 2px solid #324848;
    border-radius: 20px;
    background: white;
    color: #324848;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sidepane-faq-audience-btn:hover {
    background: rgba(50, 72, 72, 0.1);
}

.sidepane-faq-audience-btn.active {
    background: #324848;
    color: white;
}

/* Sidepane FAQ Category Links */
.sidepane-faq-category-link {
    padding-left: 20px;
    padding-right: 20px;
    font-size: 14px;
    color: #262e2e;
    transition: all 0.2s ease;
}

.sidepane-faq-category-link:hover {
    background: rgba(50, 72, 72, 0.05);
    color: #324848;
}

.sidepane-faq-category-link.active {
    background: rgba(50, 72, 72, 0.1);
    color: #324848;
    font-weight: 500;
}

.sidepane-faq-category-link i {
    font-size: 10px;
    margin-right: 8px;
    opacity: 0.6;
}

/* Unified layout: Home + Explore centered, Support + Settings at bottom */
.sidepane-nav-unified {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}

.sidepane-center-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: top;
    min-height: 0;
    padding-top: 10px;
}

.sidepane-center {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidepane-bottom {
    padding: 16px 0;
    margin-top: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Support dropdown */
.sidepane-support-wrapper {
    position: relative;
}

.sidepane-support-btn {
    font-family: inherit;
}

.sidepane-support-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e3dcd6;
    overflow: hidden;
    display: none;
    z-index: 10;
    margin-bottom: 4px;
}

.sidepane-support-dropdown.open {
    display: block;
}

.sidepane-support-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #262e2e;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    font-family: 'Work Sans', sans-serif;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    text-align: left;
    width: 100%;
}

.sidepane-support-dropdown-item:hover {
    background-color: #f5f1eb;
    color: #324848;
}

.sidepane-support-dropdown-item i {
    width: 20px;
    font-size: 16px;
    color: #626262;
    flex-shrink: 0;
}

.sidepane-support-dropdown-item:hover i {
    color: #324848;
}

.sidepane-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    overflow: visible;
}

.sidepane-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sidepane-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.sidepane-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.sidepane-toggle-switch input:checked + .sidepane-toggle-slider {
    background-color: #324848;
}

.sidepane-toggle-switch input:checked + .sidepane-toggle-slider:before {
    transform: translateX(20px);
}

.sidepane-toggle-switch input:focus + .sidepane-toggle-slider {
    box-shadow: 0 0 1px #324848;
}

/* Hide overlay completely - desktop only */
.sidepane-overlay {
    display: none !important;
}

/* Desktop Layout - Sidepane always visible */
@media screen and (min-width: 1025px) {
    body.has-sidepane {
        display: block;
        margin-left: 0;
        overflow-x: hidden;
    }

    body.has-sidepane .sidepane {
        transform: translateX(0); /* Always visible by default */
    }

    /* Desktop: hide sidepane when data-default-visible="false" */
    body.has-sidepane .sidepane[data-default-visible="false"] {
        transform: translateX(-100%);
    }

    /* Override hidden default when user opens it */
    body.has-sidepane .sidepane[data-default-visible="false"].opened {
        transform: translateX(0);
    }

    /* When sidepane is closed (toggleable) */
    body.has-sidepane .sidepane.closed {
        transform: translateX(-100%);
    }

    /* Content wrapper - pushed by margin-left */
    body.has-sidepane .content-wrapper {
        margin-left: 220px;
        transition: margin-left 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
        height: 100vh;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    /* Adjust content when sidepane starts hidden */
    body.has-sidepane .sidepane[data-default-visible="false"] ~ .content-wrapper {
        margin-left: 0;
    }

    /* Adjust content when sidepane that started hidden is opened */
    body.has-sidepane .sidepane[data-default-visible="false"].opened ~ .content-wrapper {
        margin-left: 220px;
    }

    body.has-sidepane.sidepane-closed .content-wrapper {
        margin-left: 0;
    }

    /* Content wrapper scaling - containers inside scale naturally */
    body.has-sidepane .content-wrapper .main-container {
        margin-left: auto;
        margin-right: auto;
        max-width: min(1400px, 100%);
        width: 100%;
        box-sizing: border-box;
        padding-left: min(120px, 5%);
        padding-right: min(120px, 5%);
    }

    body.has-sidepane .content-wrapper .gift-list {
        margin-left: auto;
        margin-right: auto;
        max-width: min(1400px, 100%);
        width: 100%;
        box-sizing: border-box;
    }

    /* Page-specific content adjustments */
    body.has-sidepane .content-wrapper .gift-list-header-wrapper {
        max-width: min(800px, 100%);
        width: 100%;
        box-sizing: border-box;
    }

    body.has-sidepane .content-wrapper .add-product-form-card {
        max-width: min(800px, 100%);
        width: 100%;
        box-sizing: border-box;
    }

    body.has-sidepane .content-wrapper .explore-page {
        width: 100%;
        min-width: 0;
        max-width: min(1400px, 100%);
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    /* Desktop: Add padding-top to push nav below header */
    .sidepane-nav {
        padding-top: 90px; /* 80px header + 24px spacing */
    }

    /* Hide overlay completely on desktop */
    .sidepane-overlay {
        display: none !important;
    }
}

/* Mobile: Completely hide sidepane - using bottom menu instead */
@media screen and (max-width: 1024px) {
    /* Hide sidepane completely on mobile */
    .sidepane {
        display: none !important;
    }
    
    /* Hide sidepane overlay completely on mobile */
    .sidepane-overlay {
        display: none !important;
    }
    
    /* Reset desktop layout for mobile */
    body.has-sidepane {
        display: block !important;
        margin-left: 0 !important;
        overflow-x: hidden !important;
    }
    
    /* Content takes full width on mobile */
    body.has-sidepane .content-wrapper {
        margin-left: 0 !important;
        height: auto !important;
        overflow-y: visible !important;
    }
    
    /* Adjust sidepane nav padding for mobile header */
    .sidepane-nav {
        padding-top: 70px !important; /* Account for mobile header + spacing */
    }
}
