/*
 * Umrah2Go — Mobile Bottom Sheet Styles
 * FILE: assets/css/u2g-mobile-sheet.css
 *
 * Depends on: u2g-tokens.css (design tokens must load first)
 *
 * Covers:
 *  - .u2g-sheet-wrap / .u2g-sheet — base bottom sheet component
 *  - .u2g-mob-bar — persistent sticky cart bar
 *  - Cart sheet content — .u2g-sheet-cart, .u2g-sheet-item, etc.
 *  - Filter sheet content — .u2g-filter-sheet-content, .u2g-fsg, pills
 *  - .u2g-mob-filter-bar — filter trigger row on mobile
 *
 * Only renders visually on screens <= 960px.
 * Desktop gets display:none on the mobile-only elements.
 */

/* ══════════════════════════════════════════════════════════════════
   BOTTOM SHEET BASE
   ══════════════════════════════════════════════════════════════════ */

.u2g-sheet-wrap {
    position: fixed;
    inset: 0;
    z-index: 9100;          /* above drawer (10000) is not needed; cart bar is 9099 */
    pointer-events: none;
    visibility: hidden;
}

.u2g-sheet-wrap.is-open {
    pointer-events: auto;
    visibility: visible;
}

/* ── Backdrop ──────────────────────────────────────────────────── */
.u2g-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 300ms ease;
}

.u2g-sheet-wrap.is-open .u2g-sheet-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

/* ── Sheet panel ───────────────────────────────────────────────── */
.u2g-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--u2g-white);
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 360ms var(--u2g-ease);
    will-change: transform;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
}

.u2g-sheet-wrap.is-open .u2g-sheet {
    transform: translateY(0);
}

/* ── Drag handle ───────────────────────────────────────────────── */
.u2g-sheet-handle-wrap {
    padding: 12px 0 6px;
    display: flex;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    flex-shrink: 0;
}

.u2g-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--u2g-lighter);
}

/* ── Sheet header ──────────────────────────────────────────────── */
.u2g-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 14px;
    border-bottom: 1px solid var(--u2g-border);
    flex-shrink: 0;
}

.u2g-sheet-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--u2g-dark);
    font-family: var(--u2g-font);
}

.u2g-sheet-close {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: none;
    background: var(--u2g-bg-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--u2g-mid);
    transition: background var(--u2g-transition);
    flex-shrink: 0;
    padding: 0;
}

.u2g-sheet-close:hover,
.u2g-sheet-close:focus-visible {
    background: var(--u2g-border);
    outline: none;
}

/* ── Sheet body (scrollable) ───────────────────────────────────── */
.u2g-sheet-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px 20px 32px;
}

/* Prevent body scroll when a sheet is open */
body.u2g-sheet-open {
    overflow: hidden;
    touch-action: none;
}

/* ══════════════════════════════════════════════════════════════════
   CART BOTTOM BAR
   ══════════════════════════════════════════════════════════════════ */

.u2g-mob-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9099;
    background: var(--u2g-dark);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.28);

    /* Slide in from bottom */
    transform: translateY(100%);
    transition: transform 320ms var(--u2g-ease);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.u2g-mob-bar.is-visible {
    transform: translateY(0);
}

/* Only show on mobile */
@media (min-width: 961px) {
    .u2g-mob-bar { display: none !important; }
}

.u2g-mob-bar-info {
    flex: 1;
    min-width: 0;
}

.u2g-mob-bar-items {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 2px;
    font-family: var(--u2g-font);
}

.u2g-mob-bar-total {
    font-size: 22px;
    font-weight: 800;
    color: var(--u2g-green);
    line-height: 1;
    font-family: var(--u2g-font);
}

.u2g-mob-bar-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--u2g-green);
    color: var(--u2g-white);
    padding: 10px 16px;
    border-radius: var(--u2g-radius-md);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    font-family: var(--u2g-font);
    pointer-events: none; /* parent handles click */
}

/* ══════════════════════════════════════════════════════════════════
   CART SHEET CONTENT
   ══════════════════════════════════════════════════════════════════ */

.u2g-sheet-cart {
    display: flex;
    flex-direction: column;
}

.u2g-sheet-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--u2g-border);
}

.u2g-sheet-item:last-of-type {
    border-bottom: none;
}

.u2g-sheet-item-icon {
    width: 38px;
    height: 38px;
    background: var(--u2g-green-bg);
    border-radius: var(--u2g-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--u2g-green);
}

.u2g-sheet-item-body {
    flex: 1;
    min-width: 0;
}

.u2g-sheet-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--u2g-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.u2g-sheet-item-sub {
    font-size: 12px;
    color: var(--u2g-muted);
    margin-bottom: 1px;
}

.u2g-sheet-item-date {
    font-size: 11px;
    color: var(--u2g-light);
}

.u2g-sheet-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--u2g-dark);
    flex-shrink: 0;
    white-space: nowrap;
    padding-top: 2px;
}

.u2g-sheet-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 4px;
    border-top: 2px solid var(--u2g-border);
    margin-top: 4px;
    font-size: 13px;
    color: var(--u2g-muted);
    font-family: var(--u2g-font);
}

.u2g-sheet-total strong {
    font-size: 22px;
    font-weight: 800;
    color: var(--u2g-dark);
}

.u2g-mob-checkout-btn {
    width: 100%;
    margin-top: 16px;
    padding: 15px;
    background: var(--u2g-green);
    color: var(--u2g-white);
    border: none;
    border-radius: var(--u2g-radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--u2g-font);
    transition: background var(--u2g-transition);
    text-align: center;
    letter-spacing: 0.01em;
}

