/* ============================================================
   SlideDownloader · Interfaz moderna
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #2563eb;
  --radius-xl: 26px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-card: 0 32px 80px -24px rgba(15, 23, 42, 0.32), 0 12px 32px -18px rgba(15, 23, 42, 0.18);
  --shadow-soft: 0 4px 14px -8px rgba(15, 23, 42, 0.24);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
}

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

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

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -120px, rgba(37, 99, 235, 0.08), transparent 70%),
    #f1f5f9;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* ============================================================
   Banner / Hero · estilo universitario
   ============================================================ */

/* Barra superior */
.toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(10, 22, 39, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

main {
  padding-top: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
}

.brand:focus-visible {
  outline: 2px solid #e7cf8a;
  outline-offset: 4px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  filter: drop-shadow(0 8px 16px rgba(8, 20, 36, 0.45));
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-name span {
  color: #e7cf8a;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 600;
  color: #d8e2ee;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.topbar-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(231, 207, 138, 0.5);
}

.topbar-pill--ghost {
  background: transparent;
}

.topbar-pill .icon {
  width: 14px;
  height: 14px;
  color: #e7cf8a;
}

/* Contenido del hero */
.hero {
  max-width: 780px;
  margin-top: 32px;
}

.hero--home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 40px;
  align-items: center;
  max-width: none;
  margin-top: 22px;
}

.hero-copy-block {
  max-width: 660px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  margin-bottom: 13px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f0dfa8;
  background: rgba(200, 169, 81, 0.12);
  border: 1px solid rgba(200, 169, 81, 0.38);
  border-radius: 999px;
}

.eyebrow .icon {
  width: 14px;
  height: 14px;
  color: #e7cf8a;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(29px, 4.4vw, 40px);
  font-weight: 760;
  line-height: 1.09;
  letter-spacing: -0.035em;
  color: #f8fafc;
}

.hero--home h1 {
  max-width: 700px;
  font-family: var(--font-display);
  font-size: clamp(28px, 2.7vw, 33px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: #f8fafc;
  text-wrap: balance;
}

.text-gradient {
  background: linear-gradient(100deg, #f4e6b7 0%, #dfc06a 48%, #f1e0a4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 560px;
  margin-top: 12px;
  font-size: 14.5px;
  line-height: 1.6;
  color: #c3cfde;
}

.hero-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  list-style: none;
}

.hero-perks li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 550;
  color: #dbe3ec;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
}

.hero-perks .icon {
  width: 15px;
  height: 15px;
  color: #e7cf8a;
}

/* Sello académico decorativo */
.hero-seal {
  padding: 18px 16px 15px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(200, 169, 81, 0.38);
  border-radius: 16px;
  box-shadow: 0 24px 50px -38px rgba(0, 0, 0, 0.9);
}

.hero-seal-ring {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border: 1px solid rgba(200, 169, 81, 0.65);
  border-radius: 50%;
  background: rgba(200, 169, 81, 0.08);
}

.hero-seal-icon {
  width: 27px;
  height: 27px;
  color: #e7cf8a;
}

.hero-seal-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  color: #f8fafc;
}

.hero-seal-copy {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #aebccd;
}

.hero-seal-tag {
  display: block;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #e7cf8a;
}

/* ============================================================
   Banner de páginas interiores (Scribd / IA / Filtro)
   ============================================================ */

.hero-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 78px;
  color: #f8fafc;
  background:
    radial-gradient(900px 420px at 82% -10%, rgba(56, 189, 248, 0.20), transparent 65%),
    radial-gradient(700px 380px at 6% 115%, rgba(231, 207, 138, 0.14), transparent 70%),
    linear-gradient(135deg, #0a1426 0%, #101d36 52%, #0b172c 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.topbar-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(8, 17, 32, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 12px 32px -26px rgba(0, 0, 0, 0.95);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
}

.topbar-shell .topbar {
  padding: 11px 0;
}

.hero-header .hero-container {
  position: relative;
  z-index: 2;
}

.hero-grid {
  position: absolute;
  inset: 78px 0 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 88%);
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(30px);
  pointer-events: none;
}

.hero-glow--one {
  top: -130px;
  right: 6%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 68%);
}

.hero-glow--two {
  bottom: -170px;
  left: 4%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(231, 207, 138, 0.20), transparent 68%);
}

