/* ================================================================
   SILMAR ANGELS — refine.css
   Capa de refinamiento sobre style.css (Etéreo Dorado).
   Cárgalo DESPUÉS de style.css. No reescribe selectores; solo ajusta.
   ================================================================ */

/* ── Tokens refinados (Etéreo Dorado) ──────────────────────────── */
:root {
  --cream:        #FDFAF3;
  --cream-2:      #F7F0DE;
  --cream-3:      #F3E7C9;

  --gold:         #C9A84C;
  --gold-light:   #E8CE7A;
  --gold-pale:    #FBF1D2;
  --gold-dark:    #8A6E1F;

  --ink:          #3A2E1F;
  --ink-soft:     #5E4B33;
  --ink-muted:    #897556;
  --ink-faint:    #B5A584;

  --border:       rgba(201,168,76,0.22);
  --border-strong:rgba(201,168,76,0.45);

  --shadow-sm: 0 1px 3px rgba(58,46,31,0.06), 0 2px 8px rgba(201,168,76,0.05);
  --shadow-md: 0 6px 20px rgba(58,46,31,0.10), 0 2px 6px rgba(201,168,76,0.08);
  --shadow-lg: 0 18px 48px rgba(58,46,31,0.14), 0 6px 16px rgba(201,168,76,0.10);
  --shadow-gold:0 8px 28px rgba(201,168,76,0.32);

  --ring:       0 0 0 3px rgba(201,168,76,0.35);
  --tr:         all 0.18s cubic-bezier(.4,0,.2,1);
}

/* ── Base polish ──────────────────────────────────────────────── */
html { scroll-padding-top: 90px; }
body { background:
  radial-gradient(1200px 600px at 80% -10%, rgba(232,206,122,0.18), transparent 60%),
  radial-gradient(1000px 500px at -10% 30%, rgba(243,231,201,0.35), transparent 65%),
  var(--cream);
}
::selection { background: var(--gold-light); color: var(--ink); }

/* Focus accesible global */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 8px;
}

/* Skip link */
.skip-link {
  position: absolute; left: 0; top: 0;
  padding: .5rem 1rem; background: var(--ink); color: var(--cream);
  transform: translateY(-120%); transition: var(--tr); z-index: 9999;
  border-radius: 0 0 8px 0; font-size: .85rem;
}
.skip-link:focus { transform: translateY(0); }

/* ── Header público (site-header) ─────────────────────────────── */
.site-header {
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  background: rgba(253,250,243,0.78);
  border-bottom: 1px solid var(--border);
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.nav-link { position: relative; transition: var(--tr); }
.nav-link::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -6px;
  height: 2px; background: var(--gold); transform: scaleX(0);
  transform-origin: center; transition: transform .25s ease;
  border-radius: 2px;
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ── Botones (refinamiento) ───────────────────────────────────── */
.btn, .btn-plan, .btn-outline, .btn-sage, .btn-sky, .btn-gold,
button.btn, a.btn {
  letter-spacing: .015em;
  transition: var(--tr);
  will-change: transform;
}
.btn-plan, .btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #fff; border: none; box-shadow: var(--shadow-sm);
}
.btn-plan:hover, .btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}
.btn-plan:active { transform: translateY(0); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
}
.btn-outline:hover {
  background: var(--gold-pale);
  border-color: var(--gold);
  color: var(--gold-dark);
}

/* ── Cards / secciones ────────────────────────────────────────── */
.card, .data-section, .ap-modulo {
  background: linear-gradient(180deg, #fff 0%, var(--cream) 100%);
  border-color: var(--border);
}
.ap-modulo {
  position: relative; overflow: hidden;
}
.ap-modulo::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(201,168,76,0.08));
  opacity: 0; transition: var(--tr);
}
.ap-modulo:hover::before { opacity: 1; }

