/* ═══════════════════════════════════════════════════════════════════════════
   fs-mobile.css — Mobile UX styles
   ─────────────────────────────────────────────────────────────────────────
   يُحمّل مع fs-mobile.js
   أنماط لـ: Swipe actions · Pull-refresh · Bottom sheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   1) SWIPE RAILS — reveal zones خلف الـ list item
   ═══════════════════════════════════════════════════════════════════════════ */
.fs-swipe-ready {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    will-change: transform;
}
.fs-swipe-rails {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    overflow: hidden;
}
.fs-swipe-rail {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 90px;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    letter-spacing: .3px;
    opacity: 0;
    transition: opacity .15s;
}
.fs-swipe-rail span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(0,0,0,.15);
    backdrop-filter: blur(8px);
}

/* Approve (left rail — appears when swiping right in RTL) */
.fs-swipe-rail-approve {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    order: 1;  /* يسار فى RTL */
}

/* Delete (right rail — appears when swiping left in RTL) */
.fs-swipe-rail-delete {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    order: 2;  /* يمين فى RTL */
}

/* Show rails when swipe past threshold */
.fs-swipe-ready-left  .fs-swipe-rails .fs-swipe-rail-approve { opacity: 1; }
.fs-swipe-ready-right .fs-swipe-rails .fs-swipe-rail-delete  { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   2) PULL REFRESH — indicator at top
   ═══════════════════════════════════════════════════════════════════════════ */
.fs-pull-indicator {
    position: absolute;
    top: -56px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 180px;
    height: 48px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(15,23,42,.15), 0 1px 3px rgba(15,23,42,.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .2s;
}
.fs-pull-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e5e7eb;
    border-top-color: var(--fs-primary);
    border-radius: 50%;
    transition: transform .2s;
}
.fs-pull-indicator.fs-pull-ready {
    color: var(--fs-primary);
    background: linear-gradient(135deg, var(--fs-tint-2), var(--fs-tint-3));
}
.fs-pull-indicator.fs-pull-ready .fs-pull-spinner {
    border-color: var(--fs-tint-5);
    border-top-color: var(--fs-primary);
    transform: rotate(180deg);
}
.fs-pull-indicator.fs-pull-refreshing .fs-pull-spinner {
    animation: fs-pull-spin .8s linear infinite;
    transform: none;
}
@keyframes fs-pull-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   3) BOTTOM SHEET — modal from bottom
   ═══════════════════════════════════════════════════════════════════════════ */
.fs-bsheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s cubic-bezier(.22,1,.36,1);
}
.fs-bsheet-overlay.fs-bsheet-show {
    opacity: 1;
}

.fs-bsheet {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 10px 24px 32px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
    box-shadow: 0 -8px 32px rgba(0,0,0,.25);
    will-change: transform;
}
.fs-bsheet-show .fs-bsheet {
    transform: translateY(0);
}

/* Pull handle */
.fs-bsheet-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 999px;
    margin: 0 auto 20px;
}

/* Icon */
.fs-bsheet-ico {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--fs-primary), var(--fs-primary-deep));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    margin: 0 auto 16px;
    box-shadow: 0 6px 18px rgba(var(--fs-primary-rgb),.3);
}
.fs-bsheet-ico.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 6px 18px rgba(239,68,68,.3);
}

.fs-bsheet-title {
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
}
.fs-bsheet-msg {
    text-align: center;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 24px;
}

.fs-bsheet-actions {
    display: flex;
    gap: 10px;
}
.fs-bsheet-btn {
    flex: 1;
    padding: 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font-size: 14.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
}
.fs-bsheet-btn:active {
    transform: scale(.98);
}

.fs-bsheet-cancel:active {
    background: #f1f5f9;
}

.fs-bsheet-ok {
    background: linear-gradient(135deg, var(--fs-primary), var(--fs-primary-deep));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(var(--fs-primary-rgb),.3);
}
.fs-bsheet-ok.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 3px 10px rgba(239,68,68,.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Dark mode support
   ═══════════════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    .fs-bsheet {
        background: #1a2234;
    }
    .fs-bsheet-handle { background: #475569; }
    .fs-bsheet-title { color: #f1f5f9; }
    .fs-bsheet-msg { color: #cbd5e1; }
    .fs-bsheet-btn {
        background: #1a2234;
        border-color: #334155;
        color: #cbd5e1;
    }
    .fs-bsheet-cancel:active { background: #0f172a; }
    .fs-pull-indicator {
        background: #1a2234;
        color: #cbd5e1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile only — hide pull indicator on desktop
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 992px) {
    .fs-pull-indicator { display: none !important; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fs-swipe-ready { transition: none !important; }
    .fs-bsheet, .fs-bsheet-overlay { transition: opacity .1s !important; }
    .fs-pull-spinner { animation: none !important; }
}
