/* =============================================================
 * YouTube Filter — style.css
 * Phase 5: UI Polish (T17)
 * ============================================================= */

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #e8e8e8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 2.5rem;
  gap: 1.25rem;
}

h1 {
  font-size: 1.4rem;
  color: #ff4444;
  letter-spacing: 0.03em;
}

/* ── URL input row ──────────────────────────────────────────── */
#url-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 800px;
}

#url-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #e8e8e8;
  font-size: 0.95rem;
}
#url-input:focus { outline: 2px solid #ff4444; border-color: transparent; }

#load-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  border: none;
  background: #ff4444;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  white-space: nowrap;
}
#load-btn:hover { background: #e03333; }

/* ── Player ─────────────────────────────────────────────────── */
#player-wrapper {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
#player { width: 100%; height: 100%; }

/* ── Status banner (T15) ─────────────────────────────────────── */
#status {
  width: 100%;
  max-width: 800px;
  min-height: 2.75rem;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #bbb;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* State variants */
#status.state-muting  { background: #2a1515; border-color: #ff4444; color: #ff9999; }
#status.state-skipped { background: #15152a; border-color: #5577ff; color: #99aaff; }
#status.state-idle    { background: #141a14; border-color: #448844; color: #88cc88; }
#status.state-warn    { background: #221e10; border-color: #aa8833; color: #ddbb66; }
#status.state-error   { background: #2a1515; border-color: #ff4444; color: #ff9999; }

/* Flash animation for new events */
@keyframes statusFlash {
  0%   { opacity: 0.35; transform: translateY(-3px); }
  100% { opacity: 1;    transform: translateY(0); }
}
#status.flash { animation: statusFlash 0.28s ease forwards; }

/* ── Controls panel ─────────────────────────────────────────── */
#controls {
  width: 100%;
  max-width: 800px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1rem;
}
#controls h2 {
  font-size: 0.95rem;
  color: #aaa;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Mode toggle (T14) ──────────────────────────────────────── */
#mode-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #272727;
}
#mode-toggle .toggle-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.2rem;
}
.mode-btn {
  padding: 0.4rem 1.1rem;
  border: 1px solid #444;
  border-radius: 5px;
  background: #1e1e1e;
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mode-btn:hover { border-color: #666; color: #ccc; }
.mode-btn.active {
  background: #ff4444;
  border-color: #ff4444;
  color: #fff;
}

/* ── Word list grid (moved from wordlists.js injectStyles) ─── */
.wl-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.wl-presets-label { color: #888; font-size: 0.8rem; margin-right: 0.25rem; }
.wl-spacer { flex: 1; }

.wl-btn {
  padding: 0.35rem 0.7rem;
  border: none;
  border-radius: 5px;
  background: #ff4444;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.wl-btn:hover { background: #e03333; }
.wl-ghost { background: #2a2a2a; color: #ccc; }
.wl-ghost:hover { background: #3a3a3a; }

.wl-grid {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0.5rem;
  background: #141414;
}
.wl-group + .wl-group { margin-top: 0.75rem; }
.wl-group-title {
  font-size: 0.8rem;
  color: #ff7777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.wl-count { color: #666; }
.wl-words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.2rem 0.5rem;
}
.wl-word {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #ddd;
  cursor: pointer;
  padding: 0.1rem 0;
}
.wl-word input { accent-color: #ff4444; cursor: pointer; }

.wl-custom { margin-top: 0.9rem; }
.wl-custom-label { display: block; font-size: 0.8rem; color: #888; margin-bottom: 0.35rem; }
.wl-custom-row { display: flex; gap: 0.5rem; }
.wl-custom-row input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border-radius: 5px;
  border: 1px solid #444;
  background: #1e1e1e;
  color: #e8e8e8;
  font-size: 0.9rem;
}
.wl-custom-row input:focus { outline: 2px solid #ff4444; border-color: transparent; }

.wl-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.wl-chips-empty { color: #555; font-size: 0.8rem; }
.wl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 14px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  color: #eee;
}
.wl-chip-x {
  background: none;
  border: none;
  color: #ff7777;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.wl-chip-x:hover { color: #ff4444; }

/* ── Event log (T16) ────────────────────────────────────────── */
#event-log {
  width: 100%;
  max-width: 800px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
}
#event-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: #141414;
  border-bottom: 1px solid #272727;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #777;
}
#event-log-count {
  font-weight: 700;
  color: #ff7777;
}
#event-log-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  padding: 0;
}
#event-log-list li {
  display: flex;
  gap: 0.6rem;
  padding: 0.42rem 1rem;
  font-size: 0.82rem;
  color: #ccc;
  border-bottom: 1px solid #1f1f1f;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
#event-log-list li:last-child { border-bottom: none; }
#event-log-list li.log-empty { color: #555; font-family: system-ui, sans-serif; justify-content: center; padding: 0.65rem 1rem; }

.log-time   { color: #666; min-width: 3.2rem; }
.log-action { min-width: 5.5rem; font-weight: 600; }
.log-action.muted   { color: #ff9999; }
.log-action.skipped { color: #99aaff; }
.log-word   { color: #e8e8e8; }

/* ── Mobile (< 600px) ───────────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 1rem 0.75rem 2rem; gap: 0.9rem; }
  h1   { font-size: 1.2rem; }

  #url-row    { flex-direction: column; }
  #load-btn   { width: 100%; }

  #mode-toggle { flex-wrap: wrap; }

  .wl-presets { gap: 0.3rem; }
  .wl-words   { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

  #event-log-list { max-height: 160px; }
}
