/* ==========================================================================
   Farseer · Login Page · V1
   Light theme · matches reference (cream bg + grey dotted map + orange pins)
   ========================================================================== */

:root {
  --brand: #E87722;
  --brand-hover: #D86610;
  --brand-pressed: #C25506;
  --brand-soft: #FFF1E6;

  --ink: #1A2236;
  --ink-strong: #0B1422;
  --ink-2: #4A5468;
  --ink-3: #6B7484;
  --ink-4: #9AA3B2;

  --bg: #F4F2EE;          /* cream off-white, matches reference */
  --bg-alt: #FAF9F6;
  --surface: #FFFFFF;
  --hairline: #E5E2DC;
  --hairline-strong: #D4D0C8;

  --danger: #C2410C;
  --success: #15803D;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .06), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-card: 0 24px 48px -16px rgba(15, 23, 42, .12), 0 8px 16px -8px rgba(15, 23, 42, .06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --font-sans: "Futura", "Helvetica Neue", "Helvetica", "Arial",
               "Noto Sans TC", "Microsoft JhengHei", "PingFang TC",
               -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }

img { max-width: 100%; display: block; }

/* ----------- Top nav ----------- */
.site-nav {
  position: relative;
  z-index: 5;
  padding: 22px 0;
  background: var(--bg);
}
.site-nav .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
}
.brand-link {
  display: inline-flex; align-items: center;
  flex: 0 0 auto;
}
.brand-link img {
  height: 28px; width: auto;
}
.nav-links {
  display: flex; align-items: center; gap: 44px;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: .01em;
  transition: color .15s;
}
.nav-links a:hover { color: var(--ink-strong); }

.lang-switch {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.lang-switch:hover { background: rgba(15,23,42,.04); color: var(--ink-strong); }
.lang-switch svg { width: 22px; height: 22px; }

/* ----------- Login stage ----------- */
.login-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5% 0 0;
  height: 89vh;
  overflow: hidden;
}
.login-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('../images/newpage/login-bg-map.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: .92;
  pointer-events: none;
}
.login-stage::after {
  /* subtle vignette to push focus to the card */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(244,242,238,0) 30%, rgba(244,242,238,.55) 78%, rgba(244,242,238,.85) 100%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(450px, calc(100% - 32px));
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 44px 44px 40px;
}

.login-title-row {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 28px;
}
.login-title-row .rule {
  flex: 1;
  height: 1px;
  background: var(--hairline-strong);
}
.login-title {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--ink-strong);
  margin: 0;
  white-space: nowrap;
}

/* form */
.field-group { margin-bottom: 14px; }
.field-shell {
  position: relative;
  display: flex; align-items: center;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-pill);
  background: #FCFBF9;
  transition: border-color .15s, box-shadow .15s, background .15s;
  padding: 0 18px 0 16px;
  height: 50px;
}
.field-shell:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(232,119,34,.12);
}
.field-shell.is-error {
  border-color: var(--danger);
  background: #FFF6F1;
  box-shadow: 0 0 0 4px rgba(194,65,12,.10);
}
.field-shell svg.field-icon {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  color: var(--ink-3);
  margin-right: 12px;
}
.field-shell input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font: inherit;
  color: var(--ink-strong);
  height: 100%;
  letter-spacing: .015em;
}
.field-shell input::placeholder {
  color: var(--ink-4);
  font-weight: 400;
}
.toggle-pw {
  flex: 0 0 auto;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-3);
  padding: 4px 6px;
  border-radius: 6px;
}
.toggle-pw:hover { color: var(--ink-strong); }
.toggle-pw svg { width: 18px; height: 18px; display: block; }

.field-error-msg {
  margin: 6px 16px 0;
  font-size: 13px;
  color: var(--danger);
  min-height: 1em;
}

.row-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 4px 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.checkbox {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--ink-2);
}
.checkbox input {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--hairline-strong);
  border-radius: 5px;
  background: #fff;
  display: inline-grid; place-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .12s, border-color .12s;
}
.checkbox input:checked {
  background: var(--brand);
  border-color: var(--brand);
}
.checkbox input:checked::after {
  content: "";
  width: 10px; height: 6px;
  border: 2px solid #fff;
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.checkbox input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.forgot-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--brand);
}
.forgot-link:hover { color: var(--brand-pressed); text-decoration: underline; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  height: 52px;
  border: 0; cursor: pointer;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .04em;
  box-shadow: 0 8px 18px -8px rgba(232,119,34,.55);
  transition: background .15s, transform .12s, box-shadow .15s;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-pressed); transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.btn-primary[disabled] { opacity: .7; cursor: progress; }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: none;
}
.btn-primary.is-loading .btn-spinner { display: block; }
.btn-primary.is-loading .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

.help-row {
  margin-top: 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-3);
}
.help-row a {
  color: var(--ink-strong);
  font-weight: 500;
}
.help-row a:hover { color: var(--brand); text-decoration: underline; }

/* Success state */
.login-card[data-state="success"] .login-form,
.login-card[data-state="success"] .login-title-row,
.login-card[data-state="success"] .help-row {
  display: none;
}
.login-success {
  display: none;
  text-align: center;
}
.login-card[data-state="success"] .login-success {
  display: block;
  padding: 12px 0;
}
.success-check {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #E8F6EE;
  color: var(--success);
  display: grid; place-content: center;
}
.success-check svg { width: 30px; height: 30px; }
.login-success h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink-strong);
}
.login-success p {
  margin: 0 0 22px;
  color: var(--ink-2);
  font-size: 14px;
}
.success-cta {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: .03em;
  box-shadow: 0 6px 14px -6px rgba(232,119,34,.55);
}
.success-cta:hover { background: var(--brand-hover); color: #fff; }

/* container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ----------- Footer (subtle, single line) ----------- */
.site-footer {
  position: relative; z-index: 3;
  background: var(--bg) !important;
  border-top: 1px solid var(--hairline);
  padding: 18px 0;
  font-size: 13px;
}
.site-footer .container {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.site-footer a { color: var(--ink-3); }
.site-footer a:hover { color: var(--ink-strong); }
.footer-links { display: inline-flex; gap: 22px; flex-wrap: wrap; }
.footer-legal {
  color: var(--ink-800) !important;
}
.footer-legal a {
  color: var(--ink-3) !important;
}
.footer-legal a:hover{
  color: var(--brand) !important;
}
.footer-legal .sep {
  color: var(--ink-3) !important;
}
/* ----------- Responsive ----------- */
@media (max-width: 780px) {
  .nav-links { display: none; }
  .site-nav { padding: 18px 0; }
  .login-card { padding: 36px 28px 32px; }
  .login-title { font-size: 22px; }
  .container { padding: 0 20px; }
  .login-stage { padding: 85px 0 64px; }
  .login-stage::before { background-position: center top; }
  .pop-container {
    max-width: 426px !important;
    min-width: 420px !important;
    left: 2px !important;
  }
  .panel-default {
    width: 425px !important;
  }
}

@media (max-width: 420px) {
  .login-card { padding: 30px 22px 26px; }
  .row-meta { flex-direction: column; align-items: flex-start; gap: 10px; }
  .site-footer .container { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pop-container {
    max-width: 385px !important;
    min-width: 380px !important;
    left: 2px !important;
  }
  .panel-default {
    width: 385px !important;
  }
}

/* ----------- A11y / motion ----------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
