/* فونت‌ها: ../font/... نسبت به این فایل */
@font-face {
    font-family: "WaveTour";
    src: url("../font/iransans/IRANSansWeb.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "WaveTour";
    src: url("../font/iransans/IRANSansWeb_Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "WaveTourDisplay";
    src: url("../font/iranyekan/IRANYekanX-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "WaveTourDisplay";
    src: url("../font/iranyekan/IRANYekanX-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* زنجیرهٔ ارتفاع برای پر شدن درست پانوراما */
html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    font-family: "WaveTour", Tahoma, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
}

/* ========== چیدمان اصلی ========== */
@media (min-width: 901px) {
    .tour-page {
        display: grid;
        grid-template-columns: minmax(280px, min(380px, 32vw)) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        transition: grid-template-columns 0.3s ease;
    }

    .tour-page.tour-page--sidebar-collapsed {
        grid-template-columns: 0 minmax(0, 1fr);
    }

    .tour-sidebar {
        min-height: 0;
        border-left: 1px solid rgba(148, 163, 184, 0.2);
        transition: opacity 0.22s ease;
    }

    .tour-page.tour-page--sidebar-collapsed .tour-sidebar {
        opacity: 0;
        pointer-events: none;
    }

    /* حالت کشوی موبایل روی دسکتاپ اعمال نشود */
    .tour-page.tour-page--sidebar-drawer-open .tour-sidebar {
        opacity: 1;
        pointer-events: auto;
    }

    .tour-viewer-wrap {
        min-height: 0;
        height: 100%;
    }

    .tour-sidebar-backdrop {
        display: none !important;
    }
}

/* ========== موبایل و تبلت کوچک: پانوراما تمام‌صفحه + منوی کشویی ========== */
@media (max-width: 900px) {
    .tour-page {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        position: relative;
    }

    /* گرید دسکتاپ را بی‌اثر می‌کنیم اگر کلاس جا مانده باشد */
    .tour-page.tour-page--sidebar-collapsed {
        grid-template-columns: unset;
    }

    .tour-viewer-wrap {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        height: 100%;
    }

    /* منوی کشویی از راست صفحه (در RTL و LTR) */
    .tour-sidebar:not(.is-hidden) {
        position: fixed;
        top: 0;
        bottom: 0;
        right: 0;
        left: auto;
        width: min(100vw - 48px, 400px);
        max-width: min(92vw, 400px);
        z-index: 200;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        padding-top: max(12px, env(safe-area-inset-top, 0px));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
        padding-inline: max(14px, env(safe-area-inset-right, 0px));
        box-sizing: border-box;
        border-left: 1px solid rgba(148, 163, 184, 0.2);
        border-right: none;
        box-shadow: -12px 0 42px rgba(0, 0, 0, 0.52);
        transform: translate3d(104%, 0, 0);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.32s;
        visibility: hidden;
        pointer-events: none;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tour-page.tour-page--sidebar-drawer-open .tour-sidebar:not(.is-hidden) {
        transform: translate3d(0, 0, 0);
        visibility: visible;
        pointer-events: auto;
    }

    .tour-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 190;
        margin: 0;
        padding: 0;
        border: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        cursor: pointer;
        transition: opacity 0.25s ease;
    }

    .tour-sidebar-backdrop[hidden] {
        display: none !important;
    }

    .sidebar-edge-btn--floating {
        top: max(12px, env(safe-area-inset-top, 0px));
        right: max(12px, env(safe-area-inset-right, 0px));
        bottom: auto;
        left: auto;
    }

    .music-btn--floating {
        bottom: max(14px, env(safe-area-inset-bottom, 0px));
        left: max(14px, env(safe-area-inset-left, 0px));
    }
}

.tour-sidebar {
    position: relative;
    background:
        radial-gradient(circle at 20% 0%, rgba(14, 165, 233, 0.2), transparent 55%),
        radial-gradient(circle at 80% 100%, rgba(56, 189, 248, 0.12), transparent 52%),
        #0f172a;
    padding: 16px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
}

.tour-sidebar.is-hidden {
    display: none;
}

.tour-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tour-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.tour-brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(160deg, #22d3ee, #0284c7);
    box-shadow: 0 0 0 5px rgba(14, 116, 144, 0.22);
}

.tour-brand-text {
    font-family: "WaveTourDisplay", "WaveTour", Tahoma, sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    color: #7dd3fc;
}

.tour-sidebar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px 0 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.sidebar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 1.05rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tour-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(14, 165, 233, 0.36);
    border-radius: 999px;
    background: rgba(2, 132, 199, 0.14);
    color: #dbeafe;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 10px 14px;
    min-height: 42px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-chip-btn:hover {
    background: rgba(2, 132, 199, 0.24);
    border-color: rgba(56, 189, 248, 0.7);
}

.tour-chip-btn.is-active {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.8);
    color: #dcfce7;
}

.tour-heading {
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.sidebar-edge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font-family: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.sidebar-edge-btn:hover {
    background: #f8fafc;
    border-color: #d1d5db;
}

.sidebar-edge-btn--floating {
    position: absolute;
    z-index: 40;
    box-shadow: none;
    right: 14px;
    top: 14px;
    bottom: auto;
    left: auto;
}

.tour-page.tour-page--sidebar-drawer-open .sidebar-edge-btn--floating,
.tour-page:not(.tour-page--sidebar-collapsed) .sidebar-edge-btn--floating[aria-hidden="true"] {
    display: none !important;
}

.tour-title {
    margin: 0 0 8px;
    font-size: clamp(1rem, 2.6vw, 1.24rem);
    font-family: "WaveTourDisplay", "WaveTour", Tahoma, sans-serif;
}

.tour-description {
    margin: 0 0 20px;
    line-height: 1.7;
    color: #d1d5db;
    font-size: 0.92rem;
}

.scene-list-wrap {
    margin-top: 10px;
}

.scene-list-label {
    margin: 0 0 10px;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    color: #93c5fd;
}

.scene-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.scene-list button {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.86));
    color: #f8fafc;
    padding: 12px 14px;
    min-height: 44px;
    border-radius: 12px;
    text-align: right;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    touch-action: manipulation;
}

.scene-list button:hover {
    border-color: rgba(125, 211, 252, 0.6);
    transform: translateY(-1px);
}

.scene-list button.is-active {
    border-color: #67e8f9;
    background: linear-gradient(180deg, #0369a1, #075985);
    box-shadow: 0 10px 22px rgba(3, 105, 161, 0.35);
}

/* ناحیهٔ پانوراما؛ LTR برای Pannellum */
.tour-viewer-wrap {
    position: relative;
    direction: ltr;
    unicode-bidi: isolate;
}

.panorama-viewer {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

#panorama-viewer .pnlm-hotspot-base.scene-hotspot-marker {
    width: auto;
    height: auto;
    visibility: visible;
}

.scene-hotspot-inner {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
}

.scene-hotspot-core {
    position: relative;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #7dd3fc, #0284c7 55%, #0369a1);
    border: 3px solid #fff;
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.25) inset;
}

.scene-hotspot-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid rgba(56, 189, 248, 0.95);
    animation: scene-hotspot-pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes scene-hotspot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    100% {
        transform: scale(3.2);
        opacity: 0;
    }
}

.hotspot-info {
    position: fixed;
    width: min(320px, calc(100vw - 24px));
    max-height: min(70dvh, 22rem);
    overflow: auto;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 14px;
    z-index: 10050;
    font-family: "WaveTour", Tahoma, sans-serif;
    text-align: right;
    line-height: 1.65;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.hotspot-info .hotspot-empty-hint {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

.hotspot-info h3 {
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 1.05rem;
}

.hotspot-info p {
    margin: 0;
    white-space: pre-wrap;
}

.btn-close {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    float: left;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.25rem;
    line-height: 1;
    touch-action: manipulation;
}

.music-btn.tour-chip-btn {
    border: 1px solid rgba(14, 165, 233, 0.36);
    background: rgba(2, 132, 199, 0.14);
    color: #dbeafe;
}

.music-btn.tour-chip-btn:hover {
    background: rgba(2, 132, 199, 0.24);
    border-color: rgba(56, 189, 248, 0.7);
}

.music-btn.tour-chip-btn[hidden] {
    display: none !important;
}

.music-btn--floating {
    position: absolute;
    left: 14px;
    bottom: 14px;
    border: 0;
    border-radius: 8px;
    background: #0284c7;
    color: #f8fafc;
    cursor: pointer;
    padding: 10px 14px;
    min-height: 44px;
    z-index: 25;
    touch-action: manipulation;
    font-family: inherit;
}

.music-btn--floating[hidden] {
    display: none !important;
}

.tour-toast {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.86rem;
    z-index: 30;
    white-space: nowrap;
}
