@import "/mk3/assets/palette.css";

/* ════════════════════════════════════════════════════════════════════
   Millzik 登入頁 — 對齊參考設計（auth reference）
   獨立置中卡片、四角色選擇、登入/註冊分頁、Google 按鈕、密碼強度、
   管理員入口（© 五連擊觸發）、成功面板。
   全部採用 palette.css token；非品牌語意色（紫/紅/綠/灰）允許直用。
   ════════════════════════════════════════════════════════════════════ */

/* ---- 頁面外框：淺色背景、垂直置中 ---- */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--light-gray);
  padding: 32px 16px;
}

/* ---- 主卡片 ---- */
.auth-card {
  width: 100%; max-width: 448px;
  background: #fff; border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .12);
  overflow: hidden; border: 1px solid var(--line);
}
.auth-copyright { text-align: center; font-size: 12px; color: var(--gray); margin-top: 22px; }

/* ---- 標題（持久顯示） ---- */
.auth-head { text-align: center; padding: 38px 34px 22px; border-bottom: 1px solid var(--line); }
.auth-head .auth-logo {
  display: inline-block; color: var(--ink); font-size: 34px; font-weight: 800;
  letter-spacing: -.5px; text-decoration: none;
}
.auth-head .auth-logo span { color: var(--orange); }
.auth-head p { color: var(--gray); font-size: 14px; margin-top: 7px; font-weight: 500; }

/* ---- 面板切換 ---- */
.panel { display: none; }
.panel.active { display: block; }
.fade-in { animation: fadeUp .22s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.auth-body { padding: 30px 34px 34px; }

/* ---- 角色選擇（2×2） ---- */
.panel-label { font-size: 14px; font-weight: 600; color: var(--gray); text-align: center; margin-bottom: 20px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.role-card {
  border: 2px solid var(--line); border-radius: 16px; padding: 20px 14px;
  text-align: center; cursor: pointer; transition: transform .2s, border-color .2s, background .2s;
}
.role-card:hover { transform: translateY(-2px); }
.role-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.role-card.selected { border-color: var(--navy); background: var(--light-blue); }
.role-card .icon { font-size: 30px; margin-bottom: 8px; }
.role-card h4 { font-size: 14px; font-weight: 700; color: var(--ink); }
.role-card p { font-size: 12px; color: var(--gray); margin-top: 4px; line-height: 1.5; }

/* ---- © 隱藏管理員入口（五連擊） ---- */
.admin-trigger-wrap { text-align: center; margin-top: 20px; }
#admin-trigger { font-size: 12px; color: #d1d5db; cursor: default; user-select: none; }

/* ---- 登入/註冊頂部列 ---- */
.auth-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.auth-back {
  background: none; border: none; color: var(--gray); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--mk-font); display: inline-flex; align-items: center; gap: 4px;
  transition: color .15s;
}
.auth-back:hover { color: var(--ink); }
.role-badge {
  display: inline-block; background: var(--light-blue); color: var(--navy);
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* ---- 分頁 ---- */
.auth-tabs { display: flex; border-bottom: 1.5px solid var(--line); margin-bottom: 22px; }
.auth-tab {
  flex: 1; background: none; border: none; padding: 11px 0; font-size: 15px; font-weight: 600;
  color: var(--gray); cursor: pointer; font-family: var(--mk-font); border-bottom: 2px solid transparent;
  margin-bottom: -1.5px; transition: color .15s, border-color .15s;
}
.auth-tab.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }

/* ---- 分隔線 ---- */
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--gray); font-size: 12px; margin: 16px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---- 表單欄位 ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 16px; font-size: 14px; font-family: var(--mk-font);
  color: var(--ink); background: #fff; border: 1.5px solid var(--line);
  border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--gray); }
.field input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--light-blue); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 14px; color: var(--gray); padding: 4px;
}
.pw-toggle:hover { color: var(--ink); }

/* ---- 忘記密碼 ---- */
.forgot-row { display: flex; justify-content: flex-end; margin: -2px 0 16px; }
.forgot-link {
  background: none; border: none; font-size: 12px; color: var(--navy);
  cursor: pointer; font-family: var(--mk-font);
}
.forgot-link:hover { text-decoration: underline; }

/* ---- 密碼強度（四段） ---- */
.strength-bars { display: flex; gap: 4px; margin-top: 8px; }
.strength-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .3s; }
.strength-label { font-size: 12px; margin-top: 6px; min-height: 16px; }
.pw-mismatch { font-size: 12px; color: var(--red); margin-top: 6px; }

/* ---- 服務條款 ---- */
.tc-label { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; cursor: pointer; }
.tc-label input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--navy); flex-shrink: 0; }
.tc-label span { font-size: 12px; color: var(--gray); line-height: 1.6; }
.tc-label .tc-link { color: var(--navy); font-weight: 600; cursor: pointer; }
.tc-label .tc-link:hover { text-decoration: underline; }

/* ---- 按鈕與工具類 ---- */
.btn-block { display: block; width: 100%; }
.mt-1 { margin-top: 12px; }
.hidden { display: none !important; }

.btn-primary {
  width: 100%; background: var(--navy); color: #fff; border: none;
  border-radius: 12px; padding: 13px 24px; font-size: 14px; font-weight: 600;
  font-family: var(--mk-font); cursor: pointer; transition: background .15s, transform .1s, opacity .15s;
}
.btn-primary:hover { background: var(--navy-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 12px 24px; font-size: 14px; font-weight: 500; font-family: var(--mk-font);
  color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-google:hover { background: var(--light-gray); border-color: var(--gray); }

/* ---- 管理員入口（紫色語意色，非品牌色，允許直用 hex） ---- */
.admin-badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: 20px; background: #ede9fe; color: #6d28d9;
}
.admin-hero { text-align: center; margin-bottom: 22px; }
.admin-hero .icon-box {
  width: 56px; height: 56px; border-radius: 16px; background: #ede9fe;
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 12px;
}
.admin-hero h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.admin-hero p { font-size: 12px; color: var(--gray); margin-top: 2px; }
.admin-error {
  font-size: 12px; color: #dc2626; background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 16px;
}
.btn-violet {
  width: 100%; padding: 13px 24px; font-size: 14px; font-weight: 600; font-family: var(--mk-font);
  color: #fff; background: #7c3aed; border: none; border-radius: 12px;
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn-violet:hover { background: #6d28d9; }
.btn-violet:active { transform: scale(.98); }
.demo-hint { text-align: center; font-size: 12px; color: var(--gray); margin-top: 14px; }

/* ---- 成功面板 ---- */
.success-wrap { text-align: center; padding: 40px 0 24px; }
.success-check {
  width: 64px; height: 64px; border-radius: 50%; background: #dcfce7;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.success-check svg { width: 32px; height: 32px; color: var(--green); }
.success-wrap h3 { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.success-wrap p { font-size: 14px; color: var(--gray); margin-bottom: 24px; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--light-blue); border-top-color: var(--navy);
  border-radius: 50%; margin: 0 auto; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
.toast {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 500; opacity: 0; transition: opacity .25s, transform .25s;
  z-index: 9999; white-space: nowrap; pointer-events: none;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
