/* Basic styling for Stage 2 with 3D visualization */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
}

/* Landing Page Styles */
#landing-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    z-index: 10000;
}

.landing-content {
    text-align: center;
    animation: fadeIn 1s ease-out;
}

.landing-title {
    font-size: 72px;
    font-weight: 200;
    letter-spacing: 8px;
    margin-bottom: 20px;
    color: #ffffff;
    text-transform: lowercase;
}

.landing-subtitle {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 3px;
    margin-bottom: 60px;
    color: #888888;
    text-transform: lowercase;
}

.enter-button {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 14px 40px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.enter-button:hover {
    background: #ffffff;
    color: #0a0a0a;
    transform: translateY(-2px);
}

.enter-button:active {
    transform: translateY(0);
}

.email-signup-container {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
}

.email-signup-button {
    background: transparent;
    color: #666666;
    border: 1px solid #666666;
    padding: 10px 28px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.email-signup-button:hover {
    color: #ffffff;
    border-color: #ffffff;
    transform: translateY(-2px);
}

.email-signup-button:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out animation for landing page */
#landing-page.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Password input styles */
.password-input {
    background: transparent;
    color: #ffffff;
    border: 1px solid #666;
    border-radius: 0;
    padding: 12px 20px;
    font-size: 14px;
    font-family: inherit;
    width: 250px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
    text-align: center;
    letter-spacing: 1px;
}

.password-input:focus {
    outline: none;
    border-color: #ffffff;
}

.password-input::placeholder {
    color: #666;
}

.password-error {
    color: #ff4444;
    font-size: 12px;
    margin-top: -15px;
    margin-bottom: 20px;
    min-height: 18px;
    letter-spacing: 0.5px;
}

#password-container {
    animation: fadeIn 0.3s ease-out;
    margin-top: 20px;
    margin-bottom: 8px;
}

/* Spaces pane (landing) */
.spaces-pane {
    margin: 24px auto 16px;
    max-width: 720px;
    text-align: left;
}

.spaces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 12px 0 8px;
}

.space-card {
    position: relative;
    border: 1px solid #2a2a2a;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    min-height: 84px;
}

.space-card:hover { border-color: #555; transform: translateY(-1px); }
.space-card:active { transform: translateY(0); }

.space-card.disabled {
    cursor: default;
    opacity: 0.5;
    border-style: dashed;
}

.space-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.space-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #121212;
    border: 1px solid #333;
    font-weight: 600;
    letter-spacing: 1px;
}

.space-meta {
    display: flex;
    flex-direction: column;
}

.space-name { font-size: 16px; color: #fff; }
.space-sub { font-size: 12px; color: #aaa; }

.space-status {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9ad59a;
}

.space-status .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
}

.spaces-caption {
    margin-top: 10px;
    font-size: 12px;
    color: #777;
    text-align: center;
}

/* Landing buttons spacing */
#connect-btn {
    margin-top: 8px;
    margin-bottom: 14px;
    display: inline-block;
}

#enter-space-btn {
    margin-top: 8px;
    display: inline-block;
}

/* Top bar with login button */
.top-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.login-button, .logout-button {
    background: transparent;
    color: #ffffff;
    border: 1px solid #666;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.login-button:hover, .logout-button:hover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffffff;
    font-size: 14px;
}

#user-handle {
    font-weight: 300;
    letter-spacing: 1px;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    position: relative;
    animation: fadeIn 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #666;
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #ffffff;
}

/* Auth forms */
.auth-form h2 {
    margin: 0 0 30px 0;
    font-size: 24px;
    font-weight: 200;
    letter-spacing: 2px;
    text-align: center;
    color: #ffffff;
}

.auth-input {
    width: 100%;
    background: transparent;
    color: #ffffff;
    border: 1px solid #666;
    border-radius: 0;
    padding: 12px 15px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
    letter-spacing: 0.5px;
}

.auth-input:focus {
    outline: none;
    border-color: #ffffff;
}

.auth-input::placeholder {
    color: #666;
}

.auth-button {
    width: 100%;
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 12px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 10px;
}

.auth-button:hover {
    background: #ffffff;
    color: #0a0a0a;
}

.auth-error {
    color: #ff4444;
    font-size: 12px;
    margin: -10px 0 15px 0;
    min-height: 18px;
    letter-spacing: 0.5px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #888;
}

.auth-switch a {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.auth-switch a:hover {
    opacity: 0.8;
}

/* Email signup modal styles */
.email-modal-content {
    max-width: 500px;
}

.email-form h2 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 200;
    letter-spacing: 2px;
    text-align: center;
    color: #ffffff;
}

.email-description {
    color: #aaa;
    margin-bottom: 20px;
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
}

.email-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}

