/* =========================================================
   Confronter Wizard Tech - Styles
   Pure black dark mode / Pure white light mode
   ========================================================= */

:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: #111111;
  --bg-input: #0d0d0d;
  --border: #222222;
  --border-focus: #444444;
  --text: #ffffff;
  --text-muted: #888888;
  --text-soft: #cccccc;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f8f8f8;
  --bg-card: #f0f0f0;
  --bg-input: #f5f5f5;
  --border: #e0e0e0;
  --border-focus: #bbbbbb;
  --text: #000000;
  --text-muted: #666666;
  --text-soft: #333333;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-btn.active {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
}

.nav-btn i {
  font-size: 0.95rem;
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

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

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-title i {
  color: var(--accent);
  font-size: 1.15rem;
}

.panel-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ---------- Inputs ---------- */
.input-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.input-wrap input:focus {
  border-color: var(--accent);
}

.input-wrap input::placeholder {
  color: var(--text-muted);
}

.select {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 130px;
}

.select:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
}

.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
}

/* ---------- Type chips ---------- */
.type-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ---------- Status ---------- */
.status {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status.loading {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent);
}

.status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.status.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.status .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- Results ---------- */
.result-grid {
  display: grid;
  gap: 1rem;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.result-card:hover {
  border-color: var(--border-focus);
}

.result-card-body {
  padding: 1.15rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-thumb {
  width: 140px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg);
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 180px;
}

.result-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.result-actions .btn {
  flex: 0 0 auto;
}

/* ---------- Player ---------- */
.player-box {
  margin-top: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.player-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.player-placeholder i {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.player-placeholder p {
  font-size: 0.9rem;
}

#videoPlayer,
#audioPlayer {
  width: 100%;
  max-height: 480px;
  outline: none;
}

#audioPlayer {
  padding: 2rem;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-inner a {
  color: var(--text-muted);
}

.footer-inner a:hover {
  color: var(--accent);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 999;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: stretch;
  }

  .nav-btn {
    flex: 1;
    justify-content: center;
    padding: 0.55rem 0.4rem;
  }

  .nav-btn span {
    display: none;
  }

  .panel {
    padding: 1.25rem;
  }

  .result-card-body {
    flex-direction: column;
  }

  .result-thumb {
    width: 100%;
    height: 160px;
  }
}

@media (max-width: 480px) {
  .input-row {
    flex-direction: column;
  }

  .select {
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}

/* ---------- Age gate / Adult ---------- */
.age-gate {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-align: center;
}

.age-gate-text {
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.age-gate-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.nav-btn[data-view="adult"].active {
  border-color: var(--danger);
  color: var(--danger);
}

.tabs-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.ai-out {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.55;
  max-height: 420px;
  overflow-y: auto;
  color: var(--text-soft);
}

.nav-btn .fab { font-size: 0.95rem; }
.result-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, #111);
  color: var(--muted, #666);
  min-height: 120px;
  font-size: 2rem;
}

.yt-detail-card { margin-top: 0.5rem; }
.yt-detail-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm, 10px);
  margin-bottom: 0.75rem;
}
.yt-detail-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.yt-detail-meta {
  font-size: 0.85rem;
  color: var(--muted, #888);
  margin-bottom: 0.75rem;
}
.yt-preview-box audio,
.yt-preview-box video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}
.format-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.format-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 0.5rem;
  border-radius: 12px;
  border: 2px solid var(--border, #333);
  background: var(--surface, #111);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.format-btn i { font-size: 1.4rem; color: var(--accent, #3b82f6); }
.format-btn small { color: var(--muted, #888); font-size: 0.75rem; }
.format-btn.active {
  border-color: var(--accent, #3b82f6);
  background: color-mix(in srgb, var(--accent, #3b82f6) 12%, transparent);
}

/* Category rail */
.cat-rail {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border, #222);
  background: var(--bg, #000);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 20;
}
.cat-rail::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 4.2rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border, #333);
  border-radius: 12px;
  background: var(--surface, #0a0a0a);
  color: var(--muted, #999);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}
.cat i { font-size: 1.15rem; }
.cat.active {
  color: #fff;
  border-color: var(--accent, #3b82f6);
  background: color-mix(in srgb, var(--accent, #3b82f6) 18%, transparent);
}
.cat.active i { color: var(--accent, #3b82f6); }
[data-theme="light"] .cat.active { color: #111; }

.yt-red { color: #ff0000 !important; }
.spotify-green { color: #1db954 !important; }
.fb-blue { color: #1877f2 !important; }
.ig-grad { color: #e1306c !important; }

.panel-head { margin-bottom: 0.75rem; }
.format-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted, #888);
}
.back-btn { margin-bottom: 0.75rem; }

.header { position: relative; z-index: 30; }
