/* عارض الصور: تصميم هادئ وسحب باللمس */
.image-lightbox.image-lightbox {
    padding: 0;
    background: rgba(8, 8, 8, .97);
    touch-action: pan-y;
    flex-direction: column;
}
.image-lightbox.dragging { cursor: grabbing; }

.image-lightbox .image-lightbox-stage {
    position: static;
    width: 100%;
    height: 100dvh;
    padding: 64px 24px 72px;
    box-sizing: border-box;
}
.image-lightbox .image-lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    will-change: transform;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* الشريط العلوي: العداد والإغلاق */
.image-lightbox .image-lightbox-close {
    top: max(14px, env(safe-area-inset-top));
    right: 16px;
    left: auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    font-size: 26px;
    font-weight: 300;
    transition: background .2s;
}
.image-lightbox .image-lightbox-close:hover { background: rgba(255, 255, 255, .18); }

.image-lightbox .image-lightbox-caption {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    bottom: auto;
    left: 20px;
    right: 72px;
    min-height: 40px;
    padding: 0;
    align-items: center;
    background: none;
    border-radius: 0;
    font-size: 14px;
    letter-spacing: .2px;
    color: rgba(255, 255, 255, .92);
    pointer-events: none;
}
html[dir="rtl"] .image-lightbox .image-lightbox-caption { direction: rtl; }
.image-lightbox #imageLightboxCounter {
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
}

/* شريط التقدم بالأسفل */
.image-lightbox-progress {
    position: absolute;
    left: 50%;
    bottom: max(28px, env(safe-area-inset-bottom));
    width: min(220px, 50vw);
    height: 2px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: rgba(255, 255, 255, .15);
    overflow: hidden;
    pointer-events: none;
}
.image-lightbox-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: #c9a45c;
    transition: width .3s ease;
}
html[dir="rtl"] .image-lightbox-progress span { margin-left: auto; }

/* الأسهم: بس على اللابتوب والشاشات الكبيرة */
.image-lightbox .image-lightbox-nav {
    top: 50%;
    bottom: auto;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    font-size: 30px;
    font-weight: 300;
    transform: translateY(-50%);
    opacity: .7;
    transition: opacity .2s, background .2s;
}
.image-lightbox .image-lightbox-nav:hover { opacity: 1; background: rgba(255, 255, 255, .18); }
.image-lightbox .image-lightbox-prev { left: 20px; right: auto; }
.image-lightbox .image-lightbox-next { right: 20px; left: auto; }
html[dir="rtl"] .image-lightbox .image-lightbox-prev { right: 20px; left: auto; }
html[dir="rtl"] .image-lightbox .image-lightbox-next { left: 20px; right: auto; }

@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
    .image-lightbox .image-lightbox-stage { padding: 72px 96px 80px; }
}

/* الموبايل والتابلت (لمس): بدون أسهم، الصورة بعرض الشاشة */
@media (hover: none), (pointer: coarse), (max-width: 900px) {
    .image-lightbox .image-lightbox-nav { display: none !important; }
    .image-lightbox .image-lightbox-stage { padding: 64px 0 64px; }
    .image-lightbox .image-lightbox-stage img { border-radius: 0; }
}

