/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
}

/* ===== Layout ===== */
.app {
    display: grid;
    grid-template-columns: 1fr 350px;
    height: 100vh;
    height: 100dvh;
}

/* ===== Viewer Panel ===== */
.viewer-panel {
    position: relative;
    overflow: hidden;
    background: #0f0f23;
    cursor: grab;
}

.viewer-panel:active {
    cursor: grabbing;
}

#panoCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== Spinner ===== */
.spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 35, 0.85);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.spinner.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Room Label ===== */
.room-label {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.room-label.visible {
    opacity: 1;
}

/* ===== Plan Panel ===== */
.plan-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #16213e;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    overflow: auto;
}

.plan-container {
    width: 100%;
    max-height: 100%;
}

.plan-container svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== SVG Plan Styling ===== */
.plan-container .room-zone {
    fill: rgba(108, 99, 255, 0.08);
    stroke: rgba(108, 99, 255, 0.3);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.plan-container .room-zone:hover {
    fill: rgba(108, 99, 255, 0.2);
    stroke: rgba(108, 99, 255, 0.6);
}

.plan-container .room-zone.active {
    fill: rgba(108, 99, 255, 0.3);
    stroke: #6c63ff;
    stroke-width: 2.5;
}

.plan-container .room-label-text {
    fill: #c0c0d0;
    font-size: 11px;
    font-family: system-ui, sans-serif;
    text-anchor: middle;
    pointer-events: none;
    user-select: none;
}

.plan-container .wall {
    fill: none;
    stroke: #8888aa;
    stroke-width: 2;
    pointer-events: none;
}

/* ===== Responsive — Mobile ===== */
@media (max-width: 768px) {
    html, body {
        overflow: auto;
    }

    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 60vh auto;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .viewer-panel {
        height: 60vh;
        height: 60dvh;
    }

    .plan-panel {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding: 12px;
        min-height: 40vh;
    }
}

@media (max-width: 480px) {
    .app {
        grid-template-rows: 50vh auto;
    }

    .viewer-panel {
        height: 50vh;
        height: 50dvh;
    }

    .room-label {
        font-size: 0.8rem;
        bottom: 10px;
        left: 10px;
    }
}
