/* ==========================================================================
   Orbem Holobox Application Styles
   4K Portrait Display (2160 x 3840)
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Main Container
   ========================================================================== */

#holobox-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

/* ==========================================================================
   Video Players
   ========================================================================== */

.video-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;  /* Show full video, black bars on sides */
    visibility: hidden;
    pointer-events: none;
    z-index: 1;
    background: #000;
    /* Force GPU layer for smoother transitions */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: visibility, z-index;
}

.video-player.active {
    visibility: visible;
    z-index: 2;
}

/* Seamless transition - new video on top, fully visible */
.video-player.transitioning {
    visibility: visible;
    z-index: 3;
}

/* ==========================================================================
   Touch Zones Overlay
   ========================================================================== */

#touch-overlay {
    position: absolute;
    /* Position and size are set dynamically by JS to match video bounds */
    z-index: 10;
    /* Debug outline to visualize the video area */
}

#touch-overlay.debug-bounds {
    outline: 2px dashed rgba(255, 255, 0, 0.5);
    outline-offset: -2px;
}

.touch-zone {
    position: absolute;
    cursor: pointer;
    /* Invisible by default */
    background: transparent;
    border: none;
}

.touch-zone:active,
.touch-zone.pressed {
    /* No visual feedback - truly invisible */
    background: transparent;
}

/* Debug mode - visualize touch zones */
.touch-zone.debug {
    background: rgba(0, 255, 0, 0.2);
    border: 2px dashed rgba(0, 255, 0, 0.5);
}

.touch-zone.debug::after {
    content: attr(data-label);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0f0;
    font-size: 14px;
    font-family: monospace;
    text-shadow: 0 0 5px #000;
    pointer-events: none;
}

/* ==========================================================================
   Preload Container
   ========================================================================== */

#preload-container {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

#preload-container video {
    width: 1px;
    height: 1px;
}

/* ==========================================================================
   Loading Indicator
   ========================================================================== */

#loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

#loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-indicator p {
    color: #fff;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 18px;
}

/* ==========================================================================
   Debug Panel
   ========================================================================== */

#debug-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    padding: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    z-index: 1000;
    overflow-y: auto;
}

#debug-panel.hidden {
    display: none;
}

#debug-panel h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
    font-size: 14px;
    color: #0f0;
}

#debug-content {
    line-height: 1.8;
}

#debug-content .label {
    color: #888;
}

#debug-content .value {
    color: #0f0;
}

#debug-content .warning {
    color: #ff0;
}

#debug-content .error {
    color: #f00;
}

#touch-zone-visualizer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

.debug-btn {
    width: 100%;
    padding: 10px 15px;
    background: #0af;
    color: #000;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.debug-btn:hover {
    background: #0cf;
}

.debug-shortcuts {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #333;
    font-size: 11px;
    color: #666;
    text-align: center;
}

.debug-shortcuts span {
    display: inline-block;
    padding: 2px 6px;
    background: #333;
    border-radius: 3px;
    font-family: monospace;
    color: #888;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Standard HD (1080p) */
@media screen and (max-width: 1920px) {
    .spinner {
        width: 40px;
        height: 40px;
    }
    
    #loading-indicator p {
        font-size: 14px;
    }
}

/* For actual 4K displays */
@media screen and (min-width: 2160px) {
    .spinner {
        width: 80px;
        height: 80px;
        border-width: 6px;
    }
    
    #loading-indicator p {
        font-size: 24px;
    }
    
    #debug-panel {
        width: 500px;
        font-size: 16px;
    }
    
    .touch-zone.debug::after {
        font-size: 20px;
    }
}

/* ==========================================================================
   Video Preload Progress Overlay
   Shown on first visit while caching all videos
   ========================================================================== */

#preload-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preload-progress-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.preload-content {
    text-align: center;
    color: #fff;
    max-width: 80%;
    padding: 3rem;
}

/* Logo with breathing animation */
.preload-logo {
    width: 200px;
    height: auto;
    margin: 0 auto 3rem;
    animation: logo-breathe 3s ease-in-out infinite;
}

.preload-logo img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
}

@keyframes logo-breathe {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.preload-bar-container {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
    overflow: hidden;
}

.preload-bar {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.preload-percentage {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    letter-spacing: 0.1em;
}
