/* ===== Reset / Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body.login-page {
    margin: 0;
    padding: 0;
    background-color: var(--slate-f0f2f5);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Page content (two-column) ===== */
.page-content {
    display: flex;
    flex-direction: row;
    gap: 48px;
    max-width: min(1160px, 94vw);
    margin: 40px auto;
    padding: 0 24px;
    flex: 1;
    align-items: flex-start;
}

/* ===== Sign In page: override page-content flex for grid layout ===== */
.page-content--login {
    display: grid;
    grid-template-columns: 1fr 340px;
    grid-template-areas: "intro form";
    column-gap: 48px;
    align-items: start;
}

.login-intro-wrapper {
    grid-area: intro;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.page-content--login .login-section { grid-area: form; }

/* ===== Left: Intro section ===== */
.intro-section {
    flex: 1;
    min-width: 0;
}

.intro-section__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--blue-1a3a5c);
    margin: 0 0 16px 0;
}

.intro-section__text {
    line-height: 1.7;
    margin: 0 0 12px 0;
    color: #555;
}

.intro-section__divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 24px 0;
}

.intro-section__list {
    margin: 8px 0 0 20px;
    padding: 0;
    color: #555;
    font-size: 0.92rem;
    line-height: 1.8;
}

.intro-section__rules {
    padding-left: 12px;
    margin-top: 20px;
}

.intro-section__rules .pwd-rules {
    margin-bottom: 0;
}

.intro-section__rules-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--slate-6b7785);
    margin: 0 0 6px;
}

.intro-section__link {
    color: var(--blue-2471a3);
    text-decoration: underline;
}

.intro-section__link:hover {
    color: var(--blue-1a5276);
}

/* ===== Right: Login section ===== */
.login-section {
    flex: 0 0 340px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    padding: 32px 28px;
}

.login-section__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--blue-1a3a5c);
    margin: 0 0 20px 0;
    text-align: center;
}

.login-section__or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: #aaa;
    font-size: 0.9rem;
}

.login-section__or::before,
.login-section__or::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e0e0e0;
}

/* ===== Login success notice ===== */
.login-section__notice {
    background-color: #eafaf1;
    border-left: 3px solid #27ae60;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 3px;
    color: #1d8047;
    font-size: 0.9rem;
}

/* 說明而非成功訊息（session 已結束，2026-11-02）：改用藍色系 */
.login-section__notice--info {
    background-color: var(--blue-f5f8fc);
    border-left-color: var(--blue-2471a3);
    color: var(--blue-1a3a5c);
}

/* ===== Error list ===== */
.error-list {
    margin-bottom: 16px;
}

.error-list__item {
    background-color: #fdf3f2;
    border-left: 3px solid #c0392b;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 3px;
    color: #c0392b;
    font-size: 0.9rem;
}

/* ===== Login form ===== */
.login-form {
    display: block;
}

.login-form__label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #444;
    font-size: 0.9rem;
}

.login-form__input {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 16px;
    /* 一律白底：註冊頁的 Salutation 是原生下拉，沒指定時 Firefox 是灰底，像停用的欄位（2026-10-30） */
    background-color: #fff;
    transition: border-color 0.15s;
}

.login-form__input::placeholder {
    color: #bbb;
    font-style: italic;
}

.login-form__input:focus {
    outline: none;
    border-color: var(--blue-2980b9);
    box-shadow: 0 0 0 2px var(--blue-2980b9-a18);
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 9px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    text-align: center;
    transition: background-color 0.15s;
}

.btn--primary {
    background-color: var(--blue-2471a3);
    color: #ffffff;
}

.btn--primary:hover {
    background-color: var(--blue-1a5276);
    color: #ffffff;
}

.btn--full {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
}

/* 送出中（js/submit-guard.js，2026-11-03）：同 template.css 那一段（公開頁不載入 template.css） */
.is-submitting {
    cursor: progress;
    opacity: 0.65;
    transition: opacity 0.2s 0.3s;
}

/* Secondary — cancel / back / neutral */
.btn--secondary {
    background: #fff;
    border: 1px solid #ccc;
    color: #555;
}

.btn--secondary:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #333;
}

/* Danger — delete / reject / logout */
.btn--danger {
    background-color: #c0392b;
    color: #ffffff;
}

.btn--danger:hover {
    background-color: #a93226;
    color: #ffffff;
}

/* Small — compact rows / inline actions */
.btn--sm {
    padding: 6px 16px;
    font-size: 0.8125rem;
}

.btn--orcid {
    background-color: #a6ce39;
    color: #1a1a1a;
    gap: 8px;
    margin-top: 4px;
}

.btn--orcid:hover:not([disabled]) {
    background-color: #8eb82e;
}