.u2g-mob-checkout-btn:hover,
.u2g-mob-checkout-btn:active {
    background: var(--u2g-green-dark);
}

.u2g-sheet-empty {
    text-align: center;
    padding: 28px 0;
    color: var(--u2g-muted);
    font-size: 14px;
    font-family: var(--u2g-font);
}

/* ══════════════════════════════════════════════════════════════════
   FILTER TRIGGER BAR (mobile)
   ══════════════════════════════════════════════════════════════════ */

/* Hidden on desktop */
.u2g-mob-filter-bar {
    display: none;
}

@media (max-width: 960px) {
    /* Show trigger bar on mobile */
    .u2g-mob-filter-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 14px;
    }

    /* Hide original filter row on mobile — replaced by sheet */
    .u2g-filters-desktop-only {
        display: none !important;
    }
}

.u2g-mob-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border: 1.5px solid var(--u2g-border);
    border-radius: var(--u2g-radius-md);
    background: var(--u2g-white);
    font-size: 13px;
    font-weight: 600;
    color: var(--u2g-dark);
    cursor: pointer;
    font-family: var(--u2g-font);
    transition: border-color var(--u2g-transition), background var(--u2g-transition);
}

.u2g-mob-filter-btn:hover,
.u2g-mob-filter-btn.has-filters {
    border-color: var(--u2g-green);
    color: var(--u2g-green);
    background: var(--u2g-green-bg);
}

.u2g-mob-filter-badge {
    background: var(--u2g-green);
    color: var(--u2g-white);
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.u2g-mob-results-mirror {
    font-size: 12px;
    color: var(--u2g-muted);
    margin-left: auto;
}

/* ══════════════════════════════════════════════════════════════════
   FILTER SHEET CONTENT
   ══════════════════════════════════════════════════════════════════ */

.u2g-filter-sheet-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.u2g-fsg {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.u2g-fsg-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--u2g-muted);
}

.u2g-fsg-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.u2g-fs-pill {
    padding: 9px 16px;
    border: 1.5px solid var(--u2g-border);
    border-radius: var(--u2g-radius-pill);
    background: var(--u2g-white);
    font-size: 13px;
    font-weight: 500;
    color: var(--u2g-dark);
    cursor: pointer;
    font-family: var(--u2g-font);
    transition: all var(--u2g-transition);
    line-height: 1;
}

.u2g-fs-pill:hover {
    border-color: var(--u2g-green);
    color: var(--u2g-green);
}

.u2g-fs-pill.is-active {
    border-color: var(--u2g-green);
    background: var(--u2g-green-bg);
    color: var(--u2g-green);
    font-weight: 700;
}

.u2g-fsg-actions {
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--u2g-border);
    margin-top: 4px;
}

.u2g-fsg-clear {
    flex: 1;
    padding: 13px;
    border: 1.5px solid var(--u2g-border);
    border-radius: var(--u2g-radius-md);
    background: var(--u2g-white);
    font-size: 14px;
    font-weight: 600;
    color: var(--u2g-mid);
    cursor: pointer;
    font-family: var(--u2g-font);
    transition: border-color var(--u2g-transition);
}

.u2g-fsg-clear:hover {
    border-color: var(--u2g-mid);
}

.u2g-fsg-apply {
    flex: 2;
    padding: 13px;
    background: var(--u2g-green);
    color: var(--u2g-white);
    border: none;
    border-radius: var(--u2g-radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--u2g-font);
    transition: background var(--u2g-transition);
}

.u2g-fsg-apply:hover {
    background: var(--u2g-green-dark);
}

/* ══════════════════════════════════════════════════════════════════
   REMOVE BUTTON (inside cart sheet items)
   ══════════════════════════════════════════════════════════════════ */

.u2g-sheet-item-remove {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border: none;
    background: var(--u2g-bg-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--u2g-muted);
    font-size: 20px;
    line-height: 1;
    font-family: inherit;
    flex-shrink: 0;
    transition: background var(--u2g-transition), color var(--u2g-transition);
    -webkit-tap-highlight-color: transparent;
    align-self: center;
    padding: 0;
}

.u2g-sheet-item-remove:hover,
.u2g-sheet-item-remove:active {
    background: var(--u2g-danger-bg);
    color: var(--u2g-danger);
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE SHEET ACTIONS (CROSS-SELLS)
   ══════════════════════════════════════════════════════════════════ */

.u2g-mob-cart-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px dashed var(--u2g-border);
}

.u2g-mob-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--u2g-bg-alt);
    color: var(--u2g-dark);
    border: 1px solid var(--u2g-border);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--u2g-font);
    cursor: pointer;
    transition: background 150ms ease;
    -webkit-tap-highlight-color: transparent;
}
.u2g-mob-action-btn svg {
    color: var(--u2g-green);
    flex-shrink: 0;
}
.u2g-mob-action-btn:hover,
.u2g-mob-action-btn:active {
    background: var(--u2g-border);
}

/* ══════════════════════════════════════════════════════════════════
   RTL SUPPORT
   ══════════════════════════════════════════════════════════════════ */

[dir="rtl"] .u2g-mob-bar-cta svg {
    transform: scaleX(-1);
}

[dir="rtl"] .u2g-sheet-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .u2g-sheet-item {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .u2g-mob-filter-bar {
    flex-direction: row-reverse;
}

[dir="rtl"] .u2g-fsg-label,
[dir="rtl"] .u2g-sheet-item-title,
[dir="rtl"] .u2g-sheet-item-sub,
[dir="rtl"] .u2g-sheet-item-date {
    text-align: right;
    direction: rtl;
}
