/* UI Specific Styles */

#controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    /* Reduced from taking up too much space */
    pointer-events: none;
}

.theme-selector {
    position: absolute;
    bottom: 80px;
    /* Above gesture guide */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.mode-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 200, 255, 0.3);
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.mode-btn:hover {
    background: rgba(0, 200, 255, 0.2);
    border-color: rgba(0, 200, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.4);
}

.mode-btn.active {
    background: rgba(0, 200, 255, 0.3);
    border-color: #00d4ff;
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.6);
}

.gesture-guide {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    /* Override main.css generic placement */
}

/* Credits */
.credits {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.credits a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 700;
}

.credits a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Webcam Preview with Hand Tracking Overlay */
#webcam-container {
    position: relative;
    width: 240px;
    height: 180px;
    border-radius: 15px;
    border: 2px solid rgba(108, 92, 231, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 10;
}

#webcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror the video */
    display: block;
    opacity: 1 !important;
    pointer-events: auto !important;
}

#webcam-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through */
    transform: scaleX(-1); /* Mirror the canvas to match video */
}

/* Toggle button for webcam preview */
#webcam-toggle {
    position: absolute;
    top: 720px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
    z-index: 11;
}

#webcam-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Audio Controls */
#audio-controls {
    position: absolute;
    top: 755px;
    left: 20px;
    background: rgba(5, 10, 30, 0.9);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 15px;
    padding: 15px;
    z-index: 50;
    pointer-events: auto;
    min-width: 240px;
}

.audio-control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#audio-toggle {
    width: 100%;
    background: rgba(0, 200, 255, 0.2);
    border: 1px solid rgba(0, 200, 255, 0.4);
    color: #00d4ff;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

#audio-toggle:hover {
    background: rgba(0, 200, 255, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

#audio-toggle.playing {
    background: rgba(0, 255, 136, 0.3);
    border-color: rgba(0, 255, 136, 0.6);
    color: #00ff88;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control label {
    font-size: 1rem;
    color: #00d4ff;
}

#volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 10px;
    background: rgba(0, 200, 255, 0.2);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

#volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

#volume-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    min-width: 40px;
    text-align: right;
}

/* Planet Info Panel (JARVIS Style!) */
.planet-info-panel {
    position: absolute;
    top: 80px;
    right: 30px;
    width: 380px;
    max-height: 65vh;
    overflow-y: auto;
    background: rgba(5, 10, 30, 0.92);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 20px;
    padding: 0;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(0, 200, 255, 0.15),
        inset 0 0 40px rgba(0, 200, 255, 0.05);
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: panelSlide 0.5s ease-out;
}

@keyframes panelSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.planet-info-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(50px) scale(0.95);
}

.panel-header {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.2), rgba(123, 44, 191, 0.2));
    padding: 25px 25px 20px 25px;
    border-bottom: 1px solid rgba(0, 200, 255, 0.3);
    position: relative;
}

.panel-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 200, 255, 0.2);
    border: 1px solid rgba(0, 200, 255, 0.4);
    border-radius: 50%;
    color: #00d4ff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.panel-close-btn:hover {
    background: rgba(255, 50, 100, 0.3);
    border-color: rgba(255, 50, 100, 0.6);
    color: #ff3264;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 50, 100, 0.5);
}

.panel-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

.planet-type {
    display: inline-block;
    background: rgba(0, 200, 255, 0.15);
    border: 1px solid rgba(0, 200, 255, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #00d4ff;
}

.panel-body {
    padding: 25px;
}

.description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 20px 0;
    font-weight: 400;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.info-item {
    background: rgba(0, 200, 255, 0.05);
    border: 1px solid rgba(0, 200, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: rgba(0, 200, 255, 0.1);
    border-color: rgba(0, 200, 255, 0.4);
    transform: translateX(5px);
}

.info-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(0, 212, 255, 0.7);
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    text-align: right;
}

.fun-fact {
    background: linear-gradient(135deg, rgba(255, 200, 0, 0.1), rgba(255, 100, 200, 0.1));
    border: 2px solid rgba(255, 200, 0, 0.3);
    border-radius: 15px;
    padding: 18px;
    margin-top: 20px;
}

.fun-fact-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffc800;
    margin-bottom: 10px;
}

.fun-fact p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-weight: 500;
}

/* Scrollbar styling */
.planet-info-panel::-webkit-scrollbar {
    width: 6px;
}

.planet-info-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.planet-info-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 200, 255, 0.4);
    border-radius: 10px;
}

.planet-info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 200, 255, 0.6);
}

/* Controls Panel - MOVED TO LEFT SIDE */
.controls-panel {
    position: absolute;
    top: 120px;
    left: 20px;
    background: rgba(5, 10, 30, 0.9);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 50;
    pointer-events: auto;
    min-width: 200px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #00d4ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#speed-slider {
    width: 150px;
    height: 6px;
    border-radius: 10px;
    background: rgba(0, 200, 255, 0.2);
    outline: none;
    cursor: pointer;
}

#speed-slider::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

#speed-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    min-width: 40px;
}

.control-group button {
    background: rgba(0, 200, 255, 0.2);
    border: 1px solid rgba(0, 200, 255, 0.4);
    color: #00d4ff;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.control-group button:hover {
    background: rgba(0, 200, 255, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* Voice selector dropdown */
#voice-selector {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid rgba(0, 200, 255, 0.4);
    border-radius: 10px;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

#voice-selector:hover {
    background: rgba(0, 200, 255, 0.2);
    border-color: rgba(0, 200, 255, 0.6);
}

#voice-selector:focus {
    background: rgba(0, 200, 255, 0.2);
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
}

#voice-selector option {
    background: rgba(5, 10, 30, 0.95);
    color: #fff;
    padding: 8px;
}