/* ========================================
   TelePrompt Pro — Design System & Layout
   ======================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #00e5ff;
  --accent-dim: rgba(0, 229, 255, 0.15);
  --accent-gradient: linear-gradient(135deg, #00e5ff, #7c4dff);
  --danger: #ff5252;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Views ---------- */
.view {
  display: none;
  width: 100%;
  height: 100%;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ===========================
   EDITOR VIEW
   =========================== */
.editor-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo .accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
  overflow-y: auto;
  gap: 20px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Script area */
.script-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 180px;
}
#script-input {
  flex: 1;
  resize: none;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition);
}
#script-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}
#script-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Settings panel */
.settings-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-panel h2 {
  margin-bottom: 0;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.setting-group > label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-value {
  min-width: 36px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Range slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-secondary);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px rgba(0,229,255,0.35);
  cursor: grab;
  transition: transform var(--transition);
}
input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 8px rgba(0,229,255,0.35);
  cursor: grab;
}

/* Toggle buttons */
.toggle-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.toggle-btn {
  position: relative;
  width: 48px;
  height: 26px;
  border: none;
  border-radius: 13px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: background var(--transition);
  outline: none;
}
.toggle-btn.active {
  background: var(--accent);
}
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle-btn.active .toggle-knob {
  transform: translateX(22px);
}

/* Start button */
.start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent-gradient);
  color: #0a0e17;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 24px rgba(0,229,255,0.25);
}
.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(0,229,255,0.35);
}
.start-btn:active {
  transform: scale(0.98);
}

/* ===========================
   PROMPTER VIEW
   =========================== */
#prompter-view {
  position: relative;
  background: #000;
  overflow: hidden;
}

/* Guide line */
.guide-line {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.35;
  z-index: 5;
  pointer-events: none;
}

/* Scroll wrapper */
.scroll-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
}
.prompt-text {
  width: 90%;
  max-width: 900px;
  padding-top: 35vh;
  padding-bottom: 100vh;
  font-size: 36px;
  line-height: 1.55;
  font-weight: 500;
  color: #ffffff;
  white-space: pre-wrap;
  word-wrap: break-word;
  transition: color 0.3s ease;
}
.prompt-text.dark-text {
  color: #1a1a1a;
}

/* Countdown overlay */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 20;
}
.countdown-overlay.hidden {
  display: none;
}
.countdown-number {
  font-size: 8rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse 0.6s ease-in-out;
}
@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Control bar — glassmorphism */
.control-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  z-index: 15;
  transition: opacity var(--transition);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.control-bar.faded {
  opacity: 0.15;
  pointer-events: none;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.ctrl-btn:hover {
  background: rgba(255,255,255,0.1);
}
.ctrl-btn:active {
  background: rgba(255,255,255,0.15);
}
.ctrl-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.play-btn {
  width: 46px;
  height: 46px;
  background: var(--accent-gradient);
  color: #0a0e17;
}
.play-btn:hover {
  box-shadow: 0 0 16px rgba(0,229,255,0.4);
  background: var(--accent-gradient);
}

.speed-indicator {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 8px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ===========================
   Scrollbar
   =========================== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

/* ===========================
   Responsive
   =========================== */
@media (min-width: 768px) {
  .editor-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 32px 32px;
  }
  .control-bar {
    gap: 6px;
    padding: 10px 16px;
  }
  .ctrl-btn {
    width: 44px;
    height: 44px;
  }
}
