/* ============================================================
   Strigard — shared styles for auth pages + dashboard
   Same design system / palette as index.html (Linear-style dark)
   ============================================================ */
:root {
  --bg: #08090a;
  --bg-secondary: #0f1011;
  --bg-elevated: #131415;
  --border: #1e2020;
  --border-strong: #2a2c2d;
  --text-primary: #f0f0f0;
  --text-secondary: #8a8f98;
  --text-tertiary: #6a6f78;
  --accent: #7c6af7;
  --accent-hover: #6b59e8;
  --accent-soft: rgba(124, 106, 247, 0.14);
  --gold: #e3b34a;

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.10);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.10);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

/* Always reserve the scrollbar gutter: short pages (dashboard) otherwise center
   ~8px to the right of long pages (index), making the brand jump on navigation */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Ambient glow background (auth pages) ---------- */
body.auth-bg { position: relative; overflow-x: hidden; }
body.auth-bg::before {
  content: "";
  position: fixed;
  top: -220px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 620px;
  background: radial-gradient(ellipse at center, rgba(124,106,247,0.18), rgba(124,106,247,0) 65%);
  filter: blur(30px);
  pointer-events: none; z-index: 0;
}

/* ---------- Auth layout ---------- */
.auth-wrap {
  position: relative; z-index: 1;
  /* Los 210px son el hueco del pie. Antes esto era 100vh y se aflojaba a este
     calc() cuando site-footer.js añadía .has-site-footer al <body>, o sea
     DESPUÉS de pintar: el contenedor encogía 210px de golpe y, como centra su
     contenido, la tarjeta y el logo subían ~105px. Ese salto salía en Web
     Analytics como el elemento con más CLS del sitio.
     Se pone el valor final desde el principio, que es lo que se acaba viendo
     igualmente: las siete páginas con .auth-wrap cargan site-footer.js, así
     que el pie está siempre. Si algún día una no lo cargara, tendría 210px de
     hueco de más; es un precio muy inferior al del salto. */
  min-height: calc(100vh - 210px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  padding: 40px 20px;
}

.auth-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em;
}
.auth-brand img { width: 34px; height: 34px; image-rendering: pixelated; }

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 30px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 60px -30px rgba(0,0,0,0.85);
  animation: fadeUp .5s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth-card h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-secondary); font-size: 0.94rem; margin-bottom: 24px; }

/* ---------- Form fields ---------- */
form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.field input {
  width: 100%; height: 44px; padding: 0 14px;
  font-size: 0.95rem; color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: var(--text-tertiary); }
.field input:hover { border-color: var(--border-strong); }
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.link-right { align-self: flex-end; font-size: 0.82rem; color: var(--accent); margin-top: 2px; }
.link-right:hover { color: var(--accent-hover); text-decoration: underline; }

.legal-link { color: var(--accent); text-decoration: underline; }
.legal-link:hover { color: var(--accent-hover); }