/* تثبيت فوق أي ستايل قديم */
html body .image-lightbox.image-lightbox { background: #0b0b0b; }
html body .image-lightbox .image-lightbox-close { border: 0 !important; box-shadow: none !important; }
html body .image-lightbox #imageLightboxCounter { direction: ltr; unicode-bidi: isolate; }
@media (hover: none), (pointer: coarse), (max-width: 900px) {
    html body .image-lightbox .image-lightbox-stage { width: 100% !important; padding: 64px 0 !important; }
    html body .image-lightbox .image-lightbox-stage img { max-width: 100% !important; width: 100%; height: auto; max-height: 100% !important; object-fit: contain; }
}
html body .image-lightbox button:focus:not(:focus-visible) { outline: none; }
html body .image-lightbox button:focus-visible { outline: 2px solid #c9a45c; outline-offset: 2px; }

/* بدون أسهم نهائياً: التنقل بالسحب (والكيبورد على اللابتوب) */
html body .image-lightbox .image-lightbox-nav { display: none !important; }

.image-lightbox-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 22px;
    border-radius: 18px;
    background: rgba(0, 0, 0, .38);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}
.image-lightbox-hint.show { opacity: 1; }
.image-lightbox-hint .hint-hand { animation: hintSwipe 1.1s ease-in-out infinite alternate; }
.image-lightbox-hint .hint-arrows { display: flex; gap: 46px; font-size: 22px; opacity: .7; margin-top: -4px; }
.image-lightbox-hint .hint-text { font-size: 13px; opacity: .9; white-space: nowrap; }
@keyframes hintSwipe { from { transform: translateX(-22px) rotate(-8deg); } to { transform: translateX(22px) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .image-lightbox-hint .hint-hand { animation: none; } }

/* ===== نسخة الآيفون: شريط صور + سحب متصل ===== */
html body .image-lightbox.image-lightbox { background: rgba(0, 0, 0, var(--lb-bg, 1)); }
html body .image-lightbox #imageLightboxImage,
html body .image-lightbox .image-lightbox-progress { display: none !important; }

html body .image-lightbox .image-lightbox-stage {
    position: absolute !important;
    inset: 60px 0 92px 0;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    display: block;
}
.lb-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    will-change: transform;
}
.lb-viewport:active { cursor: grabbing; }
.lb-track { position: absolute; inset: 0; will-change: transform; }
.lb-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
    .lb-slide { padding: 0 72px; }
}

/* شريط الصور المصغرة */
.lb-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(18px, env(safe-area-inset-bottom));
    height: 46px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 50%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
}
.lb-strip::-webkit-scrollbar { display: none; }
.lb-thumb {
    flex: 0 0 auto;
    width: 30px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    overflow: hidden;
    background: #222;
    cursor: pointer;
    opacity: .75;
    transition: width .25s ease, margin .25s ease, opacity .25s ease;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.lb-thumb.active { width: 56px; margin: 0 6px; opacity: 1; }
html body .image-lightbox .lb-slide img { pointer-events: auto; width: auto !important; height: auto; max-width: 100% !important; max-height: 100% !important; border-radius: 0; }
html body .image-lightbox .image-lightbox-caption { top: -46px !important; bottom: auto !important; }
.lb-thumb { width: 24px; height: 36px; }
.lb-thumb.active { width: 48px; margin: 0 5px; }

/* ===== محتويات الغرفة داخل العارض =====
   الموبايل: شريط صغير فوق الصور المصغرة، بضغطة بيفتح ويعرض كل النقاط.
   اللابتوب: لوحة ثابتة على جنب الصورة، النقاط ظاهرة دائمًا.
   بدون backdrop-filter (تكلفة GPU)؛ الخلفية لون شبه معتم. */
.lb-room {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 56px);
    width: min(560px, calc(100% - 24px));
    transform: translateX(-50%);
    border: 1px solid rgba(201, 164, 92, .35);
    border-radius: 16px;
    background: rgba(18, 18, 18, .9);
    color: #fff;
    text-align: start;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.lb-room[hidden] { display: none; }
.lb-room-head {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 8px 14px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.lb-room-title {
    flex: 0 0 auto;
    color: #d8b25e;
    font-size: 15px;
    font-weight: 800;
}
.lb-room-sum {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}
.lb-room-chev {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-top: 4px;
    border-right: 2px solid rgba(255, 255, 255, .7);
    border-bottom: 2px solid rgba(255, 255, 255, .7);
    transform: rotate(-135deg);
    transition: transform .2s ease;
}
.lb-room.open .lb-room-chev { margin-top: -4px; transform: rotate(45deg); }
.lb-room.open .lb-room-sum { visibility: hidden; }
.lb-room-list {
    display: none;
    max-height: 38vh;
    margin: 0;
    padding: 0 14px 12px;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}
.lb-room.open .lb-room-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.lb-room-list li {
    position: relative;
    padding-inline-start: 14px;
    color: rgba(255, 255, 255, .92);
    font-size: 13.5px;
    line-height: 1.7;
}
.lb-room-list li::before,
.room-contents li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: .72em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c9a45c;
}
@media (max-width: 420px) {
    .lb-room.open .lb-room-list { grid-template-columns: 1fr; }
}
/* الصورة ما تنغطى بالشريط المسكّر */
html body .image-lightbox.lb-has-room .image-lightbox-stage { inset: 60px 0 148px 0 !important; }

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    .lb-room {
        top: 72px;
        bottom: auto;
        left: auto;
        right: auto;
        right: 24px;
        width: 290px;
        max-height: calc(100dvh - 72px - 96px);
        overflow-y: auto;
        transform: none;
    }
    .lb-room-head { cursor: default; padding: 14px 16px 6px; }
    .lb-room-title { font-size: 18px; }
    .lb-room-sum, .lb-room-chev { display: none; }
    .lb-room .lb-room-list,
    .lb-room.open .lb-room-list {
        display: block;
        max-height: none;
        overflow: visible;
        padding: 4px 16px 14px;
    }
    .lb-room-list li { padding-block: 3px; font-size: 14.5px; }
    /* العارض داخليًا اتجاهه ltr، فالجهة بتنحدد من html[dir]: عربي = يمين، إنجليزي = يسار */
    html[dir="ltr"] .lb-room { right: auto; left: 24px; }
    html body .image-lightbox.lb-has-room .image-lightbox-stage { inset: 60px 330px 92px 0 !important; }
    html[dir="ltr"] body .image-lightbox.lb-has-room .image-lightbox-stage { inset: 60px 0 92px 330px !important; }
}