.btn--orcid[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn--orcid__icon {
    width: 22px;
    height: 22px;
}

/* ===== Mobile-only title inside login-section ===== */
.login-form__mobile-title {
    display: none;
}

/* ===== Form field hint (below input) ===== */
.login-form__hint {
    display: block;
    font-size: 0.875rem;
    color: var(--slate-6b7785);
    margin-top: -10px;
    margin-bottom: 16px;
}

/* ===== Forgot password link (inside form, below submit btn) ===== */
.login-form__forgot {
    text-align: right;
    margin-top: 10px;
}

.login-form__forgot-link {
    font-size: 0.85rem;
    color: var(--blue-2471a3);
    text-decoration: none;
}

.login-form__forgot-link:hover {
    text-decoration: underline;
    color: var(--blue-1a5276);
}

/* ===== Required marker ===== */
.required {
    color: #c0392b;
}

/* ===== Page footer ===== */
.page-footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.875rem;
    border-top: 1px solid #e0e0e0;
    margin-top: auto;
    line-height: 1.8;
}

.page-footer__link {
    color: var(--blue-2471a3);
    text-decoration: none;
}

.page-footer__link:hover {
    text-decoration: underline;
}

/* ===== Single-card centered pages (forgot / reset password) ===== */
.card-page {
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.card-box {
    background: #ffffff;
    border-top: 4px solid var(--blue-1a3a5c);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 40px 44px;
    width: 100%;
    max-width: 560px;
}

.card-box__icon {
    text-align: center;
    font-size: 3rem;
    color: var(--blue-2471a3);
    margin-bottom: 12px;
    line-height: 1;
}

.card-box__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--blue-1a3a5c);
    margin: 0 0 8px;
    text-align: center;
}

.card-box__desc {
    color: #666;
    font-size: 0.92rem;
    line-height: 1.7;
    margin: 0 0 24px;
    text-align: center;
}

.card-box__notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--blue-eaf4fb);
    border: 1px solid var(--blue-aed6f1);
    border-radius: 5px;
    padding: 14px 16px;
    color: var(--blue-1a5276);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 4px;
}

.card-box__notice-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.card-box__error {
    background: #fdf3f2;
    border-left: 3px solid #c0392b;
    border-radius: 3px;
    padding: 10px 14px;
    color: #c0392b;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.card-box__divider {
    border: none;
    border-top: 1px solid #ececec;
    margin: 24px 0 16px;
}

/* 置中的主要按鈕（舊系統連結說明頁） */
.card-box__actions {
    text-align: center;
    margin: 0 0 20px;
}

.pwd-rules {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--slate-f8f9fa);
    border: 1px solid var(--slate-e3e6ea);
    border-radius: 5px;
    padding: 12px 14px;
    margin-bottom: 24px;
    margin-top: 4px;
}

.pwd-rule {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.pwd-rule__icon {
    font-size: 0.9rem;
    width: 1em;
    text-align: center;
    flex-shrink: 0;
}

.pwd-rule--pending {
    color: #999;
}

.pwd-rule--ok {
    color: #27ae60;
}


.card-box__back-link {
    display: block;
    text-align: center;
    font-size: 0.88rem;
    color: #999;
    text-decoration: none;
    transition: color 0.15s;
}

.card-box__back-link:hover {
    color: var(--blue-2471a3);
    text-decoration: underline;
}

/* ===== RWD: tablet / mobile ===== */
@media (max-width: 720px) {
    .page-content {
        flex-direction: column;
        gap: 24px;
        margin: 24px auto;
    }

    .login-section {
        flex: none;
        width: 100%;
        order: -1;
    }

    .intro-section {
        order: 0;
    }

    .intro-section .intro-section__title {
        display: none;
    }

    /* Sign In page: grid → flex on mobile, wrapper dissolves via display:contents */
    .page-content--login {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .login-intro-wrapper {
        display: contents;
    }

    /* Sign In page order */
    .login-intro-top    { order: 1; display: none; }

    .login-form__mobile-title {
        display: block;
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--blue-1a3a5c);
        margin: 0 0 20px;
    }
    .page-content--login .login-section { order: 2; width: 100%; }
    .login-intro-bottom { order: 3; }

    /* Forgot Password page order */
    .forgot-intro-top    { order: 1; }
    .forgot-intro-bottom { order: 3; }

    /* Reset Password page order */
    .reset-intro-top    { order: 1; }
    .reset-intro-bottom { order: 3; }

    .login-form__forgot { display: none; }
}

/* ===== Suppress first hr top-margin in intro-bottom sections (wrapper gap already provides spacing) ===== */
.login-intro-bottom > .intro-section__divider:first-child,
.forgot-intro-bottom > .intro-section__divider:first-child,
.reset-intro-bottom > .intro-section__divider:first-child {
    margin-top: 0;
}

@media (max-width: 480px) {
    .login-section {
        padding: 24px 16px;
        box-shadow: none;
        border-radius: 0;
    }
}

/* ===== Honeypot (anti-bot) ===== */
.honeypot {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
