/* ============================================================
   login.css — Pantalla de acceso "Seafight" estilo juego
   Fondo animado, panel con borde dorado en movimiento, tabs
   login/registro, estados de carga y toasts de feedback.
   ============================================================ */

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

:root {
  --gold-1: #ffe9a8;
  --gold-2: #f0c95c;
  --gold-3: #a8853d;
  --gold-4: #6b4d16;
  --ember: #ff8a1d;
  --panel-bg: rgba(12, 7, 3, 0.86);
  --err: #ff6b5e;
  --ok: #7dff9a;
  --info: #7ecfff;
}

html, body { height: 100%; }

body {
  font-family: Verdana, Arial, sans-serif;
  color: #e8dcbb;
  overflow: hidden;
  background: #05030a;
}

/* ---------- Fondo: escena con Ken Burns + viñeta ---------- */
.bg-scene {
  position: fixed;
  inset: -6%;
  background: url('../home/SF_Body_Background.jpg') center 30% / cover no-repeat;
  animation: kenburns 45s ease-in-out infinite alternate;
  filter: saturate(1.05);
}
@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.12) translate(-1.5%, -2%); }
}
.bg-vignette {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(0,0,0,0) 30%, rgba(0,0,0,0.78) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.1) 35%, rgba(2,6,10,0.8) 100%);
}

/* niebla que cruza lenta */
.bg-fog {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 30% at 30% 70%, rgba(140,170,190,0.10), transparent 70%),
              radial-gradient(ellipse 50% 25% at 75% 60%, rgba(140,170,190,0.08), transparent 70%);
  animation: fogdrift 60s linear infinite;
  pointer-events: none;
}
@keyframes fogdrift {
  from { transform: translateX(-8%); }
  to   { transform: translateX(8%); }
}

#embers { position: fixed; inset: 0; pointer-events: none; }

/* ---------- Olas inferiores ---------- */
.waves {
  position: fixed;
  left: 0; right: 0; bottom: -6px;
  height: 110px;
  pointer-events: none;
  opacity: 0.5;
}
.waves svg { position: absolute; bottom: 0; width: 200%; height: 100%; }
.waves .w1 { animation: waveslide 16s linear infinite; fill: rgba(10, 40, 60, 0.85); }
.waves .w2 { animation: waveslide 23s linear infinite reverse; fill: rgba(6, 25, 40, 0.9); bottom: -12px; }
@keyframes waveslide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Layout central ---------- */
.stage {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px;
}

/* Logo */
.logo-wrap { text-align: center; user-select: none; }
.logo-heads {
  width: 214px; height: 67px;
  margin: 0 auto 2px;
  background: url('../home/heads.png') center / contain no-repeat;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.9));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.logo-text {
  position: relative;
  display: inline-block;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: bold;
  font-size: 54px;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #fff3b0 0%, #f5cf58 38%, #a86e14 72%, #ffdf7e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 3px #000) drop-shadow(0 0 14px rgba(150,90,0,0.55));
}
/* destello que barre el logo */
.logo-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,0.85) 50%, transparent 58%) no-repeat;
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logoshine 5.5s ease-in-out infinite;
}
@keyframes logoshine {
  0%, 55% { background-position: 130% 0; }
  75%, 100% { background-position: -130% 0; }
}
.logo-sub {
  margin-top: -4px;
  font-size: 10px;
  letter-spacing: 6px;
  color: #9c8250;
  text-transform: uppercase;
}

/* ---------- Panel con borde dorado animado ---------- */
.panel {
  position: relative;
  width: 400px;
  max-width: 94vw;
  border-radius: 12px;
  padding: 2px; /* grosor del borde animado */
  background: conic-gradient(from var(--ang, 0deg),
    #6b4d16 0%, #f5cf58 12%, #fff3c9 18%, #f5cf58 24%, #6b4d16 40%,
    #8a6a24 55%, #f0c95c 68%, #6b4d16 82%, #6b4d16 100%);
  animation: borderspin 6s linear infinite;
  box-shadow:
    0 0 24px rgba(240, 190, 80, 0.18),
    0 18px 50px rgba(0,0,0,0.85);
}
@property --ang {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes borderspin { to { --ang: 360deg; } }

/* fallback si @property no esta soportado: pulso de brillo */
@supports not (background: conic-gradient(from var(--ang, 0deg), #000, #fff)) {
  .panel { animation: borderpulse 3s ease-in-out infinite; }
  @keyframes borderpulse {
    0%, 100% { box-shadow: 0 0 16px rgba(240,190,80,0.15), 0 18px 50px rgba(0,0,0,0.85); }
    50% { box-shadow: 0 0 34px rgba(240,190,80,0.4), 0 18px 50px rgba(0,0,0,0.85); }
  }
}

.panel-inner {
  position: relative;
  border-radius: 10px;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(240,190,80,0.08), transparent 55%),
    var(--panel-bg);
  backdrop-filter: blur(7px);
  padding: 20px 26px 24px;
  overflow: hidden;
}

/* ---------- Tabs ---------- */
.tabs {
  position: relative;
  display: flex;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(168,133,61,0.35);
}
.tab {
  flex: 1;
  padding: 9px 0 10px;
  background: none;
  border: none;
  color: #9c8250;
  font-family: Georgia, serif;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.25s;
}
.tab:hover { color: var(--gold-1); }
.tab.active { color: var(--gold-1); text-shadow: 0 0 10px rgba(240,190,80,0.5); }
.tab-ink {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-2), transparent);
  box-shadow: 0 0 8px rgba(240,190,80,0.8);
  transition: transform 0.3s cubic-bezier(.6,.05,.3,1);
}
.tabs[data-active="register"] .tab-ink { transform: translateX(100%); }