.hero-header .hero {
  max-width: 780px;
  margin-top: 0;
  padding: 30px 0 44px;
  max-height: 420px;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 0.38s ease,
    padding 0.38s ease,
    opacity 0.24s ease,
    transform 0.3s ease;
}

.hero-header .hero-perks li {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(148, 163, 184, 0.24);
}

.hero-header ~ main {
  padding-top: 0;
}

.hero-header ~ .shell-nav {
  top: 58px;
  z-index: 900;
  background: rgba(10, 20, 38, 0.88);
  border-bottom-color: rgba(148, 163, 184, 0.18);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

@media (max-width: 560px) {
  .hero-header {
    padding-top: 70px;
  }

  .hero-grid {
    inset: 70px 0 0;
  }

  .topbar-shell .topbar {
    padding: 9px 0;
  }

  .hero-header .hero {
    padding: 22px 0 34px;
  }

  .hero-header ~ .shell-nav {
    top: 52px;
  }
}

/* Páginas sin banner (/scribd, /ai, /google): la barra va en el flujo normal
   en vez de quedarse fija, así no parpadea ni tapa el contenido al scrollear. */
.page-no-banner .topbar-shell {
  position: relative;
  background: rgba(8, 17, 32, 0.96);
}

.page-no-banner main {
  padding-top: 26px;
}

.page-no-banner .card {
  margin-top: 0;
}

.page-no-banner .shell-nav {
  position: static;
}

/* ============================================================
   Tarjeta principal
   ============================================================ */

.main-container {
  position: relative;
  z-index: 2;
}

/* La home usa un banner compacto: la tarjeta no se superpone al hero. */
.page-home .card {
  margin-top: 0;
}

.card {
  margin-top: -52px;
  padding: 34px 36px 30px;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line-soft);
}

.card-header h2 {
  font-size: 23px;
  font-weight: 720;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.card-header p {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--muted);
}

.card-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 650;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: 999px;
  white-space: nowrap;
}

.card-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.scribd-result-link {
  text-decoration: none;
}

/* Documento detectado en Scribd */

