@keyframes login-page-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-page .page-title {
    margin-bottom: 28px;
}

.login-page .login-page__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
}

.login-page .login-page__loading[hidden],
.login-page .login-page__actions[hidden] {
    display: none !important;
}

.login-page .login-page__loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--action-blue);
    border-radius: 50%;
    animation: login-page-spin 1s linear infinite;
}

.login-page .login-page__loading-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.login-page .login-page__lead {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
}

/* .btn 自帶 margin-top: 32px；兩顆按鈕之間收斂成一致的間距，避免第二顆離太遠。 */
.login-page .login-page__button + .login-page__button {
    margin-top: 14px;
}

/* 註冊按鈕與登入行為相同，僅以次要外框樣式區隔視覺層級。 */
.login-page .login-page__button--secondary {
    background-color: var(--bg-white);
    color: var(--action-blue);
    box-shadow: inset 0 0 0 2px var(--action-blue);
}

.login-page .login-page__button--secondary:active {
    transform: translateY(1px);
    background-color: rgba(2, 136, 209, 0.06);
}

.login-page .login-page__button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-page #loginError {
    margin-top: 16px;
    text-align: center;
}

.login-page .login-page__terms-notice {
    margin-bottom: 0;
}

/*
   條款連結用深藍：站台既有連結慣例是 .label-text a 的 --action-blue，但該色對白底僅 3.86:1，
   而這行是 13px 的 .helper-text 小字，未達 WCAG AA 4.5:1；--action-blue-dark 為 7.4:1。
*/
.login-page .login-page__terms-link {
    color: var(--action-blue-dark);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.login-page .login-page__terms-link:focus-visible {
    border-radius: 3px;
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.login-terms-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(92vw, 720px);
    max-width: 720px;
    max-height: calc(100dvh - 32px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--bg-white);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    transform: translate(-50%, -50%);
    overflow: hidden;
}

.login-terms-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.login-terms-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
}

.login-terms-dialog__title {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}

.login-terms-dialog__close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.login-terms-dialog__close:hover {
    background: var(--bg-input);
}

.login-terms-dialog__close:focus-visible {
    outline: 2px solid var(--action-blue);
    outline-offset: 2px;
}

.login-terms-dialog__body {
    max-height: calc(100dvh - 112px);
    padding: 20px;
    overflow-y: auto;
}

.login-terms-dialog__content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/*
   條款內文由 partial 以 HTML 結構輸出（標題階層／粗體／編號）。
   style.css 的 * reset 把 margin/padding 全部歸零，所以段落間距、清單縮排與項目符號都得在這裡補回。
*/
.login-terms-dialog__content h3 {
    margin: 20px 0 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
}

.login-terms-dialog__content > :first-child {
    margin-top: 0;
}

.login-terms-dialog__content p,
.login-terms-dialog__content ol,
.login-terms-dialog__content ul {
    margin-bottom: 12px;
}

.login-terms-dialog__content > :last-child {
    margin-bottom: 0;
}

.login-terms-dialog__content ol {
    padding-inline-start: 1.8em;
    list-style: decimal;
}

.login-terms-dialog__content ul {
    padding-inline-start: 1.4em;
    list-style: disc;
}

/* 巢狀子項貼著所屬編號項目，不再吃外層的段落間距。 */
.login-terms-dialog__content li > ul {
    margin: 6px 0 0;
}

.login-terms-dialog__content li {
    margin-bottom: 6px;
}

.login-terms-dialog__content li:last-child {
    margin-bottom: 0;
}

/* 內文本身是次要灰，粗體要回到主要文字色才跳得出來。 */
.login-terms-dialog__content strong {
    color: var(--text-primary);
    font-weight: 700;
}
