/* ═══════════════════════════════════════════════════
   STREAMPROXY — "Digital Obsidian" Design System
   Stitch-generated tokens • Minimalist & Classy
   ═══════════════════════════════════════════════════ */

/* ─── Design Tokens (Stitch: StreamProxy Kinetic) ── */
:root {
  /* Surface hierarchy — layers of smoked glass */
  --surface:                #0e0e10;
  --surface-dim:            #0e0e10;
  --surface-container-lowest: #000000;
  --surface-container-low:  #131316;
  --surface-container:      #19191d;
  --surface-container-high: #1f1f24;
  --surface-container-highest: #25252b;
  --surface-bright:         #2b2c32;

  /* Primary — Indigo accent */
  --primary:          #bdc2ff;
  --primary-container: #2f3aa3;
  --primary-dim:      #acb3ff;

  /* Text */
  --on-surface:         #e7e4ec;
  --on-surface-variant: #acaab1;
  --outline:            #75757c;
  --outline-variant:    #47474e;

  /* Status */
  --success:  #34d399;
  --warning:  #fbbf24;
  --error:    #ec7c8a;

  /* Typography */
  --font: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  line-height: 1.6;
}

::selection {
  background: rgba(189, 194, 255, 0.2);
}

/* ─── App Shell ─────────────────────────────────── */
.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  animation: fadeIn 0.5s var(--ease) both;
}

.wordmark {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  opacity: 0.7;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-led.loading {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
  animation: blink 1.2s ease-in-out infinite;
}

.status-led.streaming {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

.status-led.error {
  background: var(--error);
  box-shadow: 0 0 6px var(--error);
  animation: none;
}

.status-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

/* ─── Main ──────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10vh;
  gap: 48px;
}

/* ─── Hero ──────────────────────────────────────── */
.hero {
  text-align: center;
  width: 100%;
  animation: fadeUp 0.6s 0.1s var(--ease) both;
}

.hero-heading {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--on-surface);
  margin-bottom: 12px;
}

.hero-sub {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 40px;
}

/* ─── Input Bar ─────────────────────────────────── */
.input-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface-container-low);
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  padding: 4px 4px 4px 16px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
  animation: fadeUp 0.6s 0.2s var(--ease) both;
}

.input-bar:focus-within {
  border-color: rgba(189, 194, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(189, 194, 255, 0.06);
}

.input-icon {
  flex-shrink: 0;
  color: var(--outline);
  opacity: 0.5;
}

.url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 400;
  padding: 12px 12px;
  min-width: 0;
}

.url-input::placeholder {
  color: var(--outline);
}

.play-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 200ms var(--ease), transform 150ms var(--ease);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.play-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.play-btn:active {
  transform: translateY(0);
}

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

/* ─── Loader ────────────────────────────────────── */
.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  animation: fadeIn 0.3s var(--ease);
}

.loader.active {
  display: flex;
}

.loader-bar {
  width: 120px;
  height: 2px;
  background: var(--surface-container-high);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.loader-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: var(--primary);
  border-radius: 1px;
  animation: slide 1s var(--ease) infinite;
}

.loader-text {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--on-surface-variant);
  letter-spacing: 0.02em;
}

/* ─── Player ────────────────────────────────────── */
.player-wrap {
  width: 100%;
  animation: fadeUp 0.4s var(--ease) both;
}

.player-wrap.hidden {
  display: none;
}

.video-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.video-title {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.video-tags {
  display: flex;
  gap: 6px;
}

.tag {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.icon-btn:hover {
  background: var(--surface-bright);
  color: var(--on-surface);
}

.video-container {
  background: var(--surface-container-lowest);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.video-container video {
  display: block;
  width: 100%;
  max-height: 500px;
  background: #000;
  outline: none;
}

/* ─── Error ─────────────────────────────────────── */
.error-box {
  text-align: center;
  padding: 24px;
  animation: fadeIn 0.4s var(--ease) both;
}

.error-box.hidden {
  display: none;
}

.error-msg {
  font-size: 0.82rem;
  color: var(--error);
  margin-bottom: 16px;
  line-height: 1.5;
}

.ghost-btn {
  padding: 8px 20px;
  background: transparent;
  color: var(--on-surface-variant);
  border: 1px solid rgba(71, 71, 78, 0.3);
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms var(--ease), border-color 150ms var(--ease);
}

.ghost-btn:hover {
  color: var(--on-surface);
  border-color: rgba(71, 71, 78, 0.6);
}

/* ─── Feature Cards ─────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  animation: fadeUp 0.6s 0.3s var(--ease) both;
}

.feature-card {
  background: var(--surface-container-low);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: background 200ms var(--ease);
}

.feature-card:hover {
  background: var(--surface-container);
}

.feature-icon {
  color: var(--primary-dim);
  margin-bottom: 14px;
  opacity: 0.7;
}

.feature-card h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--on-surface);
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--on-surface-variant);
  line-height: 1.5;
}

/* ─── Footer ────────────────────────────────────── */
.footer {
  padding: 32px 0;
  text-align: center;
}

.footer-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--outline);
  opacity: 0.5;
}

/* ─── Animations ────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* ─── Responsive ────────────────────────────────── */
@media (max-width: 640px) {
  .app {
    padding: 0 16px;
  }

  .main {
    padding-top: 6vh;
    gap: 32px;
  }

  .hero-heading {
    font-size: 1.7rem;
  }

  .hero-sub {
    font-size: 0.82rem;
    margin-bottom: 28px;
  }

  .input-bar {
    flex-wrap: wrap;
    padding: 4px;
  }

  .input-icon {
    display: none;
  }

  .url-input {
    padding: 12px;
    font-size: 0.85rem;
  }

  .play-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .video-title {
    max-width: 180px;
    font-size: 0.78rem;
  }
}

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 2px; }
