/* ==========================================================================
   OfficeAcademy · Sistema de autenticación
   Tokens de diseño
   --------------------------------------------------------------------------
   Paleta:
     --ink        #12141C  fondo modo oscuro / texto modo claro
     --paper      #F7F8FC  fondo modo claro (blanco frío, no crema)
     --brand      #4F5DFF  indigo de marca (acento principal)
     --brand-2    #7B8CFF  indigo claro (hover / glow)
     --word       #2B579A  azul funcional · contexto Word
     --excel      #1E7145  verde funcional · contexto Excel
     --slide      #C43E1C  ámbar funcional · contexto PowerPoint
   Tipografía:
     --f-display  "Space Grotesk"  titulares (geométrica, técnica)
     --f-body     "Inter"          UI / formularios
     --f-mono     "IBM Plex Mono"  etiquetas, datos, contadores
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --ink: #12141C;
  --ink-soft: #454A5E;
  --paper: #F7F8FC;
  --paper-dim: #ECEEF6;
  --brand: #4F5DFF;
  --brand-2: #7B8CFF;
  --word: #2B579A;
  --excel: #1E7145;
  --slide: #C43E1C;

  --f-display: 'Space Grotesk', sans-serif;
  --f-body: 'Inter', sans-serif;
  --f-mono: 'IBM Plex Mono', monospace;

  --bg: var(--paper);
  --bg-dim: var(--paper-dim);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.75);
  --card-shadow: 0 20px 60px -20px rgba(18, 20, 28, 0.25);
  --input-bg: rgba(255, 255, 255, 0.7);
  --divider: rgba(18, 20, 28, 0.08);

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.16,.8,.28,1);
}

[data-theme="dark"] {
  --bg: #0E0F16;
  --bg-dim: #12141C;
  --text: #F2F3F9;
  --text-soft: #A2A6BE;
  --glass: rgba(24, 26, 38, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --input-bg: rgba(255, 255, 255, 0.05);
  --divider: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
  transition: background .4s var(--ease), color .4s var(--ease);
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout raíz: split screen ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { display: none; }
}

/* ---------- Panel izquierdo: relato de marca + Stack (elemento firma) ---------- */
.auth-story {
  position: relative;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 15% 15%, rgba(79,93,255,.16), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(196,62,28,.10), transparent 40%),
    var(--bg-dim);
  overflow: hidden;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  z-index: 2;
}
.brand-mark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(79,93,255,.18); }

.story-copy { z-index: 2; max-width: 460px; }
.story-eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-2);
  margin-bottom: 14px;
}
.story-copy h1 {
  font-family: var(--f-display);
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.story-copy p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}

/* --- El Stack: tres ventanas superpuestas (Word / Excel / PowerPoint) --- */
.doc-stack {
  position: relative;
  height: 260px;
  margin: 40px 0 0;
  perspective: 1200px;
  z-index: 2;
}
.doc-card {
  position: absolute;
  width: 220px;
  height: 150px;
  border-radius: var(--radius-md);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  box-shadow: var(--card-shadow);
  padding: 14px 16px;
  transition: transform .5s var(--ease);
  will-change: transform;
}
.doc-card .tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 10px;
  color: #fff;
}
.doc-card.word   { top: 10px;  left: 0;   transform: rotate(-9deg) translateZ(0); }
.doc-card.excel  { top: 55px; left: 90px; transform: rotate(4deg) translateZ(20px); }
.doc-card.slide  { top: 115px; left: 25px; transform: rotate(-3deg) translateZ(40px); }
.doc-card.word .tag  { background: var(--word); }
.doc-card.excel .tag { background: var(--excel); }
.doc-card.slide .tag { background: var(--slide); }

.doc-card .lines span {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--divider);
  margin-bottom: 7px;
}
.doc-card .lines span:nth-child(1){ width: 90%; }
.doc-card .lines span:nth-child(2){ width: 70%; }
.doc-card .lines span:nth-child(3){ width: 80%; }

.doc-card .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.doc-card .grid i { height: 14px; border-radius: 3px; background: var(--divider); }
.doc-card .grid i.hi { background: color-mix(in srgb, var(--excel) 30%, transparent); }

.doc-card .slide-thumb {
  height: 74px;
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--slide) 25%, transparent), transparent);
  border: 1px dashed var(--divider);
}

.story-stats {
  z-index: 2;
  display: flex;
  gap: 28px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--text-soft);
}
.story-stats b { display: block; font-family: var(--f-display); font-size: 20px; color: var(--text); }

/* ---------- Panel derecho: tarjeta de autenticación ---------- */
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 36px 32px 30px;
  animation: rise .6s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.auth-card h2 {
  font-family: var(--f-display);
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.auth-card .sub { color: var(--text-soft); font-size: 13.5px; margin: 0 0 24px; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-dim);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 24px;
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--text-soft);
  transition: all .25s var(--ease);
}
.tabs a.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -4px rgba(79,93,255,.5); }

.field { margin-bottom: 16px; position: relative; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-soft);
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--divider);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,93,255,.18);
}
.field .toggle-pass {
  position: absolute;
  right: 12px;
  top: 34px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
}
.field .hint { font-size: 11.5px; color: var(--text-soft); margin-top: 5px; }
.field .hint.err { color: var(--slide); }
.field .hint.ok { color: var(--excel); }

.avatar-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.avatar-picker .preview {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg-dim);
  border: 1px solid var(--divider);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: 18px;
  flex-shrink: 0; overflow: hidden; position: relative;
}
.avatar-picker .preview img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: cover; display: block; }
.avatar-picker label {
  font-size: 12.5px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  cursor: pointer;
  transition: background .2s;
}
.avatar-picker label:hover { background: var(--bg-dim); }
.avatar-picker input[type=file] { display: none; }

.row-between { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 18px; font-size: 13px; }
.remember { display: flex; align-items: center; gap: 7px; color: var(--text-soft); }
.remember input { accent-color: var(--brand); }
.forgot { color: var(--brand); font-weight: 600; }
.forgot:hover { text-decoration: underline; }

.btn-primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  box-shadow: 0 10px 24px -8px rgba(79,93,255,.6);
  position: relative;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -8px rgba(79,93,255,.7); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary .spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
  display: inline-block; vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.divider-or {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0; color: var(--text-soft); font-size: 12px;
}
.divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: var(--divider); }

.btn-google {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--divider);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s, transform .2s var(--ease);
}
.btn-google:hover { background: var(--bg-dim); transform: translateY(-1px); }
.btn-google img { width: 18px; height: 18px; }

.foot-note { text-align: center; font-size: 13px; color: var(--text-soft); margin-top: 22px; }

/* ---------- Toggle modo oscuro ---------- */
.theme-toggle {
  position: fixed; top: 20px; right: 20px; z-index: 20;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text); font-size: 16px;
  transition: transform .3s var(--ease);
}
.theme-toggle:hover { transform: rotate(20deg); }

/* ---------- Alertas propias (fallback si SweetAlert2 aún no carga) ---------- */
.inline-alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
  border: 1px solid var(--divider);
}
.inline-alert.error { background: color-mix(in srgb, var(--slide) 12%, transparent); color: var(--slide); }
.inline-alert.success { background: color-mix(in srgb, var(--excel) 12%, transparent); color: var(--excel); }

.hidden { display: none !important; }
