/*
  登入頁樣式（B8）—— 沿用參考專案（同一業主）的設計。

  【修改原因】業主 2026-08-25 指示：登入頁須與參考專案相同。
  【解決方案】獨立成檔，不與 layout.css／site.css 混用——
              ★ 登入頁沒有側欄、沒有頂列，載入那兩檔只是徒增沒有用到的規則。
  【影響範圍】登入頁與變更密碼頁。
  【資料流向】_LoginLayout.cshtml 載入 tokens.css → 本檔。

  ★ 本檔只依賴 tokens.css 的變數，不依賴 layout.css 或 site.css。
*/

/* ★ 與 site.css 相同的理由：沒有這條，width:100% 的輸入框會比容器寬 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.login-view {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    margin: 0;
    background: linear-gradient(180deg, #f3f8f4 0%, #eef6f3 40%, #e7f2ec 100%);
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    color: var(--ink);
}

/*
   背景風景。
   ★★ `pointer-events:none` 是必要的——它鋪滿整個畫面，
      ★ 少了這一條，使用者點在圖上的任何位置都無法聚焦到表單，
        而畫面看起來完全正常。
*/
.scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 圳路水流的流動感 */
@keyframes canalflow {
    to { stroke-dashoffset: -48; }
}

/* ★ 尊重「減少動態效果」偏好：關掉水流動畫 */
@media (prefers-reduced-motion: reduce) {
    .scene * { animation: none !important; }
}

.login-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 40px;
}

.login-head img {
    height: 46px;
    width: auto;
    display: block;
}

.login-main {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 40px;
}

.login-card {
    width: 100%;
    max-width: 452px;
    background: var(--surface);
    border: 1px solid #e3ece6;
    border-radius: 10px;
    box-shadow: 0 24px 60px -26px rgba(31, 58, 46, .4);
    overflow: hidden;
}

.login-card__ribbon {
    height: 4px;
    background: linear-gradient(90deg, var(--green), #7fc79a, var(--green));
}

.login-card__body { padding: 38px 44px 34px; }

.login-brand { text-align: center; margin-bottom: 28px; }

.login-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border: 1px solid #dfeae2;
    border-radius: 999px;
    background: var(--row-hover);
    color: var(--green);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    margin-bottom: 18px;
}

.login-eyebrow::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
}

.login-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.625rem;
    color: var(--ink-head);
    letter-spacing: 1px;
    line-height: 1.3;
}

.login-en {
    margin-top: 8px;
    color: #5f7268;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.login-rule {
    width: 44px;
    height: 2px;
    background: var(--green-border);
    margin: 16px auto 0;
}

.login-lead {
    margin: 0 0 24px;
    text-align: center;
    color: var(--ink-2);
    font-size: 0.8125rem;
    line-height: 1.7;
}

/* ── 欄位 ─────────────────────────────────────────────────── */

.fld-label {
    display: block;
    font-size: 0.78125rem;
    font-weight: 500;
    color: #3a4a41;
    margin-bottom: 7px;
}

/* ★ 圖示與輸入框合為一個框：圖示在框內，聚焦時整個框變綠 */
.fld {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line-input);
    border-radius: var(--r-sm);
    padding: 0 12px;
    margin-bottom: 18px;
    background: #fafcfb;
    transition: border-color .15s;
}

.fld:focus-within { border-color: var(--green); }

.fld svg { flex: none; }

.fld input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 12px 0;
    font: inherit;
    font-size: 0.875rem;
    color: #1c2b23;
}

/*
   ★★ 【焦點環畫在外框 `.fld` 上，不畫在 input 上】——
      input 沒有邊框且比外框小，光環畫在它身上會被外框切掉一半。
   ★ 但【不可直接移除 input 的焦點指示】：這裡是把它轉移，不是取消。
*/
.fld input:focus-visible {
    outline: none;
    box-shadow: none;
}

.fld:focus-within {
    box-shadow: 0 0 0 3px rgba(47, 125, 84, .25);
}

@media (forced-colors: active) {
    .fld:focus-within { outline: 3px solid Highlight; }
}

.login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 0.8125rem;
}

.login-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5a6a60;
    cursor: pointer;
}

.login-row input[type="checkbox"] {
    accent-color: var(--green);
    width: 16px;
    height: 16px;
}

/* ── 送出鈕 ───────────────────────────────────────────────── */

.login__submit {
    width: 100%;
    border: none;
    border-radius: 9px;
    padding: 14px;
    background: linear-gradient(160deg, #379062, #2a744e);
    color: var(--on-accent);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-btn);
}

.login__submit:hover { filter: brightness(1.05); }

/* ★ 送出中用 progress 游標而非 not-allowed：它不是「不能按」，是「正在處理」 */
.login__submit[disabled] {
    opacity: .6;
    cursor: progress;
    filter: none;
}

/* ── 訊息 ─────────────────────────────────────────────────── */

/*
   ★★ 【錯誤訊息一律同一句，不區分帳號不存在與密碼錯誤】（B4 驗收條件 2）——
      分開講等於提供帳號列舉的管道。本樣式只負責外觀，不影響該規則。
   ★ 空白時完全不佔位（:empty），否則表單會平白多出一塊空隙。
*/
.form-error {
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: var(--r);
    background: #fdf2f2;
    border: 1px solid #f0c7c7;
    color: #a33a3a;
    font-size: 0.78125rem;
    line-height: 1.8;
}

.form-error:empty {
    display: none;
}

.login-foot {
    margin-top: 22px;
    font-size: 0.71875rem;
    color: var(--muted);
    line-height: 1.9;
    text-align: center;
}

.req { color: var(--red); }

/* ── RWD ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .login-head { padding: 16px 20px; }
    .login-head img { height: 36px; }
}

@media (max-width: 520px) {
    .login-card__body { padding: 28px 24px 26px; }
}

/* ── 變更密碼頁專用 ───────────────────────────────────────── */

/* ★ 這一頁的 .fld 內沒有圖示，label 在框外，所以要自己撐開下方間距 */
.fld > .hint { display: none; }

.fld-hint {
    display: block;
    margin: -12px 0 18px;
    font-size: 0.71875rem;
    color: var(--muted);
    line-height: 1.7;
}

/* ★★ 強制變更密碼的告知：以琥珀色標示「這不是一般操作，你被擋住了」 */
.login-notice {
    margin: 0 0 20px;
    padding: 11px 14px;
    border-radius: var(--r);
    background: var(--amber-bg);
    border: 1px solid #f0d3b8;
    color: #8a4a1c;
    font-size: 0.78125rem;
    line-height: 1.8;
}
