/**
 * Thalassa Stone Rooms - 3D Tour Styles
 */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    -webkit-font-smoothing: antialiased;
}

/* Canvas Container */
.canvas-container {
    position: fixed;
    inset: 0;
    z-index: 1;
}

.canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #1a3a4a 0%, #2d5a6e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #c9a962;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    font-weight: 500;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto 0.75rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c9a962, #dfc588);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-percent {
    font-size: 0.9rem;
    font-weight: 500;
    color: #c9a962;
    margin-bottom: 0.5rem;
}

.loading-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Error Overlay */
.error-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(10, 10, 10, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
}

.error-overlay.visible {
    display: flex;
}

.error-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.error-icon {
    width: 60px;
    height: 60px;
    border: 3px solid #e07c5c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    color: #e07c5c;
    margin: 0 auto 1.5rem;
}

.error-content h2 {
    font-weight: 500;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.error-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a3a4a;
    background: #c9a962;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #dfc588;
    transform: translateY(-1px);
}

/* Tour UI */
.tour-ui {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.tour-ui > * {
    pointer-events: auto;
}

/* Header */
.tour-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.tour-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
}

.fullscreen-btn {
    margin-left: auto;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-btn svg {
    width: 20px;
    height: 20px;
}

.fullscreen-btn .icon-compress {
    display: none;
}

:fullscreen .fullscreen-btn .icon-expand {
    display: none;
}

:fullscreen .fullscreen-btn .icon-compress {
    display: block;
}

/* iOS fullscreen mode (standalone tab, not in iframe) */
body.ios-fullscreen .fullscreen-btn .icon-expand {
    display: none;
}

body.ios-fullscreen .fullscreen-btn .icon-compress {
    display: block;
}

/* Mode Toggle */
.mode-toggle {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn svg {
    width: 16px;
    height: 16px;
}

.mode-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    color: #1a3a4a;
    background: #c9a962;
}

/* Teleport Panel */
.teleport-panel {
    position: absolute;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: calc(100% - 2rem);
}

.panel-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
    text-align: center;
}

.teleport-spots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.spot-btn {
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spot-btn:hover {
    background: rgba(201, 169, 98, 0.3);
    border-color: rgba(201, 169, 98, 0.5);
}

.spot-btn.active {
    background: #c9a962;
    border-color: #c9a962;
    color: #1a3a4a;
}

/* Controls Hint */
.controls-hint {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 0.625rem 1rem;
    padding-right: 2.5rem;
    border-radius: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.controls-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.controls-hint kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-family: inherit;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.hint-mobile {
    display: none;
}

.hint-close {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.hint-close:hover {
    color: white;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tour-header {
        padding: 0.75rem 1rem;
    }

    .tour-title {
        font-size: 0.85rem;
    }

    .teleport-panel {
        display: none;
    }

    .controls-hint {
        display: none;
    }

    .mode-toggle {
        top: 4.5rem;
    }

    .mode-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .mode-btn svg {
        width: 14px;
        height: 14px;
    }

    .spot-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .hint-desktop {
        display: none;
    }

    .hint-mobile {
        display: inline;
    }

}

/* Touch device detection */
@media (hover: none) {
    .hint-desktop {
        display: none;
    }

    .hint-mobile {
        display: inline;
    }
}

/* ==========================================
   PANORAMA OVERLAY
   ========================================== */

.pano-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    display: none;
    flex-direction: column;
    justify-content: space-between;
}

.pano-overlay.visible {
    display: flex;
}

.pano-overlay > * {
    pointer-events: auto;
}

.pano-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.pano-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.pano-back-btn:hover {
    background: rgba(201,169,98,0.4);
}

.pano-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    text-transform: capitalize;
}

.pano-hint {
    text-align: center;
    padding: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
    pointer-events: none;
}

/* Hide dollhouse-specific controls in pano mode */
.tour-ui.pano-active .mode-toggle,
.tour-ui.pano-active .teleport-panel,
.tour-ui.pano-active .controls-hint {
    display: none !important;
}

/* Shrink tour title in pano mode */
.tour-ui.pano-active .tour-title {
    font-size: 0.6rem;
    opacity: 0.5;
    top: 0.25rem;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
}


/* ==========================================
   FULLSCREEN
   ========================================== */

/* Pano fullscreen button positioning */
.pano-fullscreen-btn {
    margin-left: auto;
}

/* Fullscreen styles */
:fullscreen {
    background: #0a0a0a;
}

:fullscreen .tour-header {
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

:fullscreen .teleport-panel {
    display: block;
}

:fullscreen .controls-hint {
    display: block;
}
