/* 功能模組編輯器共用樣式：facetarget、planetarget、tourvr、webvr (imagetarget 另有 imagetarget.css)
   放在 common.css 之後載入 */

.lucide {
    stroke-width: 1.5px;
}

/* 停用狀態淡入淡出 (.glass-disabled 定義在 common.css) */
.glass-disabled {
    transition: all 0.3s;
}

/* 手機直向 / 橫向：頂部列縮短，留給預覽更多空間 */
@media (max-width: 767px),
(max-height: 480px) {
    header {
        height: 44px !important;
        min-height: 0;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    header h1 {
        font-size: 1rem !important;
    }

    header .gap-4 {
        gap: 0.5rem !important;
    }

    header .p-2 {
        padding: 0.4rem !important;
    }
}

/* 3D 預覽 (facetarget、planetarget 的 three.js) */
#canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #f1f5f9;
    border-radius: 0.75rem;
    overflow: hidden;
}

#canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* 全景預覽 (tourvr 的 Pannellum、webvr 的 A-Frame)；背景色由各頁的 class 決定 */
#panorama-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

/* 全景編輯的中心準星 (新增熱點的位置) */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

#crosshair::before {
    top: 9px;
    left: 0;
    width: 20px;
    height: 2px;
}

#crosshair::after {
    top: 0;
    left: 9px;
    width: 2px;
    height: 20px;
}

/* tourvr：讀取中改用共用的 UISkeleton.previewOverlay，隱藏 Pannellum 內建讀取框 */
.pnlm-load-box {
    display: none !important;
}

.pnlm-hotspot-base {
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* tourvr 編輯器：熱點可點選、拖曳；選取中的熱點以粉紅外框標示 */
.tourvr-edit-hotspot {
    cursor: grab;
    touch-action: none;
}

.tourvr-edit-hotspot.is-dragging {
    cursor: grabbing;
}

.tourvr-edit-hotspot.is-selected {
    border-color: #ec4899;
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.45), 0 0 5px rgba(0, 0, 0, 0.5);
}

/* tourvr：熱點名稱完整顯示在熱點上方 */
.pnlm-tooltip span {
    visibility: visible !important;
    width: auto !important;
    max-width: none !important;
    white-space: nowrap !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    margin-left: 0 !important;
    left: 50% !important;
    transform: translateX(-50%);
}

/* webvr：編輯器內隱藏 A-Frame 的 VR 按鈕 */
#panorama-container .a-enter-vr-button {
    display: none;
}

/* 全景編輯步驟 (webvr、tourvr 的 #step-2.editor-split) 的手機版：預覽固定在上方，下方以分頁切換清單 / 設定 / 屬性
   (core/editor-panels.js 設定 data-panel)；整頁不捲動，只有面板內捲動，預覽不會被捲走
   Tailwind Play CDN 的樣式排在本檔之後，規則以 main / ID 開頭提高權重 */
.editor-panel-tabs {
    display: none;
}

@media (max-width: 1023px),
(max-height: 500px) {
    body:has(.editor-split:not(.hidden)) {
        height: 100dvh;
        overflow: hidden;
    }

    body:has(.editor-split:not(.hidden)) main {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    body:has(.editor-split:not(.hidden)) #mainContent {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        width: 100%;
        padding: 0.5rem;
    }

    main .editor-split:not(.hidden) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        flex: 1;
        min-height: 0;
        height: auto;
        gap: 0.5rem;
    }

    main .editor-split > section[aria-label="預覽"] {
        order: -1;
        flex: 0 0 auto;
        width: 100%;
        height: 45%;
        min-height: 180px;
    }

    main .editor-split > .editor-panel-tabs {
        display: flex;
        flex: none;
        order: 0;
    }

    main .editor-split > aside {
        order: 1;
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
    }

    main .editor-split[data-panel="list"] > #right-sidebar,
    main .editor-split:not([data-panel="list"]) > #left-sidebar {
        display: none;
    }

    /* 右欄自己的「導覽設定 / 屬性」分頁由上面的分頁列取代 */
    main .editor-split .inspector-tabs {
        display: none;
    }

    /* 預覽變窄：試玩按鈕固定在視角標籤下方，新增熱點等按鈕縮小、靠近底部 */
    main .editor-split #viewer-mode-container {
        top: 3rem;
    }

    main .editor-split #add-hotspot-btn-container {
        bottom: 0.5rem;
        gap: 0.375rem;
    }

    main .editor-split #add-hotspot-btn-container > button {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }
}

/* 手機橫向：預覽在左，分頁與面板在右 */
@media (max-height: 500px) and (orientation: landscape) {
    main .editor-split:not(.hidden) {
        display: grid;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }

    main .editor-split > section[aria-label="預覽"] {
        grid-column: 1;
        grid-row: 1 / 3;
        height: auto;
        min-height: 0;
    }

    main .editor-split > .editor-panel-tabs {
        grid-column: 2;
        grid-row: 1;
    }

    main .editor-split > aside {
        grid-column: 2;
        grid-row: 2;
    }
}