.email-benefits li {
    color: #888;
    font-size: 14px;
    margin: 10px 0;
    padding-left: 25px;
    position: relative;
}

.email-benefits li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #666;
}

.email-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    padding: 12px 15px;
    border-radius: 4px;
    margin: 15px 0;
    text-align: center;
    font-size: 14px;
}

#app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Status panel - more compact */
#status-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #333;
    min-width: 180px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

#status-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #4CAF50;
}

.status-item {
    margin: 3px 0;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    color: #999;
    margin-right: 8px;
}

.status-value {
    color: #fff;
    font-weight: 500;
}

#connection-status {
    font-weight: bold;
}

#connection-status:before {
    content: "● ";
    color: #f44336;
}

#connection-status.connected:before {
    color: #4CAF50;
}

/* Scene container */
#scene-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

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

#loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #666;
    z-index: 10;
}

/* Controls panel - more compact */
#controls-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #333;
    min-width: 220px;
    max-width: 250px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

/* Back to spaces button (in-sim) */
.back-button {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    color: #ffffff;
    border: 1px solid #666;
    padding: 6px 12px;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1100;
}

.back-button:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.08);
}

#controls-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #2196F3;
}

/* Audio controls - streamlined */
.audio-controls {
    margin-bottom: 10px;
}

.audio-controls h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #e2e8f0;
}

/* Audio source controls */
.audio-source-controls {
    margin: 15px 0;
    padding: 15px 0;
    border-bottom: 1px solid #333;
}

.source-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.source-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #ccc;
    transition: color 0.2s;
}

.source-selector label:hover {
    color: #fff;
}

.source-selector input[type="radio"] {
    cursor: pointer;
}

#file-controls {
    margin-top: 15px;
}

.file-info {
    margin: 10px 0;
    font-size: 13px;
    color: #888;
    min-height: 20px;
}

.file-playback-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #ccc;
    cursor: pointer;
}

.checkbox-label:hover {
    color: #fff;
}

.control-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.control-button:hover:not(:disabled) {
    background: #1976D2;
}

.control-button:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* Primary button styling */
.primary-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s ease;
}

.primary-button:hover:not(:disabled) {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.primary-button:active:not(:disabled) {
    background: #0D47A1;
    transform: translateY(0);
}

.primary-button:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* Audio level meter - more compact */
.audio-level-meter {
    margin-top: 10px;
    padding: 8px;
    background: rgba(26, 32, 44, 0.5);
    border-radius: 4px;
}

.audio-level-meter h5 {
    margin: 0 0 6px 0;
    color: #e2e8f0;
    font-size: 11px;
    font-weight: normal;
}

.level-canvas {
    width: 100%;
    height: 50px;
    border: 1px solid #4a5568;
    border-radius: 4px;
}

/* Help toggle button */
.help-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a5568;
    color: #e2e8f0;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.help-toggle:hover {
    background: #718096;
    transform: scale(1.1);
}

/* Help panel */
.help-panel {
    margin-top: 15px;
    padding: 12px;
    background: rgba(45, 55, 72, 0.5);
    border-radius: 6px;
    border: 1px solid #4a5568;
    font-size: 12px;
    transition: all 0.3s ease;
    opacity: 1;
    max-height: 300px;
    overflow-y: auto;
}

.help-panel.hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 12px;
    margin: 0;
    overflow: hidden;
}

.help-panel h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #e2e8f0;
}

.help-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-panel li {
    margin: 4px 0;
    color: #cbd5e0;
}

.help-panel kbd {
    display: inline-block;
    padding: 2px 5px;
    font-size: 11px;
    font-family: monospace;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 3px;
    color: #e2e8f0;
    margin-right: 4px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mesh Controls */
.mesh-controls {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

.mesh-controls h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #aaa;
}

.mesh-selection {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.mesh-dropdown {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mesh-dropdown:hover {
    border-color: #2196F3;
    background: rgba(0, 0, 0, 0.7);
}

.mesh-dropdown:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.mesh-dropdown option {
    background: #1a1a1a;
    color: #fff;
    padding: 8px;
}

.mesh-selection .control-button {
    padding: 8px 12px;
    font-size: 12px;
}

.mesh-selection .clear-btn {
    background: #553333;
}

.mesh-selection .clear-btn:hover {
    background: #774444;
}

.mesh-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.mesh-buttons .control-button {
    padding: 8px 12px;
    font-size: 12px;
}

.mesh-buttons .clear-btn {
    grid-column: span 2;
    background: #553333;
}

.mesh-buttons .clear-btn:hover {
    background: #774444;
}

.mesh-info {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #status-panel,
    #controls-panel {
        font-size: 11px;
        padding: 8px 12px;
        min-width: 150px;
    }
    
    .primary-button {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .help-panel {
        font-size: 11px;
    }
}
