/* ============================================================
   ThumbGrab — style.css
   Misma familia de diseño que TubeGrab (oscuro + acento violeta),
   REGLA DEL PRESIDENTE: nada se despliega solo; todo lo que
   aparece tiene su botón ×. Sin frameworks: velocidad = arma SEO.
   ============================================================ */

:root {
  --bg: #0b1020;
  --bg-2: #101735;
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef2ff;
  --muted: #9aa7c7;
  --accent: #8b5cf6;
  --accent-2: #d946ef;
  --gradient: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --wrap: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 480px at 85% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(700px 420px at -10% 15%, rgba(217, 70, 239, 0.12), transparent 60%);
  background-repeat: no-repeat;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap; }
a { color: #d8b4fe; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(11, 16, 32, 0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.bar-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.18rem; font-weight: 700; color: var(--text); }
.brand b { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; gap: 22px; }
.topnav a { color: var(--muted); font-size: 0.95rem; font-weight: 500; }
.topnav a:hover { color: var(--text); text-decoration: none; }

/* ---------- hero + form ---------- */
.hero { padding: 54px 20px 26px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.02em; }
h1 span { display: block; font-size: 0.52em; font-weight: 500; margin-top: 8px; }
.lead { font-size: 1.08rem; color: #c9d3ef; max-width: 62ch; margin: 0 0 26px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tool-card { padding: 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  font-weight: 600; font-size: 0.98rem; line-height: 1.2;
  padding: 13px 22px; transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--gradient); color: #180a26; box-shadow: 0 10px 26px rgba(139, 92, 246, 0.34); white-space: nowrap; }
.btn-primary:hover { box-shadow: 0 12px 30px rgba(139, 92, 246, 0.46); }
.btn-ghost { background: var(--card-strong); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.13); }
.btn-smartlink {
  width: 100%; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.16), rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(217, 70, 239, 0.45);
  color: #f5d0fe; font-size: 0.95rem;
}
.btn-smartlink:hover { background: linear-gradient(135deg, rgba(217, 70, 239, 0.24), rgba(139, 92, 246, 0.24)); }

.row-input { display: flex; gap: 12px; flex-wrap: wrap; }
#url { flex: 1 1 340px; min-width: 0; background: rgba(6, 10, 24, 0.85); border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: 1rem; padding: 13px 16px; }
#url:focus { outline: 2px solid rgba(168, 85, 247, 0.65); outline-offset: 1px; border-color: rgba(168, 85, 247, 0.55); }
#hint { margin: 10px 2px 0; }

/* ---------- progreso / errores ---------- */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin: 18px 2px; }
.progress { flex: 1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
#progress-bar { height: 100%; width: 30%; border-radius: 99px; background: var(--gradient); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

.alert { margin: 16px 2px; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.4); color: #fecaca; font-size: 0.95rem; }

/* ---------- panel de resultados (con × SIEMPRE) ---------- */
.panel { position: relative; margin-top: 22px; padding: 22px; }
.panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card-strong); border: 1px solid var(--border);
  color: var(--text); font-size: 1.35rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, transform 0.12s ease;
}
.panel-close:hover { background: rgba(217, 70, 239, 0.25); transform: rotate(90deg); }

.video-meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
#thumb-preview { border-radius: 10px; border: 1px solid var(--border); width: 160px; height: 90px; object-fit: cover; }
.meta-txt { flex: 1 1 260px; min-width: 0; }
#v-title { font-weight: 700; font-size: 1.05rem; color: var(--text); }
#v-stats { margin-top: 4px; }

#btn-reopen { margin-top: 16px; }

/* ---------- tarjetas de tamaño ---------- */
.fmt-group { margin-top: 22px; }
.fmt-title { font-size: 1.02rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 99px;
  background: rgba(52, 211, 153, 0.15); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.4);
}

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.thumb {
  background: rgba(6, 10, 24, 0.6);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.thumb:hover { border-color: rgba(168, 85, 247, 0.55); transform: translateY(-2px); }
.thumb-img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04);
}
.thumb.na .thumb-img { opacity: 0.25; filter: grayscale(1); }
.thumb-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.thumb-res { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.01em; }
.thumb-file { font-size: 0.72rem; font-weight: 700; color: #e9d5ff; background: rgba(168, 85, 247, 0.13); border: 1px solid rgba(168, 85, 247, 0.35); padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.thumb-sub { font-size: 0.82rem; color: var(--muted); }
.thumb-sub .na-label { color: var(--warn); font-weight: 600; }
.thumb-actions { display: flex; gap: 8px; margin-top: auto; }
.btn-dl {
  flex: 1; padding: 10px 14px; background: var(--gradient); color: #180a26;
  font-weight: 700; font-size: 0.9rem; border-radius: 10px; border: none; cursor: pointer;
  transition: box-shadow 0.12s ease; text-align: center;
}
.btn-dl:hover { box-shadow: 0 8px 22px rgba(139, 92, 246, 0.4); }
.btn-copy {
  padding: 10px 12px; background: var(--card-strong); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 0.85rem; white-space: nowrap;
}
.btn-copy:hover { background: rgba(255, 255, 255, 0.13); }

/* ---------- anuncios ---------- */
.ad-zone {
  margin: 18px auto; min-height: 90px; max-width: var(--wrap);
  border: 1px dashed rgba(255, 255, 255, 0.14); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.8rem; padding: 8px;
}
.ad-mid { min-height: 70px; margin: 16px 0; }
.ad-video { min-height: 140px; }

/* ---------- secciones de contenido ---------- */
.section { padding: 42px 20px 6px; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); margin: 0 0 14px; letter-spacing: -0.015em; }
.section p { color: #c9d3ef; max-width: 75ch; }
.steps { margin: 18px 0 0; padding-left: 22px; color: #c9d3ef; }
.steps li { margin: 8px 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 26px; margin-top: 18px; }
.grid-2 h3 { margin: 0 0 8px; font-size: 1.05rem; }
.grid-2 p { margin: 0; font-size: 0.95rem; }

.table-wrap { overflow-x: auto; margin-top: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.tbl td { color: #c9d3ef; }

/* ---------- FAQ ---------- */
.faq { margin-top: 14px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); margin: 10px 0; overflow: hidden; }
.faq summary { cursor: pointer; list-style: none; padding: 14px 44px 14px 16px; font-weight: 600; position: relative; user-select: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--accent-2); font-size: 1.25rem; font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 16px 16px; color: #c9d3ef; font-size: 0.95rem; }

/* ---------- footer ---------- */
.footer { margin-top: 60px; border-top: 1px solid var(--border); background: rgba(6, 10, 24, 0.7); padding: 26px 0 90px; }
.foot-inner { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- pie flotante con × (SLOT 3) ---------- */
.floating-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(8, 12, 26, 0.96); border-top: 1px solid var(--border);
  padding: 8px calc(52px + env(safe-area-inset-right, 0px)) 8px 10px;
  min-height: 64px; display: flex; align-items: center;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.ff-inner { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 50px; }
.ff-close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card-strong); border: 1px solid var(--border);
  color: var(--text); font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.ff-close:hover { background: rgba(217, 70, 239, 0.3); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topnav { display: none; }
  .hero { padding-top: 34px; }
  .tool-card { padding: 16px; }
  .panel { padding: 16px 14px; }
  .panel-close { top: 8px; right: 8px; width: 34px; height: 34px; }
  #thumb-preview { width: 120px; height: 68px; }
  .section { padding-top: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #progress-bar { animation: none; }
  .btn, .thumb, .panel-close { transition: none; }
}
