/* ===================================
   QUICK MENU
   Fixed right-edge collapsible panel
   on desktop; accordion on mobile.
   Font: Nunito (loaded via layout)
   ===================================

   STATES:
     collapsed (default) – only the teal vertical handle tab is visible
     is-open             – handle hides, white drawer panel slides in
   =================================== */

/* ---- SHARED LINK STYLES ---- */

.qm-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 16px;
    font-family: helvetica, arial, sans-serif;
    font-size: 15px;
    /* font-weight: 600; */
    color: #333;
    text-decoration: none;
    white-space: normal;
    line-height: 1.35;
    transition: background 0.22s ease,
                transform 0.25s cubic-bezier(0.34, 1.5, 0.64, 1),
                box-shadow 0.22s ease;
}

.qm-link:hover,
.qm-link:focus {
    background: #f5f5f5;
    color: #111;
    text-decoration: none;
    outline: none;
    transform: translateX(4px);
    box-shadow: inset 3px 0 0 #00BBE1;
}

/* Danger variant – e.g. Delete Reservation */
.qm-link-danger {
    color: #c0392b;
}

.qm-link-danger:hover,
.qm-link-danger:focus {
    background: #fff0f0;
    color: #922b21;
    transform: translateX(4px);
    box-shadow: inset 3px 0 0 #c0392b;
}

/* Disabled (no permission) */
.qm-link-disabled {
    cursor: not-allowed;
    pointer-events: none;
}

/* Icon inside each link */
.qm-link i {
    font-size: 14px;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}

.qm-link:hover i {
    animation: sb-icon-bounce 0.45s cubic-bezier(0.34, 1.5, 0.64, 1) both;
}

/* ---- DESKTOP: Fixed right-edge panel ---- */

.qm-panel {
    position: fixed;   /* floating handle tab when collapsed */
    top: 62px;
    right: 0;
    z-index: 1045;
    display: none;   /* flex at >= 992px */
    flex-direction: row;
    align-items: flex-start;
}

@media (min-width: 992px) {
    .qm-panel {
        display: flex;
        position: sticky;  /* in document flow (no overlap) and sticks while scrolling */
        top: 10px;
        z-index: 1045;
        align-self: flex-start;
    }

    /* Make the content row a flex container so the drawer sits beside the content
       instead of overlapping it. Only activate flex on pages that have the sidebar/quick-menu;
       auth pages (login, recover, register…) have no sidebar so display:flex is left off there. */
    body.has-sidebar #main-content {
        display: flex;
        align-items: flex-start;
        flex-wrap: nowrap;
    }

    /* Content column grows to fill remaining space; override Bootstrap col-lg-12 100% */
    body.has-sidebar #main-content > .p-content {
        flex: 1 1 auto;
        min-width: 0;
        width: auto !important;
        float: none !important;
    }

    /* Drawer wrapper: sticky flex child so it also follows scroll */
    body.has-sidebar .secondary-menu-desktop {
        flex: 0 0 auto;
        align-self: flex-start;
        position: sticky;
        top: 10px;
    }

    /* When OPEN – sticky is already set; keep for reference */
    .qm-panel.is-open {
        position: sticky;
        z-index: 1045;
    }
}

/* ---- HANDLE: teal vertical tab (visible when collapsed, hides when open) ---- */

@keyframes qm-handle-pulse {
    0%, 100% { box-shadow: -2px 0 8px rgba(var(--brand-shadow-rgb), 0.25); }
    50%       { box-shadow: -5px 0 18px rgba(var(--brand-shadow-rgb), 0.55); }
}

