/* ═══════════════════════════════════════════════════════════
   auth.css — Estilos de autenticación compartidos
   Guía FYO · guiafyo.com
   Incluye: nav auth buttons, modal, toast, accesibilidad
   ═══════════════════════════════════════════════════════════ */

/* ── Z-INDEX SCALE ──
   800: cookie banner
   900: user menu dropdown
   1000: auth overlay
   1100: toast notifications
   ─────────────────── */

/* ═══ NAV AUTH BUTTONS ═══ */
.login-btn {
  background: transparent;
  color: #FFD166;
  border: 2px solid rgba(255,209,102,0.5);
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Nunito', sans-serif;
}
.login-btn:hover {
  background: #FFD166;
  color: #0D1B2A;
  border-color: #FFD166;
}
.login-btn:focus-visible {
  outline: 2px solid #FFD166;
  outline-offset: 2px;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 6px 14px 6px 6px;
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}
.user-btn:hover {
  background: rgba(255,255,255,0.14);
}
.user-btn:focus-visible {
  outline: 2px solid #FFD166;
  outline-offset: 2px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1DBFA3, #17a88e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

/* ═══ USER MENU DROPDOWN ═══ */
.user-menu {
  position: absolute;
  top: 60px;
  right: 16px;
  background: #1a2744;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 8px 0;
  min-width: 200px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 900;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.user-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.user-menu a, .user-menu button {
  display: block;
  width: 100%;
  padding: 10px 18px;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.15s;
}
.user-menu a:hover, .user-menu button:hover {
  background: rgba(255,255,255,0.08);
}
.user-menu button:last-child {
  color: #f87171;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
  padding-top: 12px;
}

/* ═══ AUTH MODAL OVERLAY ═══ */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.auth-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ═══ AUTH MODAL BOX ═══ */
.auth-box {
  background: #0f1b2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-overlay.open .auth-box {
  transform: scale(1) translateY(0);
}

/* ═══ AUTH HEADER ═══ */
.auth-header {
  text-align: center;
  padding: 28px 28px 16px;
  position: relative;
}
.auth-header h2 {
  color: #FFD166;
  font-family: 'Fredoka One', cursive;
  font-size: 22px;
  margin: 0 0 6px;
}
.auth-header p {
  color: #94a3b8;
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
}
.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.06);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.auth-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.auth-close:focus-visible {
  outline: 2px solid #FFD166;
  outline-offset: 2px;
}

/* ═══ AUTH TABS ═══ */
.auth-tabs {
  display: flex;
  padding: 0 28px;
  gap: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
}
.auth-tab.active {
  color: #FFD166;
  border-bottom-color: #FFD166;
}
.auth-tab:hover:not(.active) {
  color: #94a3b8;
}
.auth-tab:focus-visible {
  outline: 2px solid #FFD166;
  outline-offset: -2px;
}

/* ═══ AUTH BODY (form) ═══ */
.auth-body {
  padding: 20px 28px 28px;
}

/* Messages */
.auth-error {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}
.auth-error[style*="display: block"], .auth-error.visible {
  display: block;
}

.auth-success {
  background: rgba(29,191,163,0.12);
  color: #1DBFA3;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}
.auth-success[style*="display: block"], .auth-success.visible {
  display: block;
}

/* Fields */
.auth-field {
  margin-bottom: 14px;
}
.auth-label {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.auth-input-wrap {
  position: relative;
}
.auth-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #f1f5f9;
  font-size: 15px;
  font-family: 'Nunito', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.auth-input:focus {
  outline: none;
  border-color: #1DBFA3;
  box-shadow: 0 0 0 3px rgba(29,191,163,0.15);
}
.auth-input.input-error {
  border-color: #f87171;
}
.auth-input.input-ok {
  border-color: #1DBFA3;
}

/* Password toggle */
.auth-pass-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.auth-pass-toggle:hover {
  color: #94a3b8;
}

/* Password strength */
.auth-pass-strength {
  height: 3px;
  border-radius: 2px;
  margin-top: 6px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  transition: opacity 0.2s;
}
.auth-pass-strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}
.strength-weak  { width: 33% !important; background: #f87171; }
.strength-ok    { width: 66% !important; background: #fbbf24; }
.strength-good  { width: 100% !important; background: #1DBFA3; }

/* ═══ AUTH BUTTONS ═══ */
.auth-btn {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: 'Nunito', sans-serif;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}
.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.auth-btn:focus-visible {
  outline: 2px solid #FFD166;
  outline-offset: 2px;
}

.auth-btn.primary {
  background: linear-gradient(135deg, #1DBFA3, #17a88e);
  color: #0D1B2A;
}
.auth-btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(29,191,163,0.3);
}

.auth-btn.google {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.12);
  margin-top: 0;
}
.auth-btn.google:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

/* Loading spinner in button */
.auth-btn .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Divider */
.auth-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
}
.auth-divider span {
  position: relative;
  background: #0f1b2e;
  padding: 0 14px;
  color: #64748b;
  font-size: 13px;
}

/* Forgot password link */
.auth-forgot {
  display: block;
  text-align: right;
  color: #1DBFA3;
  font-size: 13px;
  text-decoration: none;
  margin: -6px 0 14px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Nunito', sans-serif;
  margin-left: auto;
}
.auth-forgot:hover {
  text-decoration: underline;
}

/* Back to login (from forgot password view) */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Nunito', sans-serif;
  margin-bottom: 14px;
}
.auth-back:hover {
  color: #e2e8f0;
}

/* ═══ TOAST NOTIFICATIONS ═══ */
.fyo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a2744;
  color: #f1f5f9;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.fyo-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.fyo-toast.toast-error {
  border-color: rgba(248,113,113,0.3);
  background: #2a1520;
}
.fyo-toast.toast-success {
  border-color: rgba(29,191,163,0.3);
}

/* ═══ ACCESSIBILITY ═══ */
@media (prefers-reduced-motion: reduce) {
  .auth-overlay,
  .auth-box,
  .user-menu,
  .fyo-toast,
  .auth-btn,
  .auth-input,
  .auth-pass-strength-bar {
    transition: none !important;
    animation: none !important;
  }
}

/* Focus trap visual */
.auth-overlay:focus {
  outline: none;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 480px) {
  .auth-box {
    max-width: 100%;
    border-radius: 16px;
    margin: 8px;
  }
  .auth-header {
    padding: 20px 20px 12px;
  }
  .auth-header h2 {
    font-size: 20px;
  }
  .auth-tabs {
    padding: 0 20px;
  }
  .auth-body {
    padding: 16px 20px 24px;
  }
  .auth-btn {
    padding: 12px;
    font-size: 14px;
  }
  .user-menu {
    right: 8px;
    min-width: 180px;
  }
}

@media (max-width: 360px) {
  .auth-box {
    margin: 4px;
  }
  .auth-header {
    padding: 16px 16px 10px;
  }
  .auth-tabs {
    padding: 0 16px;
  }
  .auth-body {
    padding: 12px 16px 20px;
  }
}
