/* ═══════════════════════════════════════════════════════════
   RUTH · SISTEMA CROMÁTICO (Unificado) - LOGIN
═══════════════════════════════════════════════════════════ */

/* ─── TIPOGRAFÍAS ─── */
@font-face { font-family: 'Brother 1816'; src: url('../B2CM/fonts/fonts/Brother-1816-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Brother 1816'; src: url('../B2CM/fonts/fonts/Brother-1816-Medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Brother 1816'; src: url('../B2CM/fonts/fonts/Brother-1816-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Brother 1816'; src: url('../B2CM/fonts/fonts/Brother-1816-Extra-Bold.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Abril Fatface'; src: url('../B2CM/fonts/fonts/AbrilFatface-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  /* ——— Modo claro (predeterminado) ——— */
  --bg: #FFFFFF;
  --bg-rgb: 255,255,255;
  --bg-2: #F7F5EF;
  --bg-3: #EFEBE1;
  --gold: #FFEDA8;
  --gold-bright: #FFF6D9;
  --gold-ink: #8A6B1F;
  --gold-border: #B8860B;
  --text-1: #14171A;
  --text-2: rgba(20,23,26,.80);
  --text-3: rgba(20,23,26,.58);
  --border: rgba(20,23,26,.10);
  --border-strong: rgba(20,23,26,.18);
  --accent: var(--gold-ink);
  --success: #178C4E;
  --error: #D62F2F;
  
  --f-body: 'Brother 1816', sans-serif;
  --f-display: 'Abril Fatface', serif;
}

:root[data-theme="dark"] {
  /* ——— Modo oscuro ——— */
  --bg: #0C0E0F;
  --bg-rgb: 12,14,15;
  --bg-2: #17191C;
  --bg-3: #22262A;
  --gold-ink: #FFF6D9;
  --gold-border: transparent;
  --text-1: #FFFFFF;
  --text-2: rgba(255,255,255,.80);
  --text-3: rgba(255,255,255,.56);
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.16);
  --accent: var(--gold);
  --success: #A9F5C8;
  --error: #FF5C5C;
}

/* ─── RESET Y BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Forzar tipografía en todos los elementos base */
body, input, button, textarea, select, label, p, span, div, a, li {
  font-family: var(--f-body);
}
h1, h2, h3, h4, h5, h6, .auth-title, .modal-card h3 {
  font-family: var(--f-display);
}

::selection { background: var(--gold); color: #0C0E0F; }

/* ─── CANVAS ─── */
#network-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  opacity: .4; pointer-events: none;
}

/* ═══════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════ */
.navbar-ruth {
  position: fixed; top: 0; left: 0; right: 0; height: 76px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 clamp(20px, 4vw, 60px); background: rgba(var(--bg-rgb), .86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); z-index: 1000;
}
.nav-left { display: flex; align-items: center; }
.nav-logo { display: block; height: 47px; width: auto; }
.nav-logo img { height: 100%; width: auto; display: block; }
.logo-dark { display: block; } .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; } :root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; } :root[data-theme="light"] .logo-light { display: block; }

.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-link { font-size: 14px; font-weight: 600; color: var(--text-2); text-decoration: none; transition: color .2s; display: flex; align-items: center; gap: 6px; }
.nav-link:hover { color: var(--text-1); }

.nav-right { display: flex; align-items: center; gap: 16px; }

/* THEME TOGGLE */
.theme-toggle {
  position: relative; width: 52px; height: 28px; border-radius: 100px; border: 1px solid var(--border-strong); background: var(--bg-3);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; padding: 0 6px; flex-shrink: 0; transition: .2s;
}
.theme-toggle:hover { border-color: var(--gold-ink); }
.theme-toggle svg { width: 13px; height: 13px; position: relative; z-index: 1; transition: .2s; }
.theme-toggle .tt-sun { stroke: var(--text-3); }
.theme-toggle .tt-moon { stroke: var(--gold-ink); }
.theme-toggle .tt-thumb {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright)); transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.theme-toggle.is-light .tt-thumb { transform: translateX(24px); }
.theme-toggle.is-light .tt-sun { stroke: var(--gold-ink); }
.theme-toggle.is-light .tt-moon { stroke: var(--text-3); }

/* MENU MÓVIL */
.nav-burger {
  display: none; position: relative; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-3); cursor: pointer; flex-shrink: 0; align-items: center; justify-content: center; padding: 0; margin-left: 8px;
}
.nav-burger span {
  position: absolute; left: 10px; width: 20px; height: 2px; background: var(--text-1); border-radius: 2px; transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.nav-burger span:nth-child(1) { top: 13px; } .nav-burger span:nth-child(2) { top: 19px; } .nav-burger span:nth-child(3) { top: 25px; }
.nav-burger.is-open span:nth-child(1) { top: 19px; transform: rotate(45deg); } .nav-burger.is-open span:nth-child(2) { opacity: 0; } .nav-burger.is-open span:nth-child(3) { top: 19px; transform: rotate(-45deg); }

.mobile-menu {
  display: none; position: fixed; top: 76px; left: 0; right: 0; background: rgba(var(--bg-rgb), .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  flex-direction: column; gap: 4px; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .3s ease, opacity .25s ease; border-bottom: 1px solid var(--border); z-index: 999;
}
.mobile-menu.is-open { max-height: 400px; opacity: 1; padding: 18px clamp(20px, 4vw, 60px) 24px; }
.mobile-menu a { padding: 12px 4px; font-size: 15px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); text-decoration: none; }
.mobile-menu a:last-child { border-bottom: none; }

/* ─── WRAPPER ─────────────────────────────────────────────── */
.auth-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  padding: 20px;
  margin-top: 50px; /* Separación del navbar */
}

