/* ============================================
   NOVARENDER - GPU Benchmark Styles
   Full-screen WebGL with overlay UI
   ============================================ */

:root {
  --bg: #07071a;
  --text: #f5f5f5;
  --muted: #a0a0b8;
  --accent: #6c63ff;
  --accent-2: #ff6584;
  --accent-3: #43e97b;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.09);
  --radius: 16px;
  --tr: 0.25s ease;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ============================================
   WEBGL CANVAS
   ============================================ */
#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#glCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================
   HEADER / BACK BUTTON
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(7,7,26,0.9) 0%, transparent 100%);
  pointer-events: none;
}

.header > * {
  pointer-events: auto;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--tr);
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: rgba(108, 99, 255, 0.15);
  border-color: var(--accent);
}

.title-badge {
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
  backdrop-filter: blur(10px);
}

/* ============================================
   STATS PANEL (Top Left)
   ============================================ */
.stats-panel {
  position: fixed;
  top: 80px;
  left: 24px;
  width: 220px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  z-index: 50;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Fira Code', monospace;
}

.stat-value.fps-high { color: var(--accent-3); }
.stat-value.fps-med { color: #f59e0b; }
.stat-value.fps-low { color: var(--accent-2); }

/* Performance Bar */
.perf-bar {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.perf-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.perf-indicator {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}

.perf-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.perf-fill.high { background: var(--accent-3); }
.perf-fill.medium { background: #f59e0b; }
.perf-fill.low { background: var(--accent-2); }

/* ============================================
   CONTROLS PANEL (Bottom Center)
   ============================================ */
.controls-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 50;
}

.main-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: 50px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
}

.btn-secondary.active {
  background: rgba(108, 99, 255, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

/* Quality Toggle */
.quality-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 50px;
  background: rgba(255,255,255,0.05);
}

.quality-btn {
  padding: 6px 14px;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  font-family: inherit;
}

.quality-btn:hover {
  color: var(--text);
}

.quality-btn.active {
  background: rgba(108, 99, 255, 0.2);
  color: var(--accent);
}

/* Stress Mode Toggle */
.stress-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 50px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  transition: all var(--tr);
}

.stress-toggle:hover {
  background: rgba(255,255,255,0.08);
}

.stress-toggle.active {
  background: rgba(255, 101, 132, 0.15);
}

.stress-toggle span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.stress-toggle.active span {
  color: var(--accent-2);
}

.toggle-switch {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255,255,255,0.2);
  position: relative;
  transition: background var(--tr);
}

.stress-toggle.active .toggle-switch {
  background: var(--accent-2);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--tr);
}

.stress-toggle.active .toggle-switch::after {
  transform: translateX(18px);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(108, 99, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ============================================
   ERROR OVERLAY (WebGL Unsupported)
   ============================================ */
.error-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 24px;
  text-align: center;
}

.error-overlay.visible {
  display: flex;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.error-message {
  color: var(--muted);
  max-width: 400px;
  line-height: 1.6;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .stats-panel {
    top: 70px;
    left: 12px;
    right: 12px;
    width: auto;
    padding: 16px;
  }
  
  .controls-panel {
    bottom: 12px;
    left: 12px;
    right: 12px;
    transform: none;
  }
  
  .main-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .header {
    padding: 12px 16px;
  }
  
  .title-badge {
    display: none;
  }
}

@media (max-width: 480px) {
  .quality-btn {
    padding: 6px 10px;
    font-size: 0.7rem;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
}
