/* ============================================
   HLS VIDEO PLAYER — style.css
   ============================================ */

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

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --card:      #1a1a1a;
  --border:    rgba(255,255,255,0.08);
  --accent:    #FF6B35;
  --accent-dk: #d9561f;
  --text:      #f0f0f0;
  --muted:     rgba(255,255,255,0.45);
  --radius:    14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

/* ---- Page Layout ---- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Player Card ---- */
.player-card {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ---- Big Play Overlay ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s;
}

.big-play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.2s, transform 0.15s;
}

.big-play:hover {
  background: rgba(255,255,255,0.22);
  transform: scale(1.06);
}

.big-play svg {
  margin-left: 4px;
}

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

/* ---- Spinner ---- */
.spinner-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.spinner-wrap.visible { opacity: 1; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ---- Controls ---- */
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
  padding: 40px 14px 12px;
  opacity: 1;
  transition: opacity 0.35s;
}

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

/* Progress Bar */
.progress-wrap {
  margin-bottom: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.progress-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: visible;
}

.progress-bar:hover .progress-thumb { opacity: 1; }

.progress-buffer {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}

.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
  transition: width 0.1s linear;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  left: 0%;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

/* Control Row */
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

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

/* Buttons */
.ctrl-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.ctrl-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.ctrl-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Volume */
.vol-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}

.vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

/* Time */
.time-display {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
  user-select: none;
}

/* Quality Select */
.quality-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.quality-select:hover { border-color: rgba(255,255,255,0.4); }
.quality-select option { background: #1a1a1a; color: #fff; }

/* ---- URL Section ---- */
.url-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.url-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
}

.url-row {
  display: flex;
  gap: 10px;
}

.url-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

.url-input::placeholder { color: rgba(255,255,255,0.25); }
.url-input:focus { border-color: var(--accent); }

.load-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.load-btn:hover { background: var(--accent-dk); }
.load-btn:active { transform: scale(0.97); }

.url-hint {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  line-height: 1.5;
}

/* ---- Status Bar ---- */
.status-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  flex-shrink: 0;
  transition: background 0.3s;
}

.status-dot.idle    { background: #555; }
.status-dot.loading { background: #f59e0b; animation: pulse 1s ease infinite; }
.status-dot.active  { background: #22c55e; box-shadow: 0 0 8px #22c55e88; }
.status-dot.error   { background: #ef4444; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }

.status-text {
  font-size: 13px;
  color: var(--muted);
}

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .main { padding: 16px 12px 32px; gap: 14px; }
  .vol-slider { width: 50px; }
  .url-row { flex-direction: column; }
  .load-btn { width: 100%; }
  .time-display { font-size: 11px; }
}
