/* ══ 重設瀏覽器對 button 的預設外觀，避免 iOS 疊加系統樣式蓋掉自訂設計 ══ */
button {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: inherit;
}

/* ── TOKENS（與 index light mode 一致） ── */
:root {
  --bg:       #f2ede4;
  --deep:     #e8e0d4;
  --ink:      #1e2e30;
  --ink2:     #4a6068;
  --ink3:     #7a9098;
  --sand:     #a07840;
  --sand-l:   #8a6030;
  --foam:     #2a6878;
  --mist:     #1e5060;
  --pale:     #c0d8e0;
  --rim:      rgba(30,46,48,.10);
  --rim2:     rgba(30,46,48,.18);
  --nav-bg:   rgba(242,237,228,.92);
  --serif:    'Cormorant Garamond', serif;
  --sans:     'Noto Sans TC', sans-serif;
}

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

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
}

/* ── NAV ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--rim);
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px;
  height: 54px; display: flex; align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--serif); font-size: 20px; font-style: italic;
  color: var(--ink); letter-spacing: 1px; text-decoration: none;
}

/* ── LAYOUT ── */
.login-stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-top: 54px;
}

@media (max-width: 680px) {
  .login-stage { grid-template-columns: 1fr; }
  .login-deco  { display: none; }
}

/* ── 左側裝飾 ── */
.login-deco {
  position: relative;
  background: var(--deep);
  display: flex; flex-direction: column;
  justify-content: center; padding: 60px 48px;
  overflow: hidden;
}
.deco-eyebrow {
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 20px;
}
.deco-quote {
  font-family: var(--serif); font-size: 36px; font-weight: 300;
  font-style: italic; line-height: 1.5;
  color: var(--ink); letter-spacing: .5px;
}
.deco-waves {
  position: absolute; bottom: 0; left: 0; right: 0; pointer-events: none;
  overflow: hidden;
}
.deco-waves svg { width: 200%; left: -50%; position: relative; height: 120px; display: block; }
.dw1 { fill: var(--pale); animation: dWave 9s ease-in-out infinite; transform-origin: center bottom; }
.dw2 { fill: #a8ccd8; animation: dWave 13s ease-in-out infinite reverse; transform-origin: center bottom; }
@keyframes dWave {
  0%,100% { transform: translateX(0) scaleY(1); }
  40%      { transform: translateX(-4%) scaleY(1.04); }
  70%      { transform: translateX(4%) scaleY(.97); }
}
@media (prefers-reduced-motion: reduce) {
  .dw1, .dw2 { animation: none; }
}

/* ── 右側表單區 ── */
.login-panel {
  display: flex; flex-direction: column;
  justify-content: center; padding: 60px 48px;
  max-width: 440px; width: 100%; margin: 0 auto;
}

/* ── Tab ── */
.auth-tabs {
  display: flex; gap: 0; margin-bottom: 32px;
  border-bottom: 1px solid var(--rim2);
}
.auth-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  font-family: var(--sans); font-size: 13px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink3);
  padding: 10px 20px 10px 0; cursor: pointer;
  margin-bottom: -1px; transition: all .2s;
}
.auth-tab.active {
  color: var(--sand); border-bottom-color: var(--sand);
}
.auth-tab:hover:not(.active) { color: var(--ink2); }

/* ── 第三方登入 ── */
.social-btns {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 24px;
}
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: none; border: 1px solid var(--rim2);
  color: var(--ink); font-family: var(--sans); font-size: 13px;
  letter-spacing: .5px; padding: 11px 20px; cursor: pointer;
  transition: all .2s; width: 100%;
}
.social-btn:hover {
  border-color: var(--sand); background: rgba(160,120,64,.04);
}

/* ── 分隔線 ── */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; color: var(--ink3); font-size: 14px;
  letter-spacing: 2px; text-transform: uppercase;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--rim2);
}

/* ── 表單 ── */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form.hidden { display: none; }