/* Password show/hide toggle (eye) */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-tertiary);
  border-radius: 8px; transition: color .15s ease, background .15s ease;
}
.pw-toggle:hover { color: var(--text-secondary); background: rgba(255,255,255,0.05); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.is-showing .icon-eye { display: none; }
.pw-toggle.is-showing .icon-eye-off { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; height: 46px; padding: 0 18px;
  font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .05s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 22px -8px rgba(124,106,247,0.7); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.04); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.is-loading { cursor: wait; }
.btn-inline { width: auto; height: 40px; padding: 0 16px; font-size: 0.9rem; }
.btn-danger { background: var(--err); color: #fff; border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: #ef5350; }

/* click tooltip (e.g. delete-account blocked notice) */
.tip-anchor { position: relative; display: inline-block; }
.actions .tip-anchor { align-self: stretch; }
.actions .tip-anchor .btn { width: 100%; }
.tip-pop {
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 260px; padding: 10px 12px;
  background: var(--bg-secondary); border: 1px solid var(--border-strong); border-radius: 8px;
  color: var(--text-secondary); font-size: 0.8rem; line-height: 1.45; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
  z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.tip-pop::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--border-strong);
}
.tip-pop.open { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* themed confirmation dialog (replaces window.confirm) */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  width: 100%; max-width: 420px;
  background: var(--bg-secondary); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 26px 26px 22px;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.9); animation: fadeUp .22s ease both;
}
.confirm-box h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.confirm-box p { color: var(--text-secondary); font-size: 0.94rem; line-height: 1.6; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.confirm-actions .btn { width: auto; }

/* ---------- Spinner ---------- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Messages ---------- */
.msg {
  display: none;
  font-size: 0.9rem; padding: 11px 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  margin-bottom: 16px;
}
.msg-error   { display: block; color: var(--err); background: var(--err-soft); border-color: rgba(248,113,113,0.25); }
.msg-success { display: block; color: var(--ok);  background: var(--ok-soft);  border-color: rgba(74,222,128,0.25); }
.msg-info    { display: block; color: var(--text-secondary); background: rgba(255,255,255,0.03); border-color: var(--border); }

/* ---------- Links / misc ---------- */
.auth-links { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; text-align: center; font-size: 0.9rem; color: var(--text-secondary); }
.auth-links a { color: var(--accent); font-weight: 500; }
.auth-links a:hover { color: var(--accent-hover); text-decoration: underline; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.center { text-align: center; }
.status-icon { font-size: 2.6rem; margin-bottom: 10px; line-height: 1; }
.status-icon svg { width: 48px; height: 48px; }

/* ============================================================
   Dashboard (protected) layout
   ============================================================ */
.app-nav {
  position: sticky; top: 0; z-index: 10;
  /* matches the landing nav (.nav in index.html) so the brand doesn't jump between pages */
  height: 64px; display: flex; align-items: center;
  background: rgba(8,9,10,0.8);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-nav .inner { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.app-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em; }
.app-nav .brand img { width: 30px; height: 30px; image-rendering: pixelated; }

/* Right-aligned action group in the app nav. Every logged-in page (dashboard,
   support, ticket, admin) uses the same block so the nav does not shift when
   you move between them. */
.app-nav .nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.app-nav .nav-actions .active { border-color: var(--accent); }
@media (max-width: 640px) {
  /* Logo only: frees the room the action buttons need on a phone. Hiding the
     nav entirely would leave an admin with no way to navigate. */
  .app-nav .brand { font-size: 0; gap: 0; }
  .app-nav .brand img { width: 28px; height: 28px; }
  .app-nav .inner { padding: 0 14px; gap: 10px; }
  .app-nav .nav-actions { gap: 6px; }
  .app-nav .nav-actions .btn-inline { padding: 0 10px; font-size: 0.82rem; }
}

/* red unread badge (e.g. on the Support link) */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 0.68rem; font-weight: 700; line-height: 1;
  color: #fff; background: #ef4444; border-radius: 100px;
  margin-left: 6px; vertical-align: middle;
}

.app-main { max-width: 1080px; margin: 0 auto; padding: 48px 24px; animation: fadeUp .5s ease both; }
.app-main h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.app-main .lead { color: var(--text-secondary); margin-bottom: 32px; }

.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: 10px; }
.card .value { font-size: 1.1rem; font-weight: 600; word-break: break-all; }
.badge-pill { display: inline-block; padding: 5px 12px; border-radius: 100px; font-size: 0.85rem; font-weight: 600; background: var(--accent-soft); color: #cfc6ff; border: 1px solid rgba(124,106,247,0.3); }

.loading-screen { min-height: 60vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-secondary); }

/* --- Dashboard cards content --- */
.card.full { grid-column: 1 / -1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--text-secondary); font-size: 0.9rem; }
.card .msg { margin-top: 14px; margin-bottom: 0; }