/* ===== محتويات الغرفة في ألبوم الصور (جنب صور كل قسم) ===== */
.room-contents {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
}
.room-contents li {
    position: relative;
    padding: 5px 0;
    padding-inline-start: 16px;
    border-bottom: 1px dashed #ececec;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.7;
}
.room-contents li:last-child { border-bottom: 0; }
.room-contents li::before { top: calc(5px + .72em); }
/* الشاشات الكبيرة: القائمة جنب الصور. الموبايل والتابلت (حتى 900px، لما الألبوم
   يصير عمود واحد): اسم الغرفة، بعدها الصور، بعدها القائمة. القسم هناك flex
   column-reverse أو grid، فـ order: -1 بيخلي القائمة آخر إشي بالحالتين. */
.room-contents-after { display: none; }
@media (max-width: 900px) {
    html[dir] body .photo-tour-section .room-contents-side { display: none !important; }
    html[dir] body .photo-tour-section .room-contents-after { display: flex !important; order: -1; }
    .room-contents {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }
    .room-contents li {
        padding: 3px 10px;
        padding-inline-start: 20px;
        border: 1px solid #f1e2bd;
        border-radius: 999px;
        background: #fff8e6;
        color: #2b2412;
        font-size: 12.5px;
        line-height: 1.6;
    }
    .room-contents li::before { inset-inline-start: 8px; top: calc(3px + .62em); width: 5px; height: 5px; }
}

/* والصورة مكبّرة بإصبعين: نخفي شريط محتويات الغرفة حتى تبين الصورة كاملة */
.lb-room { transition: opacity .2s ease; }
.image-lightbox.lb-zoomed .lb-room { opacity: 0; pointer-events: none; }
.lb-slide img { transform-origin: 50% 50%; }

/* ===== الديسكتوب مع لوحة محتويات الغرفة (2026-11-21) =====
   تلميح السحب وشريط الصور المصغرة يتوسّطان مساحة الصورة لا عرض الشاشة كلها،
   وخلفية التلميح زجاج داكن واضح (كانت سوداء شفافة فلا تظهر إلا فوق الصورة فتبدو مقصوصة). */
.image-lightbox-hint {
    background: rgba(18, 18, 18, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 30px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding: 18px 28px;
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
    html body .image-lightbox.lb-has-room .image-lightbox-hint { left: calc((100% - 330px) / 2); }
    html[dir="ltr"] body .image-lightbox.lb-has-room .image-lightbox-hint { left: calc(330px + (100% - 330px) / 2); }
    /* padding بالنسبة المئوية يُحسب من عرض العارض كله، فنطرح نصف عرض اللوحة */
    html body .image-lightbox.lb-has-room .lb-strip { left: 0; right: 330px; padding: 0 calc(50% - 165px); }
    html[dir="ltr"] body .image-lightbox.lb-has-room .lb-strip { left: 330px; right: 0; }
}
