/* ═══════════════════════════════════════════════════════════
   style.css — YouTube Downloader UI
   Dark industrial theme with accent red/orange
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:      #0d0d0f;
  --bg-surface:   #141417;
  --bg-card:      #1a1a1f;
  --bg-input:     #111115;
  --border:       #2a2a32;
  --border-focus: #ff4e1a;

  --accent:       #ff4e1a;
  --accent-dim:   rgba(255, 78, 26, 0.15);
  --accent-glow:  rgba(255, 78, 26, 0.35);
  --accent-2:     #ff8c42;

  --text-primary:   #f0eef8;
  --text-secondary: #8a8a9a;
  --text-muted:     #55555f;

  --success: #22c55e;
  --error:   #ef4444;
  --warning: #f59e0b;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-display: 'Space Mono', monospace;
  --font-body:    'DM Sans', sans-serif;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --transition:  all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 60px;
  position: relative;
  overflow-x: hidden;
}

/* ── Background grid pattern ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,78,26,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,78,26,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(255,78,26,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout wrapper ───────────────────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  text-align: center;
  margin-bottom: 36px;
  margin-top: 20px;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.app-logo svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.app-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.app-title span { color: var(--accent); }

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

/* ── Disclaimer banner ───────────────────────────────────── */
.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--warning);
  line-height: 1.5;
}

.disclaimer svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.9;
}

/* ── Login form ───────────────────────────────────────────── */
.login-card {
  max-width: 400px;
  margin: 40px auto 0;
}

.login-icon {
  text-align: center;
  margin-bottom: 20px;
}

.login-icon svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

/* ── Form elements ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

input[type="password"],
input[type="url"],
input[type="text"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 16px;
  outline: none;
  transition: var(--transition);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-2);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

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

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

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-success {
  background: var(--success);
  color: #fff;
  width: 100%;
}

.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  transform: translateY(-1px);
}

/* ── Section title ────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── URL input row ────────────────────────────────────────── */
.url-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.url-row .form-group { flex: 1; margin-bottom: 0; }

.paste-btn {
  height: 46px;
  padding: 0 14px;
  flex-shrink: 0;
  font-size: 0.8rem;
}

/* ── Video info card ─────────────────────────────────────── */
.video-info {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.video-thumb {
  width: 100px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.video-details { flex: 1; min-width: 0; }

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.video-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Format options ───────────────────────────────────────── */
.formats-grid {
  display: grid;
  gap: 8px;
}

.format-option {
  position: relative;
}

.format-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.format-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.92rem;
}

.format-label:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.format-option input[type="radio"]:checked + .format-label {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.format-radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.format-option input[type="radio"]:checked + .format-label .format-radio-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.format-option input[type="radio"]:checked + .format-label .format-radio-dot::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.format-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-family: var(--font-display);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-video { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.badge-audio { background: rgba(34, 197, 94, 0.12); color: #4ade80; }

/* ── Progress / status ────────────────────────────────────── */
.progress-wrap {
  margin-top: 8px;
}

.progress-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

.status-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Alert messages ───────────────────────────────────────── */
.alert {
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-error   { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.25); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.25); color: #86efac; }
.alert-info    { background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.25); color: #a5b4fc; }

/* ── Result download section ─────────────────────────────── */
.result-card {
  text-align: center;
}

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.result-icon svg { width: 26px; height: 26px; color: var(--success); }

.result-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

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

.result-filename {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  word-break: break-all;
  text-align: left;
}

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

.btn-row .btn { flex: 1; }

/* ── Logout link ──────────────────────────────────────────── */
.app-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

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

/* ── Hidden utility ───────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Fade-in animation ────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.4s ease both; }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ── Mobile responsiveness ────────────────────────────────── */
@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .url-row { flex-direction: column; }
  .paste-btn { width: 100%; height: 42px; }
  .video-info { flex-direction: column; }
  .video-thumb { width: 100%; height: 130px; }
  .btn-row { flex-direction: column; }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
