/* =============================================================================
   login.css — GomokuVN Login Page
   Style: High-End Agency, Soft Structuralism, Editorial Split
   ============================================================================= */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input, button, textarea, select { font-family: inherit; }

:root {
  /* Colours come from css/tokens.css (mode-aware); login-only aliases below. */
  --c-border-strong: color-mix(in srgb, var(--c-ink) 55%, transparent);   /* ui-audit F8: input resting border >=3:1 (was the 12% divider) */

  /* Typography */
  --font:          'Nunito', system-ui, -apple-system, sans-serif;
  
  /* Fluid Dynamics */
  --ease-spring:   cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);
}

html, body {
  height: 100%;
  font-family: var(--font);
  background-color: var(--c-bg);
  color: var(--c-ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Layout: Editorial Split ──────────────────────────────────────────────── */
.page-split {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── Language switcher mount point (TODO.md #120) ─────────────────────────── */
.login-lang-switch-row {
  width: 100%;
  max-width: 440px; /* matches .login-shell so the button aligns to its right edge */
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.split-left {
  flex: 1;
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--c-border);
}

.split-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--c-bg);
}

/* ── Brand Content ────────────────────────────────────────────────────────── */
.brand-content {
  position: relative;
  z-index: 10;
  max-width: 500px;
}

@keyframes blur-fade-up {
  0% { opacity: 0; transform: translateY(40px); filter: blur(12px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.anim-entry {
  opacity: 0;
  animation: blur-fade-up 1.2s var(--ease-spring) forwards;
}
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

.brand-logo {
  display: block;
  border-radius: 12px;
  margin-bottom: 16px;
}

.brand-eyebrow {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 1px solid var(--c-border-strong);
  font-size: calc(11px * var(--fs-scale, 1));
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--c-ink-2);
  margin-bottom: 24px;
}

.brand-title {
  font-size: calc(82px * var(--fs-scale, 1));
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--c-ink);
  margin-bottom: 20px;
}

.brand-subtitle {
  font-size: calc(20px * var(--fs-scale, 1));
  font-weight: 400;
  color: var(--c-ink-2);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* ── Abstract Board Graphic ───────────────────────────────────────────────── */
.abstract-board-wrapper {
  position: absolute;
  bottom: -50px;
  right: -50px;
  width: 600px;
  height: 600px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

.abstract-board {
  width: 100%;
  height: 100%;
  transform: translate(calc(var(--mx, 0) * -15px), calc(var(--my, 0) * -15px));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.abstract-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.parallax-white {
  transform: translate(calc(var(--mx, 0) * -2px), calc(var(--my, 0) * -2px));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.anim-piece-white {
  animation: float-white 6s ease-in-out infinite;
  transform-origin: 50px 30px;
}

.parallax-black {
  transform: translate(calc(var(--mx, 0) * -4px), calc(var(--my, 0) * -4px));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.anim-piece-black {
  animation: float-black 8s ease-in-out infinite reverse;
  transform-origin: 30px 40px;
}

@keyframes float-white {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.05); }
}
@keyframes float-black {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.02); }
}

/* ── Double-Bezel Architecture ────────────────────────────────────────────── */
.login-shell {
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--c-border);
  border-radius: 2rem;
  padding: 6px;
  width: 100%;
  max-width: 440px;
  box-shadow: 
    0 20px 40px -10px rgba(0,0,0,0.05),
    0 1px 3px rgba(0,0,0,0.02);
}

.login-core {
  background: var(--c-surface);
  border-radius: calc(2rem - 6px);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.8);
  border: 1px solid var(--c-border);
  overflow: hidden;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  padding: 8px;
  margin: 16px 16px 0;
  background: var(--c-bg);
  border-radius: 999px;
  border: 1px solid var(--c-border);
}

.tab-btn {
  flex: 1;
  padding: 12px 0;
  font-size: calc(14px * var(--fs-scale, 1));
  font-weight: 600;
  color: var(--c-ink-3);
  background: transparent;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.4s var(--ease-spring);
}

.tab-btn.active {
  background: var(--c-surface);
  color: var(--c-ink);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tab-btn:not(.active):hover {
  color: var(--c-ink-2);
}

/* ── Form Panels ──────────────────────────────────────────────────────────── */
.panel {
  display: none;
  padding: 32px 40px 40px;
  animation: fade-up 0.6s var(--ease-spring);
}
.panel.active { display: block; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Form Fields ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 24px; }

.field label {
  display: block;
  font-size: calc(12px * var(--fs-scale, 1));
  font-weight: 600;
  color: var(--c-ink-2);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: calc(15px * var(--fs-scale, 1));
  font-family: var(--font);
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong);
  border-radius: 12px;
  outline: none;
  transition: all 0.3s var(--ease-spring);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.field input::placeholder { color: var(--c-ink-3); font-weight: 400; }
.field input:focus {
  border-color: var(--c-brand);
  background: var(--c-field);
  box-shadow: 0 0 0 4px var(--c-brand-light);
}
.field input.error {
  border-color: var(--c-error);
  background: var(--c-error-bg);
}

.input-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--c-surface-2);
  border: none;
  cursor: pointer;
  color: var(--c-ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: color 0.3s var(--ease-spring), background 0.3s var(--ease-spring);
}

.password-toggle:hover {
  color: var(--c-ink);
  background: rgba(0,0,0,0.04);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.92) !important;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Ensure text doesn't overlap the toggle */
.input-wrapper input {
  padding-right: 48px;
}

.field-error {
  font-size: calc(12px * var(--fs-scale, 1));
  color: var(--c-error);
  margin-top: 6px;
  display: none;
  font-weight: 500;
}
.field-error.visible { display: block; }

/* ── Magnetic Buttons (Button-in-Button) ──────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 10px 10px 24px;
  font-size: calc(15px * var(--fs-scale, 1));
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), background 0.3s ease;
}

.btn:active { transform: scale(0.97) !important; }

.btn-text {
  flex: 1;
  text-align: center;
  margin-right: 14px;
}

.btn-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: transform 0.4s var(--ease-spring);
}
.btn-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.4s var(--ease-spring);
}

.btn-primary {
  background: var(--c-brand);
  color: #FFFFFF;
  margin-top: 12px;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--c-brand-dark);
}

.btn-primary:hover .btn-icon-wrapper {
  transform: translateX(-2px) scale(1.05);
  background: rgba(255,255,255,0.25);
}
.btn-primary:hover .btn-icon {
  transform: translate(2px, -1px);
}

.btn-primary:disabled {
  background: var(--c-ink-3);
  cursor: not-allowed;
  transform: none;
}

/* ── Guest Button ─────────────────────────────────────────────────────────── */
.guest-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 40px 40px;
}

.btn-guest {
  background: var(--c-surface);
  color: var(--c-ink);
  border: 1px solid var(--c-border-strong);
  padding: 10px 10px 10px 24px;
}

.btn-guest .btn-icon-wrapper {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
}

.btn-guest:hover {
  background: var(--c-bg);
  border-color: var(--c-ink-3);
}

.btn-guest:hover .btn-icon-wrapper {
  transform: translateX(-2px) scale(1.05);
  background: var(--c-fill);
}
.btn-guest:hover .btn-icon {
  transform: translate(2px, -1px);
}

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 40px;
  margin: 0 0 32px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}
