﻿/* ==========================================================================
   包藥藥 — 登入頁樣式
   需與 landing.css 一起載入（沿用它的 :root 色票、字體與 .btn）。
   這頁刻意不載入 bootstrap / sb-admin-2 / mystyle，避免舊樣式蓋掉版面。
   ========================================================================== */

body {
    background: var(--surface-alt);
    min-height: 100vh;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

/* ── 左側品牌欄 ───────────────────────────────────────── */
.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(820px 420px at 10% -8%, rgba(31, 147, 139, .5), transparent 62%),
        radial-gradient(680px 480px at 96% 10%, rgba(199, 146, 43, .2), transparent 60%),
        linear-gradient(160deg, #0d5f5a 0%, var(--brand-deep) 100%);
}
.auth-aside::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 26px 26px; opacity: .3;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
    -webkit-mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand .brand-name { color: #fff; }
.auth-brand .brand-sub { color: rgba(255, 255, 255, .55); }

.auth-aside h1 {
    color: #fff;
    font-size: clamp(26px, 2.6vw, 34px);
    line-height: 1.4;
    margin-bottom: 14px;
}
.auth-aside .auth-lead {
    font-size: 18px;
    line-height: 1.9;
    color: rgba(255, 255, 255, .8);
    max-width: 440px;
}

.auth-points { margin: 30px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; align-items: flex-start; gap: 12px; font-size: 17px; color: rgba(255, 255, 255, .84); line-height: 1.7; }
.auth-points i { color: #7fe3d5; font-size: 16px; margin-top: 5px; flex-shrink: 0; }

.auth-back {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 16px; font-weight: 600; color: rgba(255, 255, 255, .68);
    transition: color .15s;
}
.auth-back:hover { color: #fff; }
.auth-back i { font-size: 14px; }

/* ── 右側表單欄 ───────────────────────────────────────── */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: var(--surface);
}
.auth-card { width: 100%; max-width: 400px; }

.auth-card-icon {
    width: 54px; height: 54px; border-radius: 15px; display: block;
    margin-bottom: 22px; box-shadow: 0 4px 14px rgba(18, 33, 43, .18);
}
.auth-card h2 { font-size: 27px; margin-bottom: 8px; }
.auth-card > p.auth-sub { font-size: 17px; color: var(--muted); margin-bottom: 30px; }

.auth-field { margin-bottom: 18px; }
.auth-label {
    display: block; font-size: 16px; font-weight: 700;
    color: var(--ink); margin-bottom: 7px;
}
.auth-input-wrap { position: relative; }
.auth-input-wrap > i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 16px; color: var(--muted); pointer-events: none;
}
.auth-input {
    width: 100%; height: 48px;
    padding: 0 14px 0 40px;
    font-size: 18px; font-family: inherit; color: var(--ink);
    background: #fff;
    border: 1px solid #cfdbd8; border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input::placeholder { color: #9fb0ac; }
.auth-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.auth-input.input-validation-error { border-color: #b44856; }

.auth-submit { width: 100%; margin-top: 6px; }

/* 驗證訊息 */
.text-danger, .field-validation-error { color: #b44856; }
.auth-field .text-danger { display: block; font-size: 15px; margin-top: 6px; line-height: 1.6; }
.auth-errors {
    color: #b44856; background: #fdeff1; border: 1px solid #f2ccd2;
    border-radius: 10px; font-size: 16px; line-height: 1.7;
    margin-bottom: 20px; padding: 12px 14px;
}
.auth-errors:empty, .auth-errors.validation-summary-valid { display: none; }
.auth-errors ul { margin: 0; padding-left: 18px; }

/* 外部登入 */
.auth-divider {
    display: flex; align-items: center; gap: 14px;
    margin: 26px 0 18px; font-size: 15px; color: var(--muted);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-oauth { display: flex; flex-direction: column; gap: 10px; }
.auth-oauth button {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 46px; border-radius: 10px;
    font-size: 17px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.auth-oauth .oauth-google { border: 1px solid #dadce0; background: #fff; color: #3c4043; }
.auth-oauth .oauth-google:hover { border-color: #b9bfc6; background: #fafafa; }
.auth-oauth .oauth-apple { border: none; background: #000; color: #fff; }
.auth-oauth .oauth-apple:hover { background: #1b1b1b; }
.auth-oauth .oauth-generic { border: 1px solid #cfdbd8; background: #fff; color: var(--body); }
.auth-oauth .oauth-generic:hover { border-color: var(--brand); color: var(--brand); }

/* 頁尾提示 */
.auth-foot {
    margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line);
    font-size: 17px; color: var(--muted); text-align: center; line-height: 2;
}
.auth-foot a { color: var(--brand); font-weight: 700; }
.auth-foot a:hover { color: var(--brand-hover); text-decoration: underline; }
.auth-foot .auth-back-sm { display: none; }

/* ── 行動裝置 ─────────────────────────────────────────── */
@media (max-width: 900px) {
    /* 直式：品牌列高度自適應，表單欄吃掉剩下的整個畫面高度（不然卡片下方會露出灰底）。 */
    .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .auth-aside {
        padding: 22px 24px;
        flex-direction: row; align-items: center; justify-content: space-between;
        gap: 16px;
    }
    .auth-aside h1, .auth-aside .auth-lead, .auth-points { display: none; }
    .auth-main { padding: 40px 24px 56px; align-items: flex-start; }
    .auth-foot .auth-back-sm { display: block; }
}

@media (max-width: 420px) {
    .auth-aside .auth-back span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ── Passkey 登入 ─────────────────────────────────────────
   刻意做成實心深色：這是登入頁的主要動線，淡色的外框按鈕在藥局的日光環境下看不清楚。
   不跟下面的「登入」主按鈕撞色，一眼分得出是兩條不同的路。 */
.auth-passkey { margin-bottom: 4px; }
.passkey-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 52px; border: none; border-radius: 10px;
    background: var(--brand-deep); color: #fff;
    font-size: 18px; font-weight: 700; font-family: inherit; letter-spacing: .3px;
    cursor: pointer; transition: background .15s, opacity .15s;
}
.passkey-btn:hover { background: #0d5f5a; }
.passkey-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.passkey-btn i { font-size: 21px; }
.passkey-btn:disabled, .passkey-btn.is-busy { opacity: .6; cursor: progress; }

/* 錯誤訊息沿用 .auth-errors 的紅底框，但那條規則只吃 ul，這裡是純文字。 */
.auth-passkey .auth-errors { margin: 12px 0 0; }
.auth-passkey .auth-errors:empty { display: none; }

/* 帳號設定頁的 Passkey 清單 */
.passkey-list { list-style: none; margin: 0; padding: 0; }
.passkey-list li {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.passkey-list li:last-child { border-bottom: none; }
.passkey-list .passkey-icon { font-size: 22px; color: var(--brand-deep); width: 26px; text-align: center; }
.passkey-list .passkey-name { font-weight: 700; color: var(--body); }
.passkey-list .passkey-meta { font-size: 14px; color: var(--muted); }
.passkey-list .passkey-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── 掃碼登入 ─────────────────────────────────────────── */
/* 按鈕與 Passkey 那顆並排在一起，但用外框而不是實心底：
   同時兩顆實心大按鈕會分不出主次，這一顆是備案不是首選。 */
.auth-qr { margin-top: 10px; }
.qr-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 52px; border-radius: 10px;
    border: 2px solid var(--brand-deep); background: #fff; color: var(--brand-deep);
    font-size: 18px; font-weight: 700; font-family: inherit; letter-spacing: .3px;
    cursor: pointer; transition: background .15s, color .15s;
}
.qr-btn:hover { background: var(--brand-deep); color: #fff; }
.qr-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.qr-btn i { font-size: 21px; }

.qr-panel {
    margin-top: 14px; padding: 18px 16px; text-align: center;
    border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
/* QR 一定要白底純黑，中間不能有任何漸層或濾鏡，不然某些手機掃不到。 */
.qr-image {
    width: 200px; height: 200px; display: block; margin: 0 auto 12px;
    image-rendering: pixelated; background: #fff;
}
/* 這組碼是要用人眼抄進手機的，字距拉開、用等寬字，才不會把 8 看成 B。 */
.qr-code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 30px; font-weight: 700; letter-spacing: 4px; color: var(--body);
}
.qr-hint { margin: 10px 0 0; font-size: 15px; color: var(--muted); line-height: 1.6; }
.qr-status { margin: 12px 0 0; font-size: 16px; font-weight: 600; color: var(--brand-deep); }
.qr-status.is-error { color: #b3261e; }
.qr-expiry { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.qr-expiry:empty { display: none; }
.qr-panel .oauth-generic {
    margin-top: 12px; width: 100%; height: 46px; border-radius: 10px;
    border: 1px solid #cfdbd8; background: #fff; color: var(--body);
    font-size: 17px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.qr-panel .oauth-generic:hover { border-color: var(--brand); color: var(--brand); }
