/* ── HoreX Modal — Global Bottom Sheet + Desktop Dialog ──────────── */

/* Backdrop for desktop mode */
.horex-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.horex-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Desktop centered dialog */
@media (min-width: 769px) {
    .horex-modal {
        display: none;
    }
    .horex-modal.is-open {
        display: block;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 9995;
        background: #fff;
        border-radius: 16px;
        max-width: 560px;
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 24px 48px -12px rgba(0,0,0,0.25);
        animation: horexModalIn 0.3s ease;
    }
}
@keyframes horexModalIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* ── Cupertino Pane Overrides (mobile) ───────────────────────────── */
.cupertino-pane-wrapper {
    z-index: 9998 !important;
}
.cupertino-pane-wrapper .backdrop {
    z-index: -1 !important;
}
.cupertino-pane-wrapper .pane {
    z-index: 1 !important;
    border-radius: 20px 20px 0 0 !important;
}

/* iOS rubber-band bounce on scroll edges */
.cupertino-pane-wrapper .pane .overflow-y-auto,
.cupertino-pane-wrapper .pane > div {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
}

/* Drag handle pill styling */
.cupertino-pane-wrapper .draggable .move {
    width: 48px !important;
    height: 5px !important;
    background: rgba(0,0,0,0.15) !important;
    border-radius: 3px !important;
}

/* Nested (z-stack) pane — higher z-index */
.cupertino-pane-wrapper.horex-nested-pane {
    z-index: 10000 !important;
}
.cupertino-pane-wrapper.horex-nested-pane .pane {
    border-radius: 20px 20px 0 0 !important;
}

/* Mobile: reset modal styles when inside Cupertino Pane wrapper */
@media (max-width: 768px) {
    .cupertino-pane-wrapper .horex-modal {
        position: static !important;
        width: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}