@keyframes qm-link-in {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

.qm-handle {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    /* background: #006768; */
    background: var(--brand-handle-bg);
    color: #fff;
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 700;
    padding: 24px 13px;
    border: none;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    letter-spacing: 0.06em;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
    /* Smooth collapse – spring effect */
    box-sizing: border-box;
    width: 50px;
    overflow: hidden;
    opacity: 1;
    pointer-events: auto;
    animation: qm-handle-pulse 2.8s ease-in-out infinite;
    transition: background 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.25s ease,
                width 0.45s cubic-bezier(0.34, 1.4, 0.64, 1),
                opacity 0.3s ease;
}

.qm-handle:hover {
    background: var(--brand-hover);
    transform: translateX(-4px);
    box-shadow: -4px 0 16px rgba(var(--brand-shadow-rgb), 0.55);
    animation: none;
}

/* Handle collapses and fades out when the drawer is open */
.qm-panel.is-open .qm-handle {
    width: 0;
    opacity: 0;
    pointer-events: none;
    animation: none;
}

.qm-handle-chevron {
    font-size: 15px;
    margin-top: 10px;
    display: inline-block;
    transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}

.qm-handle:hover .qm-handle-chevron {
    transform: translateX(-4px);
}

/* ---- DRAWER: white panel, slides in from right ---- */

.qm-drawer {
    width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 6px 0 0 6px;
    opacity: 0;
    transform: translateX(24px);
    transition: width 0.45s cubic-bezier(0.34, 1.3, 0.64, 1),
                opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.qm-panel.is-open .qm-drawer {
    width: 230px;
    opacity: 1;
    transform: translateX(0);
    left: 15px;
}

/* Inner keeps content at fixed width so it never squishes during animation */
.qm-drawer-inner {
    width: 230px;
}

/* Drawer header row: title left, close button right */
.qm-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 10px 11px 16px;
    border-bottom: 1px solid #ebebeb;
    background: #f9f9f9
}

.qm-title {
    /* font-family: 'Nunito', sans-serif; */
    font-family: helvetica, arial, sans-sherif;
    font-size: 20px;
    font-weight: 700;
    color: #222;
    margin: 0;
}

.qm-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    padding: 3px 5px;
    line-height: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    transition: color 0.2s, background 0.2s, transform 0.3s cubic-bezier(0.34, 1.6, 0.64, 1);
}

.qm-close-btn:hover {
    color: #333;
    background: #f0f0f0;
    transform: rotate(180deg);
}

/* Scrollable link area */
.qm-content {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    padding-bottom: 8px;
}

/* ---- MOBILE: Accordion ---- */

/* ---- MOBILE PANEL: same drawer+handle design as desktop ---- */

.qm-panel-mobile {
    position: fixed;
    top: 115px;
    right: 0;
    z-index: 1045;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

@media (min-width: 992px) {
    .qm-panel-mobile {
        display: none; /* desktop uses .qm-panel instead */
    }
}

/* Drawer open state for mobile panel */
.qm-panel-mobile.is-open .qm-drawer {
    width: 260px;
    opacity: 1;
    transform: translateX(0);
    left: 18px;
}

.qm-panel-mobile .qm-drawer-inner {
    width: 260px;
}

/* Handle collapse for mobile panel */
.qm-panel-mobile.is-open .qm-handle {
    width: 0;
    opacity: 0;
    pointer-events: none;
    animation: none;
}

/* Links stagger fade-in when drawer opens */
.qm-panel.is-open .qm-link,
.qm-panel-mobile.is-open .qm-link {
    animation: qm-link-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ---- BACKDROP (mobile only) ---- */

.qm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1044; /* one below the panel (1045) */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.qm-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ---- UPGRADE TOOLTIP (disabled quick-menu links) ---- */

.qm-link-wrap {
    display: block;
}

.qm-link-wrap--disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#qm-upgrade-tip {
    position: fixed;
    background-color: rgba(60, 60, 60, 0.95);
    color: #fff;
    font-family: helvetica, arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    width: 190px;
    padding: 7px 12px;
    border-radius: 6px;
    z-index: 9999;
    pointer-events: auto;
    cursor: pointer;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

#qm-upgrade-tip.is-visible {
    opacity: 1;
}

#qm-upgrade-tip:hover {
    background-color: rgba(30, 30, 30, 0.98);
    text-decoration: underline;
}

#qm-upgrade-tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(60, 60, 60, 0.95) transparent transparent transparent;
}

/* ---- RESPONSIVE VISIBILITY ---- */

@media (max-width: 991px) {
    .qm-panel {
        display: none !important;
    }

    .secondary-menu-desktop {
        display: none !important;
    }
}
