/*
 * style.css
 * Visuell stil for "Hvordan GPS Virker"
 * Blueprint- og skissebok-estetikk, rolig flyt, glassmorfisme og fullskjerm-opplevelse.
 */

:root {
  --bg-dark: #090d16;
  --bg-panel: rgba(15, 23, 42, 0.88);
  --bg-panel-hover: rgba(30, 41, 59, 0.95);
  --border-color: rgba(56, 189, 248, 0.22);
  --border-glow: rgba(56, 189, 248, 0.45);

  --accent-cyan: #38bdf8;
  --accent-gold: #fbbf24;
  --accent-pink: #f472b6;
  --accent-green: #34d399;
  --accent-red: #ef4444;
  --accent-purple: #c084fc;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "Fira Code", "Courier New", monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-sans);
  color: var(--text-main);
  line-height: 1.5;
}

/* Hovedapp-beholder */
#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Lerretsvisninger */
.viewport-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#view-2d {
  z-index: 1;
  background: radial-gradient(circle at 50% 30%, #111a2e 0%, #080c14 100%);
}

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

#view-3d {
  z-index: 2;
  display: none;
  background: radial-gradient(circle at 50% 50%, #0d1527 0%, #060910 100%);
}

/* Elegant topplinje */
#top-header {
  position: absolute;
  top: 18px;
  left: 28px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.title-group h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #ffffff 0%, #38bdf8 65%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.fancy-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.fancy-subtitle::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulseDot 2.2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Modusvelger (Film vs Utforsk) */
.mode-toggle-group {
  margin-top: 6px;
  display: inline-flex;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3px;
  backdrop-filter: blur(8px);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-btn.active {
  background: var(--accent-cyan);
  color: #090d16;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Interaktiv verktøylinje */
#interactive-toolbar {
  position: absolute;
  top: 96px;
  left: 28px;
  z-index: 10;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 18px;
  display: none;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  max-width: 320px;
}

.toolbar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toolbar-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.toolbar-val {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: bold;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Fortellerpanel på høyre side (smyger seg inn/ut) */
#narrative-panel {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 440px;
  max-height: calc(100vh - 140px);
  z-index: 20;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 22px 26px;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  user-select: text;
}

#narrative-panel.collapsed {
  transform: translateX(470px);
  opacity: 0;
  pointer-events: none;
}

#toggle-narrative-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 25;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

#toggle-narrative-btn:hover {
  background: var(--accent-cyan);
  color: #090d16;
}

.narrative-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding-bottom: 10px;
}

#chapter-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

#chapter-subtitle {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.narrative-content {
  font-size: 0.92rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.narrative-content h3 {
  font-size: 1.05rem;
  color: #f1f5f9;
  margin-top: 4px;
}

.narrative-content h4 {
  font-size: 0.95rem;
  color: var(--accent-gold);
  margin-top: 6px;
}

.narrative-content p.lead {
  font-size: 0.96rem;
  color: #f8fafc;
  line-height: 1.6;
}

.narrative-content ul, .narrative-content ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.narrative-content li strong {
  color: var(--accent-cyan);
}

/* Formel- og fremhevingsbokser */
.formula-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.formula-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.formula-math {
  font-family: var(--font-mono);
  color: #ffffff;
  font-size: 0.98rem;
  padding: 4px 0;
  text-align: center;
}

.formula-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.step-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.86rem;
}

.step-card.highlight {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
  border-left: 4px solid var(--accent-gold);
}

.tip-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #bae6fd;
}

/* Videoavspiller-kontroll nederst i midten */
#player-dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 90%;
  max-width: 780px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 36px;
  padding: 10px 22px;
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Skrubbelinje med kapittelmerker */
.scrubber-container {
  position: relative;
  width: 100%;
  height: 18px;
  display: flex;
  align-items: center;
}

#timeline-scrubber {
  width: 100%;
  cursor: pointer;
  z-index: 2;
  height: 6px;
  background: rgba(148, 163, 184, 0.28);
}

#timeline-scrubber::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px var(--accent-cyan);
}

#chapter-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.chapter-tick {
  position: absolute;
  top: 5px;
  width: 2px;
  height: 8px;
  background: rgba(255, 255, 255, 0.65);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.chapter-tick:hover {
  transform: scaleY(1.6);
  background: var(--accent-gold);
}

/* Kontrollknapper */
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.controls-left, .controls-center, .controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dock-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.dock-btn:hover {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  transform: scale(1.08);
}

.play-pause-btn {
  background: var(--accent-cyan);
  color: #090d16;
  width: 38px;
  height: 38px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

.play-pause-btn:hover {
  background: #7dd3fc;
  color: #090d16;
  transform: scale(1.12);
}

#time-display {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 95px;
}

.speed-badge {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-badge:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Kilde / Referanse i liten footer nederst til høyre */
#footer-reference {
  position: absolute;
  bottom: 12px;
  right: 28px;
  z-index: 15;
  font-size: 0.76rem;
  color: rgba(148, 163, 184, 0.65);
  font-family: var(--font-mono);
}

#footer-reference a {
  color: rgba(56, 189, 248, 0.85);
  text-decoration: none;
  transition: color 0.2s ease;
}

#footer-reference a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

/* Responsiv tilpasning */
@media (max-width: 980px) {
  #narrative-panel {
    width: 340px;
    right: 14px;
    padding: 16px 18px;
  }
  #top-header {
    left: 14px;
  }
  #player-dock {
    width: 95%;
    bottom: 14px;
    padding: 8px 16px;
  }
}
