/* ════════════════════════════════════════════════════════════════════
   TOP JOURNAL — Minimalist Login Page Stylesheet (White/Blue/Black)
   Aesthetic: Clean light theme, high-contrast black typography, 
              vibrant blue accents, crisp borders, and subtle glow.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* Black / Blue / Gray / White (login = light canvas) */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e5e5e5;
  
  --text-primary: #0a0a0a;   /* near black */
  --text-secondary: #525252; /* gray */
  --text-tertiary: #a3a3a3;  /* light gray */
  
  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-light: #eff6ff;
  --accent-blue-glow: rgba(37, 99, 235, 0.12);
  
  --border-light: #e5e5e5;
  --border-focus: #2563eb;
  
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  
  /* Fonts — minimal, readable TH/EN */
  --ff-sans: "Inter", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-mono: "Inter", "Noto Sans Thai", ui-monospace, monospace;
  --ff-display: "Inter", "Noto Sans Thai", system-ui, sans-serif;
  
  /* Transitions & Shadows */
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 
                 0 10px 15px -3px rgba(0, 0, 0, 0.05), 
                 0 20px 25px -5px rgba(0, 0, 0, 0.02),
                 0 0 50px rgba(37, 99, 235, 0.03);
  --shadow-focus: 0 0 0 4px rgba(37, 99, 235, 0.1);
  --shadow-button: 0 4px 12px rgba(15, 23, 42, 0.1);
}

/* ── Reset & General ────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ff-sans);
  font-size: 15px;
  font-weight: 400;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Elegant light grid overlay & radial glows */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 1;
}

body::after {
  content: "";
  position: absolute;
  top: 10%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.04) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 1;
  filter: blur(40px);
}

/* Second glow in the bottom right */
.auth-bg-glow {
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.03) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 1;
  filter: blur(40px);
}

/* ── Boot Loader ────────────────────────────────────── */
.boot-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.boot-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-logo {
  margin-bottom: 24px;
  animation: pulse-logo 2s infinite ease-in-out;
}

@keyframes pulse-logo {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.05); opacity: 1; }
}

.boot-text {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.boot-bar {
  width: 120px;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.boot-bar span {
  display: block;
  height: 100%;
  background: var(--accent-blue);
  width: 40%;
  animation: loading-bar 1.5s infinite ease-in-out;
}

@keyframes loading-bar {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(250%); }
}

/* ── Ticker Strip ───────────────────────────────────── */
.auth-ticker {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  overflow: hidden;
  z-index: 5;
  display: flex;
  align-items: center;
}

.auth-ticker__inner {
  display: flex;
  white-space: nowrap;
  animation: ticker 40s linear infinite;
  padding-left: 20px;
}

.auth-ticker__inner span {
  display: inline-flex;
  align-items: center;
  margin-right: 32px;
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-ticker__inner b {
  margin-left: 6px;
  font-weight: 600;
}

.auth-ticker__inner b.is-pos {
  color: #16a34a; /* Crisp Green */
}

.auth-ticker__inner b.is-neg {
  color: #dc2626; /* Crisp Red */
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Container Layout ───────────────────────────────── */
.auth-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 32px;
  z-index: 2;
  position: relative;
}

.auth-shell {
  width: 100%;
  max-width: 1140px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 64px;
  align-items: center;
}

/* ── Left Column: Hero Content ──────────────────────── */
.auth-hero {
  display: flex;
  flex-direction: column;
}

.auth-hero__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.auth-hero__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent-blue-light);
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--accent-blue);
}

