/**
 * ColorLights - Interactive WebGL Light Simulation
 * Stylesheet
 * 
 * @author David Bookstaber
 */

body {
    margin: 0;
    background-color: #000;
    font-family: Arial, sans-serif;
}
/* Restrict overflow hidden only to main app (prevents disabling scroll on privacy page) */
body.app-root { overflow: hidden; }

#canvasContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#lightCanvas {
    z-index: 1;
}

#debugCanvas {
    z-index: 2;
    pointer-events: none; /* Allows clicks to pass through to the main canvas */
}

/* Avoid styling every button globally (was affecting hint dismiss). */
/* Previous generic button rule narrowed to buttons inside future .legacy-button-container if needed. */
.legacy-button-container > button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.6);
    border: none;
    border-radius: 5px;
}

/* Reset for hint dismiss button to ensure consistent placement */
.initial-hint-banner .hint-dismiss-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    pointer-events: auto;
}
.initial-hint-banner .hint-dismiss-btn:hover,
.initial-hint-banner .hint-dismiss-btn:focus { color:#fff; }

#debugControls {
    position: fixed;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#debugControls label {
    margin-right: 10px;
    user-select: none;
}

#radiusInfo {
    margin-top: 5px;
    font-size: 12px;
}

.context-menu {
    display: none;
    position: fixed;
    background-color: rgba(40, 40, 40, 0.95);
    border-radius: 5px;
    padding: 8px 0;
    min-width: 150px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    color: #fff;
    font-family: Arial, sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.3);
    user-select: none;
}

#brightnessDisplay {
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 5px;
    font-size: 14px;
}

.menu-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Instructions pop-up styles */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    z-index: 2000;
    color: #fff;
    min-width: 300px;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: normal;
}

.close-button {
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
}

.close-button:hover {
    color: #fff;
}

.popup-content {
    padding: 20px;
}

.popup-content h3 {
    margin-top: 0;
    color: #6b9fff;
}

.popup-content ul {
    padding-left: 20px;
}

.popup-content li {
    margin-bottom: 10px;
    line-height: 1.4;
}

.tip {
    margin-top: 15px;
    padding: 10px;
    background-color: rgba(100, 100, 255, 0.1);
    border-left: 3px solid #6b9fff;
    border-radius: 3px;
}

.webgl-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    color: white;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.9);
}

.webgl-error h2 {
    margin-bottom: 10px;
    font-size: 24px;
    color: #ff6b6b;
}

.webgl-error p {
    margin-bottom: 20px;
    max-width: 500px;
    line-height: 1.5;
}

.simpler-version-link {
    display: inline-block;
    background-color: #4f8aff;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s;
    margin-top: 15px;
}

.simpler-version-link:hover {
    background-color: #2c6dff;
}

.mobile-controls {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
    display: none; /* Hidden by default, shown on touch devices */
}

.mobile-controls button {
    padding: 10px 15px;
    margin-left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid white;
    border-radius: 5px;
    font-size: 16px;
}

@media (pointer: coarse) {
    .mobile-controls {
        display: flex;
    }
    
    /* Make context menu items bigger for touch */
    #contextMenu .menu-item {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    /* Make close button in instructions bigger */
    #closeInstructions {
        padding: 8px 12px;
        font-size: 16px;
    }
}

/* Initial interaction hint banner */
.initial-hint-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 10px 36px 12px 18px; /* extra right padding for dismiss button */
    border-radius: 8px;
    font-size: 14px;
    font-family: Arial, sans-serif;
    letter-spacing: 0.5px;
    z-index: 1500;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: hint-fade-in 400ms ease;
    pointer-events: none; /* Let clicks pass through */
    position: fixed;
}
.initial-hint-banner .hint-main-line { 
    pointer-events:none; 
    display:block;
    margin-right:22px; /* space so text never sits under X */
    text-align:center;
}
.initial-hint-banner .hint-dismiss-btn {
    position:absolute;
    top:4px;
    right:6px;
    background:transparent;
    border:none;
    color:#ccc;
    font-size:16px;
    line-height:1;
    cursor:pointer;
    padding:2px 4px;
    pointer-events:auto; /* allow click */
    transition: color 150ms ease;
}
.initial-hint-banner .hint-dismiss-btn:hover,
.initial-hint-banner .hint-dismiss-btn:focus { color:#fff; outline:none; }
.initial-hint-banner .hint-privacy-line {
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    opacity: 0.85;
    pointer-events: auto; /* allow clicks on link */
}
.initial-hint-banner .hint-privacy-link {
    color: #bbb;
    text-decoration: none;
    transition: color 150ms ease;
}
.initial-hint-banner .hint-privacy-link:focus,
.initial-hint-banner .hint-privacy-link:hover {
    color: #fff;
    text-decoration: underline;
}
.initial-hint-banner.fade-out {
    animation: hint-fade-out 500ms ease forwards;
}
@keyframes hint-fade-in { from { opacity:0; transform: translate(-50%, -6px);} to { opacity:1; transform: translate(-50%,0);} }
@keyframes hint-fade-out { to { opacity:0; transform: translate(-50%, -6px);} }

/* Loading placeholder for initial paint */
.initial-load-placeholder { position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:#000; color:#fff; font-family:Arial,Helvetica,sans-serif; z-index:1200; }
.initial-load-placeholder .ph-inner { text-align:center; animation: ph-fade-in 400ms ease; }
.initial-load-placeholder.fade-out { animation: ph-fade-out 600ms ease forwards; }
@keyframes ph-fade-in { from { opacity:0; transform:translateY(8px);} to { opacity:1; transform:translateY(0);} }
@keyframes ph-fade-out { to { opacity:0; transform:translateY(-8px);} }