.scribd-document {
  margin-bottom: 24px;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.scribd-document[hidden] {
  display: none;
}

.scribd-document-main {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.scribd-thumb {
  flex: none;
  width: 96px;
  height: 124px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scribd-thumb[hidden] {
  display: none;
}

.scribd-document-info {
  min-width: 0;
}

.scribd-document-info h3 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.scribd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 12px;
}

.scribd-meta div {
  display: grid;
  gap: 2px;
}

.scribd-meta dt {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.scribd-meta dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.scribd-source-link {
  font-size: 13px;
  font-weight: 650;
  color: var(--brand);
  text-decoration: none;
}

.scribd-source-link:hover {
  text-decoration: underline;
}

.legal-notice,
.scribd-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.scribd-notice {
  margin-top: 18px;
}

.legal-notice {
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  text-align: center;
}

.legal-notice .icon,
.scribd-notice .icon {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: var(--muted-light);
}

.legal-notice .icon {
  width: 15px;
  height: 15px;
  margin-top: 0;
}

.legal-notice p,
.legal-notice span,
.scribd-notice p {
  margin: 0;
}

.scribd-warnings {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: #92400e;
}

.scribd-warnings li {
  margin-bottom: 3px;
}

/* Vista previa de páginas */

.scribd-preview {
  margin-bottom: 24px;
}

.scribd-preview[hidden] {
  display: none;
}

.scribd-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.scribd-preview-item {
  min-width: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.scribd-preview-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  object-position: top center;
  background: #fff;
  border-radius: 4px;
}

.scribd-preview-page {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  color: var(--muted);
}

.scribd-preview-hint {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 560px) {
  .scribd-document-main {
    flex-direction: column;
  }

  .scribd-thumb {
    width: 76px;
    height: 98px;
  }
}

/* ============================================================
   Entrada de URL
   ============================================================ */

.input-section,
.format-section,
.quality-section,
.preview-section {
  margin-bottom: 27px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 680;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

.field-label--icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-label--icon .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.input-group {
  display: flex;
  align-items: stretch;
  gap: 9px;
  margin-top: 10px;
}

.input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  color: var(--muted-light);
  pointer-events: none;
  transition: color 0.2s;
}

#url-input,
#topic-input,
.scribd-url-input {
  width: 100%;
  height: 50px;
  padding: 0 15px 0 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface-soft);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#url-input:hover,
#topic-input:hover,
.scribd-url-input:hover {
  border-color: #cbd5e1;
}

#url-input:focus,
#topic-input:focus,
.scribd-url-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-wrapper:focus-within .input-icon {
  color: var(--brand);
}

#url-input::placeholder,
#topic-input::placeholder,
.scribd-url-input::placeholder {
  color: var(--muted-light);
}

.help-text {
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Campo de enlace de Scribd
   ============================================================ */

.scribd-form .input-group {
  gap: 10px;
}

.scribd-form .scribd-url-input {
  height: 56px;
  padding: 0 16px 0 47px;
  font-size: 15px;
  font-weight: 500;
  background: #fff;
  border-color: #dbe2ea;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.scribd-form .scribd-url-input:hover {
  border-color: #b9c4d2;
}

.scribd-form .scribd-url-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.scribd-form .scribd-url-input::placeholder {
  color: var(--muted);
  font-weight: 450;
  opacity: 1;
}

.scribd-form .input-icon {
  left: 16px;
  width: 20px;
  height: 20px;
}

.scribd-form .input-group .btn {
  height: 56px;
  padding: 0 22px;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   Formatos
   ============================================================ */

.section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.section-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.format-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
  gap: 10px;
}

.format-option {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: var(--radius-lg);
}

.format-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.format-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 11px 24px 11px 11px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.format-option:not(.is-disabled):hover .format-card {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 12px 22px -16px rgba(37, 99, 235, 0.5);
}

.format-option input:focus-visible + .format-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

/* Marca de selección */
.format-option input:checked + .format-card {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.format-option input:checked + .format-card::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

/* Iconos de formato */
.format-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 6px 12px -7px rgba(15, 23, 42, 0.6);
}

.format-svg {
  width: 27px;
  height: 27px;
  display: block;
}

.format-icon--ppt {
  background: linear-gradient(145deg, #ff8a65 0%, #d24726 100%);
}

.format-icon--pps {
  background: linear-gradient(145deg, #ff7a45 0%, #c2410c 100%);
}

.format-icon--pot {
  background: linear-gradient(145deg, #fbbf24 0%, #ea580c 100%);
}

.format-icon--pdf {
  background: linear-gradient(145deg, #f87171 0%, #b91c1c 100%);
}

.format-icon--word {
  background: linear-gradient(145deg, #60a5fa 0%, #1d4ed8 100%);
}

.format-icon--txt {
  background: linear-gradient(145deg, #94a3b8 0%, #475569 100%);
}

.format-icon--md {
  background: linear-gradient(145deg, #a5b4fc 0%, #4338ca 100%);
}

.format-compat-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.format-compat-note a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.format-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.format-name {
  font-size: 13.5px;
  font-weight: 660;
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
}

.format-ext {
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.format-badge {
  width: fit-content;
  margin-top: 3px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #64748b;
  background: #eef2f7;
  border-radius: 999px;
  white-space: nowrap;
}

/* Formatos no disponibles */
.format-option.is-disabled {
  cursor: not-allowed;
}

.format-option.is-disabled .format-card {
  background: #f8fafc;
  border-style: dashed;
  border-color: #dbe3ee;
}

.format-option.is-disabled .format-icon {
  filter: grayscale(0.55);
  opacity: 0.68;
}

.format-option.is-disabled .format-name {
  color: #7c8ca4;
}

.format-option.is-disabled .format-ext {
  color: #a9b6c7;
}

/* ============================================================
   Calidad
   ============================================================ */

.quality-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quality-option {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.quality-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.quality-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.quality-option:hover .quality-card {
  border-color: #bfdbfe;
}

.quality-option input:checked + .quality-card {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.quality-option input:focus-visible + .quality-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.quality-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 10px;
}

.quality-mark--sd {
  color: #475569;
  background: #eef2f7;
}

.quality-mark--hd {
  color: #fff;
  background: linear-gradient(145deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 6px 12px -6px rgba(37, 99, 235, 0.6);
}

.quality-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quality-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}

.quality-desc {
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================
   Límites de conversión
   ============================================================ */

.limits-section[hidden],
.limits-warning[hidden],
.limits-warning:empty {
  display: none;
}

.limits-section {
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 18px;
  margin: 0;
}

.limits-grid dt {
  font-size: 11.5px;
  color: var(--muted);
}

.limits-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.limits-warning {
  margin: 12px 0 0;
  padding: 9px 11px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-md);
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
}

/* ============================================================
   Vista previa
   ============================================================ */

.preview-section[hidden] {
  display: none;
}

.preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.preview-layout-btn {
  display: none;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.preview-layout-btn[aria-pressed="true"] {
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.preview-index {
  display: none;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
}

.preview-item {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.preview-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.preview-item:hover img {
  transform: scale(1.04);
}

/* ============================================================
   Botones
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 17px;
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn-ghost {
  background: #fff;
  border: 1.5px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  border-color: #bfdbfe;
  color: var(--brand-dark);
  background: #f8fbff;
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1.5px solid transparent;
}

.btn-soft:hover:not(:disabled) {
  background: #dbeafe;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  box-shadow: 0 14px 28px -12px rgba(37, 99, 235, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 38px -14px rgba(37, 99, 235, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-lg {
  height: 54px;
  min-width: 300px;
  padding: 0 28px;
  font-size: 15px;
  border-radius: 14px;
}

.btn-lg .icon {
  width: 20px;
  height: 20px;
}

.btn-secondary {
  color: var(--brand-dark);
  background: var(--surface);
  border-color: #bfdbfe;
}

.btn-secondary:hover:not(:disabled) {
  background: #eff6ff;
  transform: translateY(-2px);
}

/* ============================================================
   Acción y estado
   ============================================================ */

.action-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.action-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.action-note .icon {
  width: 14px;
  height: 14px;
  color: #10b981;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.job-progress {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: center;
}

.job-controls[hidden],
.job-progress:empty {
  display: none;
}

.job-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.job-cancel {
  border: 0;
  background: none;
  color: var(--brand-dark);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.job-cancel:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.status-section {
  margin-top: 26px;
  padding: 16px 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--muted-light);
  transition: background 0.3s;
}

.status-dot.idle {
  background: var(--muted-light);
}

.status-dot.info {
  background: var(--info);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.status-dot.success {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.14);
  animation: pulse 1.4s infinite;
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14);
}

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

.status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.status-detail {
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--muted);
}

.status-detail p {
  margin: 0 0 5px;
}

.status-detail p:last-child {
  margin-bottom: 0;
}

.status-detail strong {
  color: var(--ink-soft);
  font-weight: 650;
}

.status-detail .btn {
  margin-top: 10px;
  height: 42px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.status-detail .error-text {
  color: var(--danger);
  font-weight: 550;
}

.download-progress {
  margin: 0 0 14px;
}

.download-progress[hidden] {
  display: none;
}

.download-progress-track {
  height: 6px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.download-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.download-progress-text {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.recent-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.recent-section[hidden] {
  display: none;
}

.recent-clear {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.recent-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.recent-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.recent-item:hover {
  border-color: #bfdbfe;
}

.recent-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.recent-meta {
  font-size: 11px;
  color: var(--muted);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  margin-top: 34px;
  padding: 24px 0 30px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  color: var(--muted);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  color: var(--ink-soft);
}

.brand-mark--small {
  width: 26px;
  height: 26px;
  filter: none;
}

.footer p {
  margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .hero--home {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .hero-seal {
    display: none;
  }
}

@media (max-width: 760px) {
  .hero-header--home {
    padding-bottom: 30px;
  }

  .hero--home {
    margin-top: 18px;
  }

  .hero-copy {
    font-size: 14px;
  }

  .page-home .card {
    margin-top: 0;
    padding: 26px 24px 24px;
  }

  .format-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .format-card {
    padding-right: 12px;
  }

  .format-name {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }

  .hero-header--home {
    padding: 8px 0 12px;
  }

  .topbar {
    padding-bottom: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 17px;
  }

  .topbar-pill {
    display: inline-flex;
    padding: 6px;
  }

  .topbar-pill-label {
    display: none;
  }

  .topbar-pill .icon {
    width: 15px;
    height: 15px;
  }

  .hero--home {
    margin-top: 8px;
  }

  .hero--home h1 {
    max-width: 100%;
    font-size: clamp(20px, 5.4vw, 23px);
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  /* En móvil el banner funciona como una barra compacta: el contenido
     empieza antes y la navegación queda siempre a la vista. */
  .hero--home .eyebrow,
  .hero--home .hero-copy,
  .hero--home .hero-perks {
    display: none;
  }

  .page-home .card {
    margin-top: 0;
    padding: 18px 16px 18px;
    border-radius: 18px;
  }

  .page-home .card-header {
    gap: 8px;
    padding-bottom: 14px;
    margin-bottom: 16px;
  }

  .ai-url-section {
    padding: 16px;
  }

  .card-header {
    flex-direction: column;
    gap: 10px;
    padding-bottom: 18px;
    margin-bottom: 20px;
  }

  .card-header h2 {
    font-size: 20px;
  }

  .input-group {
    flex-wrap: wrap;
  }

  .input-wrapper {
    flex-basis: 100%;
  }

  .input-group .btn {
    flex: 1;
  }

  .section-label-row {
    flex-direction: column;
    gap: 2px;
  }

  .quality-options {
    grid-template-columns: 1fr;
  }

  .format-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-header {
    flex-wrap: wrap;
    gap: 6px;
  }

  .preview-layout-btn {
    display: inline-flex;
  }

  .preview-grid--list {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .preview-grid--list .preview-item {
    display: flex;
    aspect-ratio: auto;
    height: 76px;
  }

  .preview-grid--list .preview-item img {
    width: 96px;
    height: 100%;
  }

  .preview-grid--list .preview-index {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
  }

  .btn-lg {
    width: 100%;
    min-width: 0;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Asistente de Presentaciones IA
   ============================================================ */

/* Barra de navegación entre vistas */
.shell-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(241, 245, 249, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 0;
}

.nav-container {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn .icon {
  width: 16px;
  height: 16px;
}

.nav-btn:hover:not(.active) {
  border-color: #cbd5e1;
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.nav-btn.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* AI main layout */
.ai-main {
  margin-top: 16px;
  min-height: 60vh;
}

.ai-container {
  display: grid;
  gap: 22px;
}

.view.hidden {
  display: none;
}

/* Card de análisis */
.analysis-result {
  margin-top: 22px;
}

.ai-url-section {
  margin-bottom: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fbff 0%, #fff 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
}

.ai-url-label {
  font-size: 15px;
  color: var(--ink);
}

.ai-url-control {
  margin-top: 12px;
}

#ai-url {
  width: 100%;
  height: 60px;
  padding: 0 18px 0 50px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--ink);
  background: #fff;
  font-family: var(--font);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#ai-url::placeholder {
  color: var(--muted-light);
}

#ai-url:hover {
  border-color: #93c5fd;
}

#ai-url:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.ai-url-control:focus-within .input-icon {
  color: var(--brand);
}

.ai-url-control .btn {
  min-height: 60px;
  padding: 0 22px;
  white-space: nowrap;
}

.ai-url-example {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.ai-url-example code {
  color: var(--brand-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.ai-url-help {
  max-width: 76ch;
  line-height: 1.6;
}

.ai-url-section .status-text {
  min-height: 20px;
  margin-top: 12px;
}

.ai-url-section .status-text.error {
  color: var(--danger);
}

.ai-url-section .status-text.success {
  color: #047857;
}

.ai-url-section .status-text.warning {
  color: #a16207;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-light);
  display: block;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  word-break: break-word;
}

.keywords-box {
  margin-top: 20px;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.keyword {
  font-size: 12px;
  font-weight: 550;
  color: var(--brand-dark);
  padding: 4px 10px;
  background: var(--brand-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

/* Panel de opciones */
.options-panel {
  margin-top: 22px;
  padding: 22px 24px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
}

.option-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.chip:hover:not(.active) {
  border-color: #cbd5e1;
  color: var(--ink-soft);
  background: #f8fafc;
}

.chip.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.extra-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.checkbox-label {
  cursor: pointer;
}

.notes-row {
  margin-top: 16px;
}

.notes-row textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 9px;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.notes-row textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Panel de prompt */
.prompt-container {
  margin-top: 22px;
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.prompt-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.prompt-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-dark);
  padding: 4px 10px;
  background: var(--brand-soft);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

.prompt-card {
  padding: 18px 22px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: auto;
}

.prompt-card pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.prompt-flash {
  animation: promptFlash 0.4s ease;
}

@keyframes promptFlash {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.prompt-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Resumen estructurado del asistente */
.summary-panel {
  margin-top: 22px;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.summary-panel[hidden] {
  display: none;
}

.summary-topic {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.summary-overview {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.summary-section h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.summary-list:empty {
  display: none;
}

#summary-output {
  margin: 14px 0 0;
}

.btn-loading .icon {
  animation: spin 1s linear infinite;
}

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

.btn-success .icon {
  color: #10b981;
}

/* Galería de diapositivas */
.gallery-stats {
  display: flex;
  gap: 22px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.stat-label {
  font-weight: 600;
  color: var(--muted-light);
}

.stat-value {
  font-weight: 700;
  color: var(--ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  cursor: pointer;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.view-title {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 6px;
}

.view-subtitle {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
}

.ai-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

/* Responsive AI */
@media (max-width: 760px) {
  .shell-nav {
    padding: 8px 0;
  }

  .nav-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .nav-btn .icon {
    width: 14px;
    height: 14px;
  }

  .option-group {
    grid-template-columns: 1fr;
  }

  .ai-actions {
    flex-direction: column;
  }

  .ai-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .prompt-actions {
    flex-direction: column;
  }

  .prompt-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* ============================================================
   Filtro de Presentaciones
   ============================================================ */

.google-main {
  margin-top: 16px;
  min-height: 60vh;
}

.google-main .main-container {
  display: grid;
  gap: 26px;
}

.google-main .card {
  margin-top: 0;
}

.google-main .main-container > .card:first-child {
  margin-top: -52px;
}

@media (max-width: 860px) {
  .google-main .main-container > .card:first-child {
    margin-top: -42px;
  }
}

@media (max-width: 560px) {
  .google-main .main-container > .card:first-child {
    margin-top: -36px;
  }
}

/* En las páginas sin banner ninguna tarjeta debe subir bajo la barra. */
.page-no-banner .main-container > .card:first-child,
.page-no-banner .google-main .main-container > .card:first-child {
  margin-top: 0;
}

.search-card .card-header {
  margin-bottom: 22px;
}

.search-card .input-section {
  margin-bottom: 22px;
}

.filters-section {
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.filters-section .option-group {
  margin-bottom: 0;
}

.filters-section .option-row {
  gap: 10px;
}

.topic-chips {
  margin-top: 14px;
}

.search-note {
  margin-top: 16px;
  padding: 10px 13px;
  font-size: 12.5px;
  font-weight: 550;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
}

.search-note[data-tone="warning"] {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.search-note[hidden] {
  display: none;
}

/* Resultados ------------------------------------------------- */

.results-section {
  min-width: 0;
  padding: 26px 28px 28px;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.results-head h2 {
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.results-head p {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.results-google {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 650;
  color: var(--brand-dark);
  text-decoration: none;
  white-space: nowrap;
  background: var(--brand-soft);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.results-google:hover {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.results-google .icon {
  width: 14px;
  height: 14px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.results-grid[hidden],
.results-state[hidden] {
  display: none;
}

.result-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.result-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 20px 36px -28px rgba(15, 23, 42, 0.45);
  transform: translateY(-2px);
}

.result-preview {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
  width: 100%;
  min-height: 126px;
  padding: 16px;
  overflow: hidden;
  font-family: var(--font);
  text-align: left;
  color: #fff;
  border: 0;
  cursor: pointer;
}

.result-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(ellipse 80% 90% at 100% 0%, #000 10%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 100% 0%, #000 10%, transparent 76%);
}

.result-preview::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 150px;
  height: 150px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  filter: blur(2px);
}

.result-preview--pptx {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 58%, #c2410c 100%);
}

.result-preview--ppt {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 58%, #991b1b 100%);
}

.result-preview--pdf {
  background: linear-gradient(135deg, #64748b 0%, #334155 58%, #1e293b 100%);
}

.result-preview > * {
  position: relative;
  z-index: 1;
}

.result-preview:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: -3px;
}

.result-rank {
  position: absolute;
  top: 13px;
  right: 15px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  opacity: 0.68;
}

.result-preview-file {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  backdrop-filter: blur(3px);
}

.result-preview-file .format-svg {
  width: 29px;
  height: 29px;
}

.result-preview-ext {
  align-self: end;
  font-size: 21px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.04em;
}

.result-preview-cta {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  padding: 5px 10px;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(3px);
}

.result-preview-cta .icon {
  width: 14px;
  height: 14px;
}

.result-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 15px 16px 16px;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-domain {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta .format-badge {
  flex: none;
  padding: 2px 7px;
  margin: 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.format-badge--pptx {
  color: #9a3412;
  background: #ffedd5;
}

.format-badge--ppt {
  color: #b91c1c;
  background: #fee2e2;
}

.format-badge--pdf {
  color: #334155;
  background: #e2e8f0;
}

.result-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--ink);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.result-path {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  color: #475569;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Texto solo para lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* PSE opens its configured overlay even though this page renders its own results. */
body.gsc-overflow-hidden {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.gsc-overflow-hidden .gsc-results-wrapper-overlay,
body.gsc-overflow-hidden .gsc-modal-background-image {
  display: none !important;
}

.result-snippet {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.result-actions .btn {
  flex: 1;
}

.btn-sm {
  height: 38px;
  padding: 0 13px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-sm .icon {
  width: 15px;
  height: 15px;
}

/* Estados ---------------------------------------------------- */

.results-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 42px 22px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
}

.results-state-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 6px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 50%;
}

.results-state-icon .icon {
  width: 25px;
  height: 25px;
}

.results-state h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.results-state p {
  max-width: 540px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.results-state[data-tone="error"] .results-state-icon {
  color: #dc2626;
  background: #fef2f2;
}

.results-state[data-tone="empty"] .results-state-icon {
  color: #b45309;
  background: #fffbeb;
}

.results-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 12px;
}

.results-state-actions .btn {
  height: 42px;
}

/* Esqueletos de carga ---------------------------------------- */

.result-card--skeleton {
  pointer-events: none;
}

.skeleton-block,
.skeleton-line {
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 37%, #e2e8f0 63%);
  background-size: 400% 100%;
  animation: skeletonShimmer 1.4s ease infinite;
}

.skeleton-line {
  display: block;
  height: 11px;
  border-radius: 999px;
}

.skeleton-line + .skeleton-line {
  margin-top: 2px;
}

@keyframes skeletonShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* Vista previa ----------------------------------------------- */

body.preview-open {
  overflow: hidden;
}

.preview-dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: 920px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 40px 110px -24px rgba(2, 6, 23, 0.6);
}

.preview-dialog::backdrop {
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(3px);
}

.preview-dialog[open] {
  animation: previewIn 0.22s ease;
}

@keyframes previewIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.preview-shell {
  display: flex;
  flex-direction: column;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.preview-badge {
  flex: none;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 6px;
}

.preview-heading {
  flex: 1;
  min-width: 0;
}

.preview-heading h2 {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-heading p {
  overflow: hidden;
  font-size: 11.5px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.preview-close:hover {
  color: var(--ink);
  background: #f8fafc;
}

.preview-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.preview-frame-wrap {
  position: relative;
  height: min(62vh, 540px);
  background: #f1f5f9;
}

#preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 0;
}

.preview-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  background: #f8fafc;
}

.preview-loading[hidden],
.preview-hint[hidden] {
  display: none;
}

.preview-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #dbeafe;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: previewSpin 0.8s linear infinite;
}

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

.preview-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 32px);
  padding: 9px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #92400e;
  text-align: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  transform: translateX(-50%);
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}

.preview-actions .btn {
  height: 42px;
}

/* CTA -------------------------------------------------------- */

.cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cta-row h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cta-row p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* Responsive ------------------------------------------------- */

@media (max-width: 760px) {
  .results-section {
    padding: 22px 20px 22px;
  }

  .results-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .result-preview {
    min-height: 112px;
  }

  .cta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-row .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .results-section {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }

  .results-state {
    padding: 34px 16px;
  }

  .results-state-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .results-state-actions .btn {
    width: 100%;
  }

  .preview-dialog {
    width: calc(100vw - 20px);
    border-radius: 16px;
  }

  .preview-head {
    padding: 12px 14px;
  }

  .preview-frame-wrap {
    height: 50vh;
  }

  .preview-actions {
    padding: 12px 14px;
  }

  .preview-actions .btn {
    flex: 1;
  }
}

/* Vista previa independiente -------------------------------- */

.document-preview-main {
  position: relative;
  z-index: 1;
  margin: -34px auto 48px;
}

.document-preview-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.document-preview-card .preview-frame-wrap {
  height: min(72vh, 780px);
  min-height: 360px;
}

.document-preview-card #preview-frame[hidden] {
  display: none;
}

.document-preview-message {
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #92400e;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
}

.document-preview-message[hidden] {
  display: none;
}

.document-preview-actions {
  justify-content: flex-end;
}

.document-preview-actions [hidden] {
  display: none;
}

@media (max-width: 760px) {
  .document-preview-main {
    margin-top: -24px;
  }

  .document-preview-card .preview-frame-wrap {
    height: 66vh;
    min-height: 300px;
  }

  .document-preview-actions .btn {
    flex: 1;
  }
}
