/*
 * Client Portal desktop hover sidebar
 * -----------------------------------
 * - Compact sidebar by default.
 * - Icon with menu title underneath while compact.
 * - Expands to the original 20% width on hover/focus.
 * - Uses the SAME full Apointely logo in both states.
 * - Page content/header use the released space while compact.
 * - Mobile behavior (<= 990px) stays unchanged.
 */

@media screen and (min-width: 991px) {
    :root {
        --client-sidebar-collapsed-width: 100px;
        --client-sidebar-expanded-width: 20vw;
    }

    /* Sidebar shell */
    .desktop-hover-sidebar {
        width: var(--client-sidebar-collapsed-width) !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
        z-index: 1200;
        box-shadow: none;
        padding-bottom: 12px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
        transition: width 0.28s ease, box-shadow 0.28s ease;
    }

    .desktop-hover-sidebar:hover,
    .desktop-hover-sidebar:focus-within {
        width: var(--client-sidebar-expanded-width) !important;
        box-shadow: 0 0 18px rgba(0, 0, 0, 0.18);
        scrollbar-color: rgba(255, 255, 255, 0.45) transparent;
    }

    .desktop-hover-sidebar::-webkit-scrollbar {
        width: 5px;
    }

    .desktop-hover-sidebar:hover::-webkit-scrollbar,
    .desktop-hover-sidebar:focus-within::-webkit-scrollbar {
        width: 6px;
    }

    .desktop-hover-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .desktop-hover-sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.38);
        border-radius: 10px;
    }

    .desktop-hover-sidebar:hover::-webkit-scrollbar-thumb,
    .desktop-hover-sidebar:focus-within::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.45);
    }

    /* Same complete Apointely logo in compact and expanded states. */
    .desktop-hover-sidebar .logo {
        min-height: 75px;
        padding: 8px 12px 16px !important;
        overflow: hidden;
    }

    .desktop-hover-sidebar .sidebar-logo-link {
        width: 100%;
        min-width: 0;
    }

    .desktop-hover-sidebar .sidebar-logo-full {
        display: block;
        width: 163px;
        max-width: 100%;
        height: auto;
        object-fit: contain;
        transition: width 0.28s ease;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) .logo {
        min-height: 70px;
        padding: 8px 4px 12px !important;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) .sidebar-logo-full {
        width: 92px;
        max-width: 100%;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) > .dashed-custom {
        margin-inline: 14px !important;
        margin-block: 4px 6px !important;
    }

    /* Expanded state keeps the original horizontal menu layout. */
    .desktop-hover-sidebar:hover > .link-sidebar,
    .desktop-hover-sidebar:focus-within > .link-sidebar {
        flex-direction: row !important;
        justify-content: flex-start !important;
        text-align: start !important;
        white-space: nowrap;
        overflow: hidden;
    }

    /* Compact state: icon above, title underneath. */
    .desktop-hover-sidebar:not(:hover):not(:focus-within) > .link-sidebar {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5px !important;
        width: calc(100% - 8px) !important;
        min-height: 78px !important;
        margin-inline: 4px !important;
        padding: 9px 4px !important;
        text-align: center !important;
        white-space: normal !important;
        overflow: hidden;
        font-size: 13px !important;
        line-height: 1.2 !important;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) .sidebar-icon-wrap {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) .sidebare-icon {
        width: 31px !important;
        height: 31px !important;
        object-fit: contain;
    }

    .desktop-hover-sidebar:not(:hover):not(:focus-within) .sidebar-link-label {
        display: -webkit-box !important;
        width: 100%;
        max-width: 94px;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
        flex: 0 0 auto;
    }

    /* Header uses the extra space released by the compact sidebar. */
    .header {
        width: calc(100% - var(--client-sidebar-collapsed-width)) !important;
    }

    /* Only resize the ROOT page sections rendered directly by _Layout. */
    body > .myAccount,
    body > .changePassword,
    body > .delete-account,
    body > .upcomingCompleted-section,
    body > .orderViewDetails-section,
    body > .my-favorite-section,
    body > .address,
    body > .wallet-section {
        inset-inline-start: var(--client-sidebar-collapsed-width) !important;
        width: calc(100% - var(--client-sidebar-collapsed-width)) !important;
    }
}