.divider span {
  font-size: calc(11px * var(--fs-scale, 1));
  color: var(--c-ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Alert Banner ─────────────────────────────────────────────────────────── */
.alert {
  margin: 24px 40px 0;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: calc(13px * var(--fs-scale, 1));
  font-weight: 500;
  display: none;
  animation: fade-up 0.4s var(--ease-spring);
}
.alert.visible { display: block; }

.alert-error {
  background: var(--c-error-bg);
  color: var(--c-error);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.alert-success {
  background: var(--c-success-bg);
  color: var(--c-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.page-footer {
  margin-top: 32px;
  font-size: calc(13px * var(--fs-scale, 1));
  color: var(--c-ink-3);
  font-weight: 500;
}

/* ── Responsive Mobile ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .brand-title { font-size: calc(64px * var(--fs-scale, 1)); }
  .abstract-board { width: 400px; height: 400px; }
  .split-left { padding: 40px; }
}

@media (max-width: 768px) {
  .page-split {
    flex-direction: column;
  }
  
  .split-left {
    flex: none;
    padding: 64px 24px 40px;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    align-items: center;
    text-align: center;
  }
  
  .brand-title { font-size: calc(48px * var(--fs-scale, 1)); }
  .brand-subtitle { font-size: calc(16px * var(--fs-scale, 1)); }
  .abstract-board { display: none; }
  
  .split-right {
    padding: 32px 16px;
    align-items: stretch;
  }
  
  .login-shell {
    max-width: 100%;
  }

  .panel { padding: 24px 20px 32px; }
  .guest-section { padding: 0 20px 32px; }
  .divider { padding: 0 20px; }
}

/* ── Loading spinner (inline) ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }
