/* ==========================================
   TROY — Architectural Visualization
   ========================================== */

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

:root {
    --bg: #08080c;
    --bg-raised: #111118;
    --bg-elevated: #1a1a24;
    --surface: #22222e;
    --border: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    --text: #e8e8ef;
    --text-dim: rgba(255,255,255,0.5);
    --text-muted: rgba(255,255,255,0.3);
    --accent: #c9a55a;
    --accent-dim: rgba(201,165,90,0.15);
    --accent-glow: rgba(201,165,90,0.3);
    --danger: #e94560;
    --success: #2ecc71;
    --warning: #f39c12;
    --radius: 8px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 56px;
    background: rgba(8,8,12,0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-mark {
    color: var(--accent);
    font-size: 1.2rem;
}
.logo-mark.small {
    font-size: 0.9rem;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text);
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}
.status-dot.offline { background: #666; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.busy { background: var(--warning); box-shadow: 0 0 8px var(--warning); }

.status-label {
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* ---- Main / Landing ---- */
.main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 2rem;
}

.hero {
    display: flex;
    gap: 4rem;
    max-width: 1100px;
    width: 100%;
    align-items: flex-start;
}

.hero-content {
    flex: 1;
}

.hero-title {
    margin-bottom: 1.2rem;
}

.title-line {
    display: block;
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
}
.title-line.accent {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-dim);
    line-height: 1.7;
    max-width: 480px;
    margin-bottom: 2.5rem;
}

/* ---- Project Cards ---- */
.project-select {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.project-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 260px;
}
.project-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}
.project-card.selected {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.project-preview {
    width: 60px;
    height: 60px;
    background: var(--surface);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.project-preview-placeholder {
    font-size: 1.8rem;
}

.project-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.project-info p {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ---- Action Area ---- */
.action-area {
    margin-bottom: 2rem;
}

.btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 2rem;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.btn-launch:hover:not(:disabled) {
    background: #d4b165;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-launch:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-icon {
    font-size: 0.85rem;
}

.action-hint {
    margin-top: 0.8rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* ---- Queue Display ---- */
.queue-display {
    margin-top: 1rem;
}

.queue-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
}

.queue-position {
    text-align: center;
    margin-bottom: 1.5rem;
}
.queue-number {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
    line-height: 1;
}
.queue-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0.3rem;
}

.queue-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.queue-stat {
    text-align: center;
}
.queue-stat .stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--mono);
}
.queue-stat .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.2rem;
}

.queue-progress {
    height: 3px;
    background: var(--surface);
    border-radius: 2px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
    animation: progress-pulse 2s ease-in-out infinite;
}
@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.btn-cancel {
    width: 100%;
    padding: 0.7rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}
.btn-cancel:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ---- Stats Sidebar ---- */
.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 220px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}
.stat-item .stat-value {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--mono);
}
.stat-item .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Stream Screen ---- */
.stream-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
}

.stream-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    height: 44px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 10;
}

.stream-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stream-project {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
}

.stream-controls {
    display: flex;
    gap: 0.5rem;
}
.stream-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.stream-btn:hover {
    border-color: var(--text-dim);
    color: var(--text);
}

.stream-stats {
    display: flex;
    gap: 1rem;
}
.stream-stat {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stream-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    outline: none;
    cursor: crosshair;
}

#streamVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.stream-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    z-index: 5;
}
.overlay-content {
    text-align: center;
}
.overlay-content p {
    margin-top: 1.2rem;
    font-size: 0.95rem;
    color: var(--text-dim);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stream-hints {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.6rem;
    background: rgba(0,0,0,0.6);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.stream-hints span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---- Utilities ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        gap: 2rem;
    }
    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
    }
    .title-line {
        font-size: 2.2rem;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0 1rem;
    }
    .main {
        padding: 1rem;
    }
    .title-line {
        font-size: 1.8rem;
    }
    .hero-subtitle {
        font-size: 0.9rem;
    }
    .queue-info {
        gap: 0.5rem;
    }
    .stream-hints {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .stream-stats {
        display: none;
    }
}