.reset-hint {
  font-size: 13px; color: var(--ink2); line-height: 1.7;
  margin-bottom: 4px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--ink2);
}
.input-wrap { position: relative; }
.field-input {
  width: 100%; background: none;
  border: none; border-bottom: 1px solid var(--rim2);
  color: var(--ink); font-family: var(--sans); font-size: 14px;
  padding: 10px 36px 10px 0; outline: none;
  transition: border-color .2s; letter-spacing: .3px;
}
.field-input:focus { border-bottom-color: var(--foam); }
.field-input::placeholder { color: var(--ink3); opacity: .6; }
.toggle-pw {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--ink3);
  cursor: pointer; opacity: .45; transition: opacity .2s; padding: 4px;
}
.toggle-pw:hover { opacity: .8; }

.forgot-link {
  font-size: 13px; color: var(--ink3); text-decoration: none;
  letter-spacing: .5px; transition: color .2s;
}
.forgot-link:hover { color: var(--sand); }

.terms-row {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 4px;
}
.terms-row input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; accent-color: var(--sand); }
.terms-label { font-size: 14px; color: var(--ink2); line-height: 1.6; }

/* ── 主按鈕 ── */
.submit-btn {
  width: 100%; background: none;
  border: 1px solid rgba(160,120,64,.5);
  color: var(--sand); font-family: var(--sans); font-size: 14px;
  letter-spacing: 2.5px; text-transform: uppercase;
  padding: 13px; cursor: pointer; margin-top: 8px;
  transition: all .25s;
  clip-path: polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%);
}
.submit-btn:hover {
  background: rgba(160,120,64,.08);
  border-color: var(--sand);
}

/* ── 訊息 ── */
.auth-message {
  margin-top: 16px; font-size: 13px; letter-spacing: .3px;
  min-height: 20px; transition: all .2s;
}
.auth-message.error   { color: #b85040; }
.auth-message.success { color: var(--foam); }
.auth-message.info    { color: var(--ink2); }

/* ── 切換提示 ── */
.switch-hint {
  margin-top: 28px; font-size: 13px; color: var(--ink3);
  letter-spacing: .3px;
}
.switch-hint a {
  color: var(--sand); text-decoration: none; margin-left: 6px;
  transition: color .2s;
}
.switch-hint a:hover { color: var(--sand-l); }

/* ── 手機漢堡 ── */
@media(max-width:600px){
  .login-stage { grid-template-columns: 1fr; }
  .login-deco  { display: none; }
  .login-panel { padding: 40px 24px; }
}

/* ── 語系選擇（桌機） ── */
.lang-select {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234a6068' opacity='.6'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-color: transparent;
  border: 1px solid var(--rim2);
  color: var(--ink2); font-family: var(--sans); font-size: 13px;
  letter-spacing: 1.5px; padding: 5px 28px 5px 10px; cursor: pointer;
  appearance: none; -webkit-appearance: none; outline: none;
  transition: border-color .2s;
}
.lang-select:hover { border-color: var(--sand); color: var(--sand); }
.lang-select option { background: var(--bg); color: var(--ink); }

@media(max-width:600px) { .nav-desktop-items { display: none !important; } }

/* ── 漢堡按鈕 ── */
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--ink2);
  flex-direction: column; justify-content: center; gap: 5px;
}
.hamburger span {
  display: block; width: 22px; height: 1.5px;
  background: currentColor;
  transition: transform .3s, opacity .3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
@media(max-width:600px) { .hamburger { display: flex; } }

/* ── Overlay 選單 ── */
.nav-overlay {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(242,237,228,.97);
  backdrop-filter: blur(20px);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  gap: 32px;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  padding-top: 54px;
}
.nav-overlay.open { opacity: 1; pointer-events: all; }
.nav-overlay a {
  font-family: var(--serif);
  font-size: 28px; font-style: italic; font-weight: 300;
  letter-spacing: 2px; color: var(--ink);
  text-decoration: none; transition: color .2s;
}
.nav-overlay a:hover { color: var(--sand); }
.overlay-divider { width: 40px; height: 1px; background: var(--rim2); }
.overlay-lang { display: flex; gap: 16px; margin-top: 8px; }
.overlay-lang button {
  background: none; border: none; cursor: pointer;
  font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--ink3); transition: color .2s; padding: 4px;
}
.overlay-lang button:hover,
.overlay-lang button.active { color: var(--sand); }
.overlay-cta {
  font-family: var(--sans) !important;
  font-style: normal !important; font-size: 14px !important;
  letter-spacing: 2px; color: var(--sand) !important;
  border: 1px solid rgba(160,120,64,.4);
  padding: 10px 24px !important;
}
