/* Atlas Signal — estilo "Titán"
   © 2026 Germán Cárdenas — Licencia MIT */

:root {
  --bg: #0b0f1a;
  --bg-2: #0e1322;
  --surface: #121829;
  --surface-2: #182036;
  --surface-3: #1f2944;
  --border: #232c45;
  --border-strong: #33405f;
  --text: #e8ecf5;
  --text-2: #b4bdd3;
  --muted: #7e89a6;
  --gold: #f5b841;
  --gold-2: #e09a1c;
  --gold-soft: rgba(245, 184, 65, 0.12);
  --cyan: #5eead4;
  --cyan-soft: rgba(94, 234, 212, 0.12);
  --danger: #f87171;
  --ok: #34d399;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(245, 184, 65, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(94, 234, 212, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 26, 0.8);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 600 19px/1.1 var(--font-display); letter-spacing: 0.16em; text-transform: uppercase; }
.brand-name b { color: var(--gold); font-weight: 700; }
.brand-tag { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.author { font-size: 13px; color: var(--text-2); letter-spacing: 0.04em; }
.badge-local {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.3); background: var(--cyan-soft);
  color: var(--cyan); font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
}
.badge-local .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(94, 234, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); } }

/* ---------- estructura ---------- */
.shell { flex: 1; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.shell > * { min-width: 0; }
.sidebar {
  position: sticky; top: 69px; align-self: start;
  height: calc(100vh - 69px);
  display: flex; flex-direction: column; gap: 4px;
  padding: 24px 14px;
  border-right: 1px solid var(--border);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer; text-align: left;
  font-weight: 500; transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--gold-soft); color: var(--gold); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.sidebar-foot { margin-top: auto; padding: 0 14px; font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }

main { padding: 36px 40px 56px; max-width: 1180px; width: 100%; }
.view { display: none; animation: rise 0.25s ease; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head { margin-bottom: 26px; max-width: 720px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.eyebrow.ok { color: var(--ok); }
h1 { margin: 0 0 10px; font: 600 clamp(26px, 3vw, 34px)/1.15 var(--font-display); letter-spacing: -0.01em; }
h2 { font: 600 17px/1.3 var(--font-display); margin: 0 0 16px; }
h3 { font: 600 16px/1.3 var(--font-display); margin: 6px 0 8px; }
.lead { margin: 0; color: var(--text-2); font-size: 16px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2.tight { gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.stack { display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.top-gap { margin-top: 18px; }

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 20px; }

.step { display: flex; align-items: center; gap: 10px; }
.step span {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(245, 184, 65, 0.35);
  font-size: 13px; font-weight: 700;
}

/* ---------- zonas de arrastre ---------- */
.drop {
  position: relative; display: block; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: rgba(24, 32, 54, 0.45);
  transition: border-color 0.15s, background 0.15s;
  min-height: 190px;
}
.drop-sm { min-height: 150px; }
.drop:hover, .drop.drag { border-color: var(--gold); background: var(--gold-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-empty {
  height: 100%; min-height: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 22px; text-align: center; pointer-events: none;
}
.drop-empty strong { font-weight: 600; }
.drop-empty span { color: var(--muted); font-size: 13px; }
.drop-icon { width: 30px; height: 30px; color: var(--gold); margin-bottom: 8px; }
.wave { width: 70%; height: 22px; margin-top: 14px; stroke: var(--cyan); stroke-width: 1.5; opacity: 0.6; }
.wave path { stroke-dasharray: 6 6; animation: flow 3s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -48; } }

.drop-filled { display: flex; align-items: center; gap: 16px; padding: 16px; min-height: inherit; pointer-events: none; }
.preview {
  width: 140px; height: 140px; flex: none; border-radius: 8px; overflow: hidden;
  background: repeating-conic-gradient(#1a2238 0 25%, #141b2e 0 50%) 0 0 / 16px 16px;
  display: grid; place-items: center; border: 1px solid var(--border);
}
.preview img { width: 100%; height: 100%; object-fit: contain; }
.preview .audio-glyph { width: 56px; height: 56px; color: var(--cyan); }
.file-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-meta strong { overflow-wrap: anywhere; }
.file-meta span { color: var(--muted); font-size: 13px; }
.file-meta .link-like { color: var(--gold); font-weight: 600; margin-top: 6px; }
.file-glyph { width: 40px; height: 40px; color: var(--gold); }

/* ---------- formularios ---------- */
.segmented {
  display: inline-flex; padding: 4px; gap: 4px; margin-bottom: 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
}
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 14px;
}
.segmented button[aria-selected="true"] { background: var(--surface-3); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(245, 184, 65, 0.3); }

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; letter-spacing: 0.02em; }
textarea, .pw input {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 12px 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 110px; }
textarea:focus, .pw input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea::placeholder, input::placeholder { color: var(--muted); }
.mono, .pw input { font-family: var(--mono); font-size: 14px; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; }

.pw { display: flex; gap: 6px; }
.pw input { flex: 1; min-width: 0; }
.icon-btn {
  display: grid; place-items: center; width: 44px; flex: none;
  border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }

.strength { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.strength i { flex: 1; max-width: 46px; height: 4px; border-radius: 4px; background: var(--surface-3); transition: background 0.2s; }
.strength span { font-size: 12px; color: var(--muted); margin-left: 6px; }
.strength[data-level="0"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-level="1"] i:nth-child(-n+2) { background: #fb923c; }
.strength[data-level="2"] i:nth-child(-n+3) { background: var(--gold); }
.strength[data-level="3"] i:nth-child(-n+4), .strength[data-level="4"] i { background: var(--ok); }

.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.hint.bad { color: var(--danger); }
.hint.good { color: var(--ok); }

.mode-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 22px; }
.mode-row .field-label { margin: 0; }
.mode-row .segmented { margin: 0; }

.capacity { margin-top: 20px; }
.capacity-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 8px; gap: 12px; }
.capacity-head span:last-child { font-family: var(--mono); color: var(--text); text-align: right; }
.bar { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.bar div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--gold)); transition: width 0.3s; }
.bar div.over { background: var(--danger); }

/* ---------- botones ---------- */
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.actions.left { justify-content: flex-start; }
.actions.end { align-items: flex-end; margin-top: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none; transition: transform 0.1s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 100%); color: #1b1404; border-color: transparent;
  box-shadow: 0 6px 20px rgba(245, 184, 65, 0.22);
  letter-spacing: 0.04em; text-transform: uppercase; font-size: 14px;
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(245, 184, 65, 0.35); border-color: transparent; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; }

/* ---------- resultados ---------- */
.result { display: flex; gap: 22px; align-items: flex-start; border-color: rgba(52, 211, 153, 0.35); }
.result-preview { flex: none; }
.result-preview .preview { width: 180px; height: 180px; }
.result-body { min-width: 0; flex: 1; }
.result-body.wide { width: 100%; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
.notice { margin: 18px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid rgba(245, 184, 65, 0.25); color: var(--text-2); font-size: 13px; }
.notice b { color: var(--gold); }
.file-card { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.file-card .file-meta { flex: 1; }

/* ---------- historial ---------- */
.history-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 42px; height: 24px; border-radius: 24px; background: var(--surface-3); position: relative; transition: background 0.2s; border: 1px solid var(--border-strong); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform 0.2s, background 0.2s; }
.switch input:checked + span { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--gold); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.table-wrap { overflow-x: auto; }
table.history { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th { text-align: left; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.history td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.history td:first-child { white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.hide { background: var(--gold-soft); color: var(--gold); }
.tag.extract { background: var(--cyan-soft); color: var(--cyan); }
.tag.text { background: rgba(180, 189, 211, 0.12); color: var(--text-2); }
.empty { text-align: center; color: var(--muted); padding: 30px 0 10px; margin: 0; }

/* ---------- acerca ---------- */
.feature .num { font: 700 13px var(--mono); color: var(--gold); letter-spacing: 0.1em; }
.feature p { margin: 0; color: var(--text-2); font-size: 14px; }
.prose h2 { margin-top: 8px; }
.prose h2 + * { margin-top: 0; }
.prose ul { padding-left: 20px; margin: 0 0 22px; color: var(--text-2); }
.prose li { margin-bottom: 8px; }
.prose li b { color: var(--text); }
.prose p { color: var(--text-2); margin: 0 0 22px; }
svg.inline { width: 15px; height: 15px; vertical-align: -2px; color: var(--gold); }
.signature { border-top: 1px solid var(--border); padding-top: 18px; margin-bottom: 0 !important; }
.signature b { color: var(--gold); }

.footer { text-align: center; padding: 18px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; border-top: 1px solid var(--border); }

/* ---------- overlay de progreso ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(6, 9, 16, 0.72); backdrop-filter: blur(4px); }
.overlay-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 34px 44px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 260px; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 0.2s; }
.overlay-pct { position: absolute; top: 34px; height: 120px; display: grid; place-items: center; font: 600 24px var(--font-display); color: var(--gold); }
.overlay-msg { color: var(--text-2); font-size: 14px; }

/* ---------- avisos ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; animation: rise 0.2s ease; border-left: 3px solid var(--cyan); }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { padding: 12px 16px; }
  .author { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 65px; z-index: 15; height: auto; flex-direction: row; overflow-x: auto;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); background: var(--bg);
  }
  .nav-item { white-space: nowrap; padding: 9px 12px; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { display: none; }
  main { padding: 24px 16px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .result { flex-direction: column; }
}
@media (max-width: 480px) {
  .brand-tag { display: none; }
  .badge-local { padding: 4px 10px; }
  .preview { width: 96px; height: 96px; }
  .segmented { display: flex; }
  .segmented button { flex: 1; padding: 8px 10px; }
  .mode-row .segmented { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