.auth-hero__brandname {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.auth-hero__tagline {
  font-family: var(--ff-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent-blue);
  letter-spacing: 0;
  margin-top: 3px;
  line-height: 1.4;
}

.auth-hero__headline {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: clamp(2.25rem, 5vw, 3.25rem); /* larger: ~36–52px */
  letter-spacing: -0.025em;
  line-height: 1.28;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.auth-hero__headline .auth-hero__line {
  font-size: inherit;
}

.auth-hero__line {
  display: block;
}

.auth-hero__accent {
  position: relative;
  background: linear-gradient(120deg, #06b6d4, #2563eb, #ec4899, #06b6d4);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine 4s linear infinite;
  display: inline-block;
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.auth-hero__desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 36px;
  max-width: 480px;
}

.auth-hero__desc b {
  font-weight: 600;
  color: var(--text-primary);
}

/* Features List */
.auth-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 36px;
}

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-feature__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent-blue-light);
  border: 1px solid rgba(37, 99, 235, 0.1);
  color: var(--accent-blue);
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-feature__icon svg {
  width: 15px;
  height: 15px;
}

.auth-feature div b {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-feature div span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Counters Row */
.auth-counters {
  display: flex;
  gap: 32px;
  margin-bottom: 36px;
  border-top: 1px dashed var(--border-light);
  border-bottom: 1px dashed var(--border-light);
  padding: 16px 0;
}

.auth-counter {
  display: flex;
  flex-direction: column;
}

.auth-counter b {
  font-family: var(--ff-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.auth-counter span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Quote Box */
.auth-quote {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  max-width: 480px;
  transition: var(--transition);
}

.auth-quote__mark {
  font-family: var(--ff-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 0.8;
}

.auth-quote__text {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 4px;
  transition: opacity 0.5s ease;
}

.auth-quote__author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: opacity 0.5s ease;
}

/* ── Right Column: Form Card ────────────────────────── */
.auth-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.auth-card__head {
  margin-bottom: 24px;
}

.auth-title {
  font-family: var(--ff-display);
  font-weight: 600;
  font-size: 1.375rem;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Tabs */
.auth-tabs {
  position: relative;
  display: flex;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 24px;
  user-select: none;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
  text-align: center;
}

.auth-tab.is-active {
  color: var(--text-primary);
}

.auth-tab__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--bg-primary);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  z-index: 1;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-tabs[data-tab="signup"] .auth-tab__indicator {
  transform: translateX(100%);
}

/* Form inputs & floating labels */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px 14px 40px;
  font-size: 0.95rem;
  font-family: var(--ff-sans);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.auth-field input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.auth-field label {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-secondary);
  pointer-events: none;
  transition: var(--transition);
  transform-origin: left top;
}

/* Keep label floating if focused or input has text */
.auth-field input:focus ~ label,
.auth-field input:not(:placeholder-shown) ~ label {
  transform: translateY(-136%) scale(0.8);
  color: var(--accent-blue);
  background: var(--bg-primary);
  padding: 0 4px;
  left: 36px;
}

.auth-field__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.auth-field input:focus ~ .auth-field__icon {
  color: var(--accent-blue);
}

.auth-field__eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: var(--transition);
}

.auth-field__eye:hover {
  color: var(--text-primary);
}

/* Password Strength Meter */
.auth-strength {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: -6px;
  transition: var(--transition);
}

.auth-strength__bar {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.auth-strength__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: #f87171; /* Weak Red */
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}

/* Color codes for password strength classes */
.auth-strength__bar span[style*="width: 20%"] { background: #f87171; }
.auth-strength__bar span[style*="width: 40%"] { background: #facc15; }
.auth-strength__bar span[style*="width: 60%"] { background: #facc15; }
.auth-strength__bar span[style*="width: 80%"] { background: #4ade80; }
.auth-strength__bar span[style*="width: 100%"] { background: #10b981; }

.auth-strength__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Error message box */
.auth-error {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #dc2626;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Primary Button */
.btn {
  font-family: var(--ff-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--primary {
  background: var(--text-primary); /* Slate-900 / Black */
  color: var(--bg-primary);       /* White */
  box-shadow: var(--shadow-button);
}

.btn--primary:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(1px);
}

.auth-submit__loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none; /* Hidden by default — shown only when .is-loading */
  flex-shrink: 0;
}

/* Show spinner only when button is in loading state */
.auth-submit.is-loading .auth-submit__loader {
  display: inline-block;
}

/* Hide button text when loading */
.auth-submit.is-loading .auth-submit__text {
  opacity: 0.6;
}

/* Prevent double-click while loading */
.auth-submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

/* Ensure [hidden] attribute always works */
[hidden] { display: none !important; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dividers */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.auth-divider span {
  padding: 0 12px;
}

/* OAuth Row */
.auth-oauth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-oauth__btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--ff-sans);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.auth-oauth__btn svg {
  flex-shrink: 0;
}

.auth-oauth__btn--discord:hover {
  background: #5865f2;
  color: #ffffff;
  border-color: #5865f2;
}

.auth-oauth__btn--google:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.auth-oauth__btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Guest Button (Ghost style) */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn--ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.auth-guest-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Footer of Form Card */
.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.auth-foot__pulse {
  width: 6px;
  height: 6px;
  background: #16a34a; /* Safe active green */
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.auth-foot .dot {
  color: var(--text-tertiary);
}

/* ── Perks List ─────────────────────────────────────── */
.auth-perks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 8px;
}

.auth-perk {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-perk__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  flex-shrink: 0;
  margin-top: 2px;
}

.auth-perk span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-perk span b {
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Mini Stats Bar ─────────────────────────────────── */
.auth-mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  margin-top: 8px;
}

.auth-mini-stat {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.auth-mini-stat__label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.auth-mini-stat__val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Responsive Styling ─────────────────────────────── */
@media (max-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  
  .auth-hero {
    align-items: center;
    text-align: center;
  }
  
  .auth-hero__desc {
    margin-left: auto;
    margin-right: auto;
  }
  
  .auth-features {
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .auth-counters {
    justify-content: center;
    width: 100%;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .auth-quote {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .auth-screen {
    padding: 64px 16px 24px;
  }
  
  .auth-hero__headline {
    font-size: 2.15rem; /* mobile still bigger than before */
  }
  
  .auth-features {
    grid-template-columns: 1fr;
    text-align: left;
    width: 100%;
  }
  
  .auth-card {
    padding: 24px 16px;
  }
  
  .auth-oauth {
    grid-template-columns: 1fr;
  }
  
  .auth-mini-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .auth-counters {
    flex-wrap: wrap;
    gap: 16px 32px;
  }
}