/* ---------- Formularios (swap con slide) ---------- */
.forms { position: relative; }
form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
form.form-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(26px);
  pointer-events: none;
}
form.form-visible { opacity: 1; transform: translateX(0); }

/* ---------- Campos ---------- */
.field { position: relative; }
.field input {
  width: 100%;
  padding: 13px 40px 13px 40px;
  background: rgba(255, 240, 200, 0.05);
  border: 1px solid rgba(168,133,61,0.45);
  border-radius: 7px;
  color: #f5ecd2;
  font-size: 14px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field input::placeholder { color: transparent; }
.field label {
  position: absolute;
  left: 38px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #9c8250;
  pointer-events: none;
  transition: all 0.18s ease;
  background: transparent;
  padding: 0 4px;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 0;
  font-size: 10px;
  color: var(--gold-2);
  background: linear-gradient(180deg, transparent 45%, rgba(12,7,3,0.95) 45%);
}
.field input:focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 1px rgba(240,190,80,0.35), 0 0 16px rgba(240,190,80,0.18);
  background: rgba(255, 240, 200, 0.08);
}
.field .f-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  opacity: 0.75;
  fill: #c8a34a;
  pointer-events: none;
}
.field .toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
}
.field .toggle-pass:hover { opacity: 1; }
.field .toggle-pass svg { width: 17px; height: 17px; fill: #c8a34a; }

/* estados de campo */
.field.error input { border-color: var(--err); box-shadow: 0 0 10px rgba(255,90,70,0.25); animation: shake 0.35s; }
.field.ok input { border-color: rgba(90, 200, 120, 0.7); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.field-msg {
  min-height: 13px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--err);
  padding-left: 4px;
  transition: opacity 0.2s;
}

/* Barra de fuerza de contraseña */
.strength {
  height: 4px;
  margin-top: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.strength > div {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--err);
  transition: width 0.3s ease, background 0.3s ease;
}

/* ---------- Botón principal ---------- */
.btn-main {
  position: relative;
  margin-top: 4px;
  padding: 13px;
  border: none;
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: bold;
  font-style: italic;
  letter-spacing: 1px;
  color: #fff3d6;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  cursor: pointer;
  background: linear-gradient(180deg, #ff9c2b 0%, #d95f10 55%, #9c3a04 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,230,170,0.6),
    inset 0 -8px 14px rgba(0,0,0,0.35),
    0 4px 14px rgba(0,0,0,0.6);
  overflow: hidden;
  transition: filter 0.2s, transform 0.12s;
}
.btn-main:hover:not(:disabled) { filter: brightness(1.15); }
.btn-main:active:not(:disabled) { transform: translateY(1px); }
.btn-main:disabled { filter: grayscale(0.5) brightness(0.75); cursor: not-allowed; }
/* barrido de luz */
.btn-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.35) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 130% 0;
  transition: none;
}
.btn-main:hover:not(:disabled)::after { animation: btnsweep 0.9s ease forwards; }
@keyframes btnsweep { to { background-position: -130% 0; } }

/* spinner dentro del botón */
.btn-spinner {
  display: none;
  width: 17px; height: 17px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 2px solid rgba(255,240,200,0.35);
  border-top-color: #fff3d6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-main.loading .btn-spinner { display: inline-block; }
.btn-main.loading { pointer-events: none; }

/* ---------- Pie del panel ---------- */
.panel-foot {
  margin-top: 14px;
  text-align: center;
  font-size: 10px;
  color: #8a744a;
}
.panel-foot a { color: #c8a34a; text-decoration: none; }
.panel-foot a:hover { color: var(--gold-1); text-decoration: underline; }

/* ---------- Estado del servidor ---------- */
.server-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(168,133,61,0.3);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.server-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #888;
}
.server-status.online .dot { background: #4dff88; box-shadow: 0 0 8px #4dff88; animation: pulse 2s ease-in-out infinite; }
.server-status.offline .dot { background: #ff5c4d; box-shadow: 0 0 8px #ff5c4d; }
.server-status.online { color: #9fe8b8; }
.server-status.offline { color: #ffb3ab; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* ---------- Toasts ---------- */
#toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 280px;
  max-width: 460px;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(10, 6, 2, 0.92);
  border: 1px solid var(--gold-4);
  box-shadow: 0 6px 24px rgba(0,0,0,0.8);
  animation: toastin 0.35s cubic-bezier(.2,.9,.3,1.2);
}
.toast.out { animation: toastout 0.3s ease forwards; }
@keyframes toastin {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastout {
  to { opacity: 0; transform: translateY(-12px); }
}
.toast .t-icon { font-size: 15px; }
.toast.error { border-color: rgba(255,90,70,0.6); color: #ffc9c2; }
.toast.success { border-color: rgba(90,200,120,0.6); color: #c8f5d4; }
.toast.info { border-color: rgba(110,180,255,0.5); color: #cfe8ff; }

/* ---------- Overlay de bienvenida ---------- */
#welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(2, 1, 0, 0.88);
  backdrop-filter: blur(6px);
}
#welcome-overlay.show { display: flex; animation: fadein 0.4s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#welcome-overlay .compass {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid var(--gold-3);
  border-top-color: var(--gold-1);
  animation: spin 1.1s linear infinite;
  box-shadow: 0 0 24px rgba(240,190,80,0.3);
}
#welcome-overlay .w-title {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 26px;
  color: var(--gold-1);
  text-shadow: 0 2px 8px #000;
}
#welcome-overlay .w-sub { font-size: 12px; color: #9c8250; }

/* ---------- Responsive / motion ---------- */
@media (max-height: 640px) {
  .logo-heads { display: none; }
  .logo-text { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-scene, .bg-fog, .waves .w1, .waves .w2, .panel, .logo-text::after, .logo-heads { animation: none !important; }
}
