/* Grises heredados de ModernStyle (desc.py:714-730); el acento violeta se ha
   sustituido por el rojo de YouTube.

   El rojo de marca (#ff0000) se reserva para superficies decorativas —el logo—
   porque el texto blanco sobre él da 4,0:1 de contraste y no llega al 4,5:1 que
   pide WCAG AA. Los botones usan #e60000 (4,8:1), visualmente casi idéntico
   pero legible. */
:root {
  --bg: #0e1116;
  --card: #161b25;
  --field: #1f2633;
  --border: #2a3242;
  --brand: #ff0000;
  --accent: #e60000;
  --accent-hover: #ff1a1a;
  --accent-press: #b80000;
  --text: #eef1f7;
  --dim: #8b94a7;
  --success: #3ddc97;
  --warning: #ffc65c;
  /* Naranja, no rojo: con el acento en rojo, un error rojo se confundiría con
     el botón de acción y perdería su función de aviso. */
  --error: #ff9557;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 16px 64px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 620px; margin: 0 auto; }

/* --- Cabecera ----------------------------------------------------------- */
.header { display: flex; gap: 16px; align-items: center; margin-bottom: 28px; }

.logo {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  /* Rectángulo muy redondeado: la silueta del botón de reproducción de YouTube. */
  border-radius: 14px / 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent-press));
  font-size: 18px; color: #fff;
}

h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
.sub { margin: 2px 0 0; color: var(--dim); font-size: 14px; }
.dim { color: var(--dim); font-size: 13px; }

/* --- Tarjetas ----------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
}

/* --- Formulario --------------------------------------------------------- */
.url-row { display: flex; gap: 8px; }

input[type="url"], select {
  width: 100%;
  padding: 11px 13px;
  background: var(--field);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
}

input[type="url"] { min-width: 0; }
input::placeholder { color: var(--dim); }

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

select {
  appearance: none;
  /* Flecha dibujada en CSS: la CSP no permite recursos externos. */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 480px) {
  .options { grid-template-columns: 1fr; }
}

button, .as-link {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.primary {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  text-decoration: none;
}

.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:active:not(:disabled) { background: var(--accent-press); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }

.ghost {
  padding: 11px 16px;
  background: var(--field);
  color: var(--text);
  border-color: var(--border);
  white-space: nowrap;
}

.ghost:hover { border-color: var(--accent); }
.ghost.wide { display: block; width: 100%; margin-top: 16px; }

.form-error {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(255, 149, 87, 0.1);
  border: 1px solid rgba(255, 149, 87, 0.35);
  color: var(--error);
  font-size: 14px;
}

.turnstile { margin-top: 18px; }

/* --- Job ---------------------------------------------------------------- */
.job-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

#job-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}

.badge[data-state="ready"]   { color: var(--success); border-color: rgba(61, 220, 151, 0.4); }
.badge[data-state="failed"]  { color: var(--error);   border-color: rgba(255, 149, 87, 0.4); }
.badge[data-state="encoding"]{ color: var(--warning); border-color: rgba(255, 198, 92, 0.4); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--field);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
}

.job-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
}

.job-actions { margin-top: 18px; }
.job-actions .primary { margin-top: 0; }
#job-expiry { display: block; margin-top: 10px; text-align: center; }

#auto-note {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(61, 220, 151, 0.1);
  border: 1px solid rgba(61, 220, 151, 0.3);
  color: var(--success);
  font-size: 14px;
  text-align: center;
}

/* --- Publicidad ---------------------------------------------------------- */
/* Cada anuncio es un iframe de nuestro propio origen; el porqué está en
   static/ads.js. Se reserva el alto exacto de cada formato para que el
   contenido no dé un salto cuando el anuncio termina de cargar. */
.ad { margin: 0 0 18px; }
.ad iframe { display: block; margin: 0 auto; border: 0; }

#ad-top { width: 468px; max-width: 100%; height: 60px; }

/* Mismo punto de corte que usa ads.js para elegir el creativo. */
@media (max-width: 620px) {
  #ad-top { width: 320px; height: 50px; }
}

.ad-rect iframe { width: 300px; height: 250px; }

/* Provisional hasta que ads.js mida el contenido real. */
#ad-native { width: 100%; height: 300px; }

/* --- Contenido editorial (SEO) ------------------------------------------ */
.prose h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--dim);
  font-size: 14px;
}

.steps li { margin-bottom: 8px; }
.steps li:last-child { margin-bottom: 0; }
.steps strong { color: var(--text); font-weight: 600; }

.footer { text-align: center; }

.alt-links {
  margin-bottom: 10px;
  font-size: 13px;
}

.alt-links a {
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.alt-links a:hover { color: var(--accent-hover); border-bottom-color: var(--accent); }
