/* ═══════════════════════════════════════════════════════════════
   Coliseum Operator — Premium Dark Theme
   Gold, bronze, marble & obsidian
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-secondary: #111113;
  --bg-card: rgba(18, 18, 22, 0.9);
  --bg-input: rgba(12, 12, 15, 0.9);
  --border-color: rgba(160, 130, 80, 0.12);
  --border-color-hover: rgba(190, 155, 95, 0.25);
  --text-primary: #e8e4dd;
  --text-secondary: #a8a098;
  --text-muted: #5e574d;
  --accent-primary: #c9a84c;
  --accent-primary-light: #dbbe68;
  --accent-primary-glow: rgba(201, 168, 76, 0.2);
  --accent-success: #4ade80;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Theme ────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f5f3ef;
  --bg-secondary: #eae6df;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-input: rgba(240, 237, 230, 0.9);
  --border-color: rgba(120, 100, 60, 0.15);
  --border-color-hover: rgba(140, 115, 70, 0.3);
  --text-primary: #1a1a1a;
  --text-secondary: #555040;
  --text-muted: #8a8070;
  --accent-primary: #8b6914;
  --accent-primary-light: #a67d1a;
  --accent-primary-glow: rgba(139, 105, 20, 0.15);
  --accent-success: #4a7a2e;
  --accent-danger: #b33d2f;
  --accent-warning: #b07830;
}

/* ── Gold Theme ─────────────────────────────────────────────── */
[data-theme="gold"] {
  --bg-primary: #1a1612;
  --bg-secondary: #231e18;
  --bg-card: rgba(30, 25, 18, 0.9);
  --bg-input: rgba(18, 15, 10, 0.85);
  --border-color: rgba(200, 165, 80, 0.2);
  --border-color-hover: rgba(220, 185, 100, 0.35);
  --text-primary: #f0e8d8;
  --text-secondary: #c8b898;
  --text-muted: #8a7a60;
  --accent-primary: #e8c44a;
  --accent-primary-light: #f0d060;
  --accent-primary-glow: rgba(232, 196, 74, 0.3);
  --accent-success: #8ab85a;
  --accent-danger: #c04030;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* Subtle gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(201, 168, 76, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Login Screen ───────────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.login-ambient {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(201, 168, 76, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.05),
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  margin-bottom: 4px;
  color: var(--accent-primary);
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.2);
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
}

.code-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.code-char {
  width: 48px;
  height: 56px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  transition: all var(--transition-fast);
}

.code-char:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow), 0 0 20px rgba(201, 168, 76, 0.1);
  background: rgba(201, 168, 76, 0.05);
}

.login-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #f87171;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  animation: shake 0.4s ease;
}

.login-error.show { display: block; }

.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #8B6914 100%);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.5px;
}

.login-btn:hover:not(:disabled) {
  box-shadow: 0 4px 20px var(--accent-primary-glow);
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.login-btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Workspace Layout ───────────────────────────────────────── */
.workspace {
  display: none;
  height: 100vh;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.workspace.active { display: flex; }

/* Header */
.ws-header {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 48px;
  background: rgba(9, 9, 11, 0.95);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

.ws-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 14px;
  color: var(--accent-primary);
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
}

.ws-device-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ws-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
  animation: pulse-dot 2s infinite;
}

.ws-status-dot.offline {
  background: var(--text-muted);
  box-shadow: none;
  animation: none;
}

.ws-device-name { font-weight: 600; color: var(--text-primary); }

.ws-metrics {
  margin-left: auto;
  display: flex;
  gap: 20px;
}

.ws-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.ws-metric-value {
  font-size: 12px;
  color: var(--accent-primary-light);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

/* Main workspace area — two panel layout */
.ws-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Phone panel (left, narrow) */
.ws-phone-panel {
  display: flex;
  flex-direction: column;
  width: 260px;
  min-width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

/* Phone screen */
.screen-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}

.phone-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.1),
    0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: none;
  object-fit: contain;
  display: none;
  transition: opacity 0.3s ease;
}

/* VDO.ninja panel (right, wide) */
.ws-vdo-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vdo-iframe-container {
  flex: 1;
  position: relative;
}

.vdo-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.screen-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.screen-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.screen-placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}

.screen-placeholder-text {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 500;
}

.screen-placeholder-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.6;
}

/* Phone controls — bottom bar */
.phone-controls {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.phone-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.phone-btn:hover {
  background: rgba(201, 168, 76, 0.1);
  color: var(--accent-primary);
  border-color: rgba(201, 168, 76, 0.25);
  transform: translateY(-1px);
}

.phone-btn:active {
  transform: scale(0.92) translateY(0);
}

.phone-btn.power-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.phone-btn-sep {
  width: 1px;
  background: var(--border-color);
  margin: 4px 4px;
}

/* ── Status Bar ─────────────────────────────────────────────── */
.ws-statusbar {
  display: flex;
  padding: 0 20px;
  height: 28px;
  align-items: center;
  background: rgba(9, 9, 11, 0.95);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  gap: 24px;
  flex-shrink: 0;
}

.ws-statusbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ws-statusbar-label {
  opacity: 0.6;
  font-weight: 400;
}

.ws-statusbar-value {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

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

.loading-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Touch Indicator ───────────────────────────────────────── */
.touch-indicator {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.3);
  border: 2px solid rgba(201, 168, 76, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: touchRipple 0.5s ease-out forwards;
}

@keyframes touchRipple {
  from { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(160, 130, 80, 0.15); border-radius: 2px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ws-metrics { display: none; }
  .ws-header { padding: 0 12px; }
  .phone-controls { padding: 6px 12px; }
  .phone-btn { width: 36px; height: 36px; }
  .login-card { padding: 32px 24px; margin: 16px; }
  .code-char { width: 42px; height: 48px; font-size: 18px; }
}

/* ── Room Name (copy on click) ───────────────────────────── */
.ws-room-name {
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
}

.ws-room-name:hover {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}

.ws-room-name:active {
  transform: scale(0.97);
}

.ws-copy-hint {
  display: none;
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

.ws-copy-hint.show {
  display: block;
  animation: fadeInOut 1.5s ease forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateX(-50%) translateY(4px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Theme Toggle (operator header) ──────────────────────── */
.ws-theme-toggle {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-left: 12px;
}

.ws-theme-btn {
  width: 28px;
  height: 24px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-theme-btn:hover {
  color: var(--text-primary);
  background: rgba(201, 168, 76, 0.08);
}

.ws-theme-btn.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
}