/* key/value rows */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--border); }
.kv:first-of-type { border-top: none; padding-top: 0; }
.kv .k { color: var(--text-secondary); font-size: 0.9rem; }
.kv .v { font-weight: 600; text-align: right; }
.kv .v .price { color: var(--text-primary); }
.kv .v .per { color: var(--text-secondary); font-weight: 500; font-size: 0.85rem; }

.cancel-link { background: transparent; border: none; color: var(--err); font-size: 0.88rem; font-weight: 600; padding: 6px 0 0; cursor: pointer; }
.cancel-link:hover { text-decoration: underline; }
.cancel-link:disabled { opacity: 0.6; cursor: wait; text-decoration: none; }

/* toggle switches */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--border); }
.switch-row:first-of-type { border-top: none; padding-top: 0; }
.switch-row .t { font-size: 0.94rem; font-weight: 500; }
.switch-row .d { color: var(--text-tertiary); font-size: 0.82rem; margin-top: 2px; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 100px; transition: background .2s ease; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s ease; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }
.save-hint { font-size: 0.8rem; color: var(--ok); opacity: 0; transition: opacity .2s ease; }
.save-hint.show { opacity: 1; }

/* payments table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 420px; }
.table th, .table td { text-align: left; padding: 12px 10px; font-size: 0.9rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-tertiary); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table td { color: var(--text-secondary); }
.table tr:last-child td { border-bottom: none; }
.table td.amt { color: var(--text-primary); font-weight: 600; }
.table td.right, .table th.right { text-align: right; }
.empty { color: var(--text-tertiary); font-size: 0.9rem; padding: 22px 0; text-align: center; }

.status-tag { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 0.76rem; font-weight: 600; }
.status-paid { background: var(--ok-soft); color: var(--ok); }
.status-pending { background: rgba(227,179,74,0.12); color: var(--gold); }
.status-failed { background: var(--err-soft); color: var(--err); }

@media (min-width: 680px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card, .app-main { animation: none; }
  .spinner { animation-duration: 1.2s; }
}

/* ============================================================
   Pie de página compartido — lo inyecta site-footer.js en todas
   las páginas menos index.html (que lleva el suyo en el HTML).
   Clases con prefijo .site-footer- para no chocar con las de
   index.html, que se llaman .footer-*.
   ============================================================ */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  padding: 48px 0 36px;
  margin-top: 56px;
}
.site-footer-inner {
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px;
}
.site-footer-grid { display: flex; flex-direction: column; gap: 26px; }
.site-footer-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.1rem; color: var(--text-primary);
}
.site-footer-brand img { width: 28px; height: 28px; image-rendering: pixelated; }
.site-footer-claim { color: var(--text-secondary); font-size: 0.95rem; margin-top: 8px; }
.site-footer-links { display: flex; flex-wrap: wrap; gap: 22px; }
.site-footer-links a { color: var(--text-secondary); font-size: 0.92rem; transition: color .15s ease; }
.site-footer-links a:hover { color: var(--text-primary); }
.site-footer-legal {
  color: var(--text-tertiary); font-size: 0.84rem;
  border-top: 1px solid var(--border);
  padding-top: 22px; margin-top: 26px;
}

@media (min-width: 640px) {
  .site-footer-grid { flex-direction: row; justify-content: space-between; align-items: flex-start; }
}

/* La regla que aflojaba .auth-wrap al aparecer el pie se ha retirado: el valor
   ya está puesto de base arriba, en .auth-wrap. Dependía de una clase que
   añade el JS, y eso movía la página entera después de pintarla. */

/* Nota bajo las acciones de suscripción: recuerda que el vendedor legal es
   Paddle y dónde se descargan las facturas. */
.sub-note {
  margin-top: 14px; padding: 12px 14px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  color: var(--text-secondary); font-size: 0.88rem; line-height: 1.5;
}
.sub-note strong {
  color: var(--accent); font-weight: 700;
  letter-spacing: 0.06em;
}