/* ── Hero refinements ─────────────────────────────────────────── */
.hero, .hero-section, #inicio {
  position: relative;
}
.hero h1, .hero-title, .hero-section h1 {
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero p, .hero-subtitle { text-wrap: pretty; }

/* ── Reveal on scroll (CSS-only via IntersectionObserver fallback) */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.in { opacity: 1; transform: none; }

/* ── Imágenes ─────────────────────────────────────────────────── */
img { transition: transform .5s ease; }
.gallery-item img:hover, .galeria img:hover { transform: scale(1.04); }

/* ── Formularios ──────────────────────────────────────────────── */
input, select, textarea {
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: #fff;
  padding: .65rem .85rem;
  font: inherit; color: var(--ink);
  transition: var(--tr);
}
input:hover, select:hover, textarea:hover { border-color: var(--gold-light); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
label { font-weight: 600; font-size: .82rem; color: var(--ink-soft); }

/* ── Tablas ───────────────────────────────────────────────────── */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th { background: var(--cream-2); font-weight: 600; text-align: left;
     padding: .65rem .8rem; font-size: .78rem; letter-spacing: .04em;
     text-transform: uppercase; color: var(--ink-soft); }
td { padding: .7rem .8rem; border-top: 1px solid var(--border); font-size: .9rem; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: var(--gold-pale); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem; border-radius: var(--r-full);
  font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.badge-activo    { background: #E6F2E6; color: #2E6B2E; }
.badge-pendiente { background: var(--gold-pale); color: var(--gold-dark); }

/* ── Admin panel layout v2 ────────────────────────────────────── */
.ap-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  max-width: 1280px; margin: 0 auto; padding: 1.25rem;
}
.ap-side {
  position: sticky; top: 84px; align-self: start;
  background: linear-gradient(180deg, #fff, var(--cream));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.ap-side h4 {
  font-family: var(--font-cinzel); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-muted); margin: .8rem .4rem .4rem;
}
.ap-side a {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .65rem; border-radius: var(--r-md);
  color: var(--ink-soft); font-size: .88rem; font-weight: 500;
  transition: var(--tr);
}
.ap-side a:hover, .ap-side a.is-current {
  background: var(--gold-pale); color: var(--gold-dark);
}
.ap-side a .ico { width:18px; text-align:center; }
.ap-side a .ct {
  margin-left:auto; font-size:.68rem; background:var(--gold);
  color:#fff; padding:.05rem .4rem; border-radius:var(--r-full);
  font-weight:700;
}
.ap-side a .ct.alert { background:#dc2626; }

.ap-greeting {
  display:flex; align-items:center; justify-content:space-between;
  gap:1rem; flex-wrap:wrap; margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--gold-pale), #fff);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem 1.5rem;
}
.ap-greeting h1 {
  font-family: var(--font-cinzel); font-size: 1.5rem; margin:0;
  color: var(--ink); letter-spacing: -.005em;
}
.ap-greeting .sub { color: var(--ink-muted); font-size: .85rem; margin-top:.25rem; }
.ap-alert-pill {
  background: #FEF3C7; color: #92400E; border:1px solid #FCD34D;
  padding: .4rem .85rem; border-radius: var(--r-full);
  font-size: .78rem; font-weight:600; display:inline-flex; align-items:center; gap:.4rem;
}

.ap-search {
  width: 100%; max-width: 320px;
  padding: .55rem .85rem .55rem 2.2rem;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23897556' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat .65rem center / 18px 18px;
  border-radius: var(--r-full);
}

.ap-modulos { gap: 1rem; }
.ap-modulo {
  padding: 1.25rem;
  border-radius: var(--r-lg);
}
.ap-modulo-emoji {
  display:inline-flex; align-items:center; justify-content:center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--gold-pale); font-size: 1.25rem;
}
.ap-modulo-title { font-size: .98rem; color: var(--ink); }
.ap-modulo-badge {
  background: var(--gold-pale); color: var(--gold-dark);
  border: 1px solid rgba(201,168,76,0.3);
}

.stat-box {
  background: linear-gradient(180deg, #fff, var(--cream));
  border-radius: var(--r-lg);
  position: relative; overflow: hidden;
}
.stat-box::after {
  content:""; position:absolute; inset:auto -10% -40% auto; width:60%; height:60%;
  background: radial-gradient(circle, rgba(201,168,76,0.18), transparent 70%);
  pointer-events:none;
}
.stat-num { color: var(--ink); font-family: var(--font-cinzel); font-weight:600; }

/* Sidebar móvil */
@media (max-width: 900px) {
  .ap-shell { grid-template-columns: 1fr; padding: 1rem; }
  .ap-side { position: relative; top: 0; max-height: none;
    display: flex; gap: .35rem; overflow-x: auto; padding: .55rem; }
  .ap-side h4 { display:none; }
  .ap-side a { white-space: nowrap; padding: .4rem .65rem; font-size:.78rem; }
}

/* ── Toasts / mensajes flash ──────────────────────────────────── */
.flash {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 1000;
  background: #fff; border-left: 4px solid var(--gold);
  padding: .85rem 1.2rem; border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  animation: flash-in .35s ease;
}
@keyframes flash-in { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }

/* ── Print clean ──────────────────────────────────────────────── */
@media print {
  .site-header, .cuenta-header, .ap-side, .wa-float, footer { display: none !important; }
  body { background: #fff; }
}

/* ── Motion-sensitive users ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
/* ── Password visibility toggle (optimizado móvil) ───────────── */
.input-wrap { position: relative; }
.input-wrap input[type="password"],
.input-wrap input.pw-input {
  padding-right: 3rem;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  right: .4rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: var(--tr);
  z-index: 3;                    /* siempre por encima del input */
  touch-action: manipulation;    /* elimina el delay de 300ms */
  -webkit-tap-highlight-color: rgba(201,168,76,.18);
  -webkit-user-select: none;
  user-select: none;
}
.pw-toggle:hover { color: var(--gold-dark); background: var(--gold-pale); }
.pw-toggle:active { background: var(--gold-pale); transform: translateY(-50%) scale(0.95); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--ring); color: var(--gold-dark); }
.pw-toggle svg { width: 20px; height: 20px; display: block; pointer-events: none; }
.pw-toggle .icon-off { display: none; }
.pw-toggle[aria-pressed="true"] .icon-on  { display: none; }
.pw-toggle[aria-pressed="true"] .icon-off { display: block; }

/* En móvil agrandamos a 44×44 (recomendación Apple/Google) */
@media (max-width: 768px) {
  .input-wrap input[type="password"],
  .input-wrap input.pw-input { padding-right: 3.25rem; }
  .pw-toggle {
    width: 2.75rem;
    height: 2.75rem;
    right: .35rem;
    border-radius: 12px;
  }
  .pw-toggle svg { width: 22px; height: 22px; }
}

/* ── Auth pages responsive (login / registro / cambiar pwd) ──── */
/* Evita el zoom automático de iOS al enfocar inputs (font-size >= 16px) */
@media (max-width: 768px) {
  .auth-page input,
  .auth-page select,
  .auth-page textarea,
  .upgrade-page input,
  .upgrade-page select,
  .upgrade-page textarea {
    font-size: 16px !important;
  }

  /* En móvil el panel visual lateral ocupa pantalla completa: lo ocultamos */
  .auth-page { display: block !important; min-height: 100vh; }
  .auth-visual {
    display: none !important;
  }
  .auth-form-side {
    width: 100% !important;
    min-height: 100vh;
    padding: 1.25rem 1rem 2rem !important;
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }
  .auth-box {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
  }
  .auth-header h1 { font-size: 1.6rem !important; line-height: 1.2; }
  .auth-header p  { font-size: .95rem !important; }
  .form-card { padding: 1.25rem !important; border-radius: 16px; }
  .form-input-icon { height: 48px; }
  .btn-auth-submit { width: 100%; min-height: 48px; font-size: 1rem; }

  /* Filas de dos columnas (nombre/apellido) pasan a una sola */
  .form-row,
  .form-grid-2 { grid-template-columns: 1fr !important; display: block !important; }
  .form-row > * + *,
  .form-grid-2 > * + * { margin-top: 1rem; }

  /* Cambiar contraseña: contenedor */
  .upgrade-main .container { padding-left: 1rem; padding-right: 1rem; }
}

/* Móviles muy pequeños */
@media (max-width: 380px) {
  .auth-header h1 { font-size: 1.4rem !important; }
  .form-card { padding: 1rem !important; }
}