/* ─── CARD ────────────────────────────────────────────────── */
.auth-card {
  background: var(--bg-3);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: 32px;
  padding: 40px 36px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  transition: transform 0.2s;
}
:root[data-theme="light"] .auth-card { box-shadow: 0 20px 60px rgba(0,0,0,.08); }

.auth-card.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}

/* ─── BRAND ───────────────────────────────────────────────── */
.auth-brand { text-align: center; margin-bottom: 8px; }
.auth-brand-img { height: 42px; width: auto; object-fit: contain; margin: 0 auto; }
.auth-tagline { text-align: center; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin-top: 8px; }
.auth-title { text-align: center; font-size: 1.8rem; font-weight: 600; color: var(--text-1); margin: 12px 0 26px; }

/* ─── MENSAJE ──────────────────────────────────────────────── */
#authMsg { margin-bottom: 16px; }
.auth-msg { padding: 10px 16px; border-radius: 12px; font-size: 0.85rem; text-align: center; font-weight: 500; }
.auth-msg.error { background: rgba(214,47,47,.1); border: 1px solid rgba(214,47,47,.2); color: var(--error); }
.auth-msg.info { background: rgba(255,237,168,.1); border: 1px solid rgba(255,237,168,.2); color: var(--accent); }

/* ─── FIELDS ───────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 20px; margin-bottom: 12px; }
.field { position: relative; width: 100%; }
.field input {
  width: 100%; padding: 18px 16px 6px 4px; background: transparent; border: none;
  border-bottom: 1px solid var(--border); color: var(--text-1); font-size: 0.95rem;
  font-family: inherit; outline: none; transition: border-color 0.3s;
}
.field input:focus { border-bottom-color: var(--accent); }
.field input:focus + label, .field input:not(:placeholder-shown) + label {
  transform: translateY(-16px) scale(0.8); color: var(--accent); letter-spacing: .08em; text-transform: uppercase;
}
.field label {
  position: absolute; left: 4px; top: 14px; color: var(--text-2); font-size: 0.9rem;
  pointer-events: none; transition: all 0.25s ease; transform-origin: left top;
}
.field-line {
  position: absolute; bottom: 0; left: 0; width: 0; height: 1px;
  background: var(--accent); transition: width 0.3s ease;
}
.field input:focus ~ .field-line { width: 100%; }

/* ─── CORRECCIÓN AUTOCOMPLETADO (AUTOFILL) ─── */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover, 
.field input:-webkit-autofill:focus, 
.field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-3) inset !important;
  -webkit-text-fill-color: var(--text-1) !important;
  caret-color: var(--text-1) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ─── EYE BUTTON ──────────────────────────────────────────── */
.eye-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: transparent;
  border: none; color: var(--text-3); font-size: 1.1rem; cursor: pointer; padding: 4px; transition: color 0.3s;
}
.eye-btn:hover { color: var(--accent); }

/* ─── FORGOT ───────────────────────────────────────────────── */
.forgot { text-align: right; font-size: 0.8rem; color: var(--text-2); cursor: pointer; margin: 8px 0 24px; transition: color 0.3s; }
.forgot:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ─── BUTTON ────────────────────────────────────────────────── */
.btn-auth {
  width: 100%; padding: 14px; background: var(--gold); border: 1px solid var(--gold-border);
  border-radius: 12px; color: #0C0E0F; font-size: 0.95rem; font-weight: 700; cursor: pointer;
  transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px;
}
.btn-auth:hover { background: var(--gold-bright); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,237,168,.3); }
.btn-auth:active { transform: scale(0.98); }

/* ─── DIVIDER ───────────────────────────────────────────────── */
.divider-line { display: flex; align-items: center; gap: 16px; margin: 24px 0 20px; color: var(--text-3); font-size: 0.8rem; }
.divider-line::before, .divider-line::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── ALT ──────────────────────────────────────────────────── */
.auth-alt { text-align: center; font-size: 0.9rem; color: var(--text-2); }
.auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; transition: color 0.3s; }
.auth-alt a:hover { color: var(--text-1); text-decoration: underline; text-underline-offset: 3px; }

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); z-index: 1200;
  display: flex; align-items: center; justify-content: center; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-card {
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 24px; padding: 36px 32px 32px;
  max-width: 400px; width: 90%; position: relative; box-shadow: 0 24px 50px rgba(0,0,0,.4);
}
.modal-close { position: absolute; top: 16px; right: 20px; background: transparent; border: none; color: var(--text-3); font-size: 1.4rem; cursor: pointer; transition: color 0.3s; }
.modal-close:hover { color: var(--text-1); }
.modal-card h3 { margin-bottom: 8px; color: var(--text-1); font-size: 1.4rem; }
.modal-card p { color: var(--text-2); font-size: 0.9rem; margin-bottom: 16px; }

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .nav-links { display: none; }
}

@media (max-width: 768px) {
  .navbar-ruth { padding: 0 20px; }
  .nav-burger { display: flex; }
  .mobile-menu { display: flex; }
  .nav-right .nav-cta { display: none; }
  
  .auth-card { padding: 36px 24px 32px; }
  .auth-title { font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 20px 24px; }
  .auth-title { font-size: 1.35rem; }
}