/* 登录/注册页面 & 账号管理弹窗样式 */

:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --border: #e5e7eb;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --green: #16a34a;
    --green-hover: #15803d;
    --input-bg: #f9fafb;
    --input-focus: #eff6ff;
    --top-action-right: 18px;
    --site-logo-left: 72px;
    --site-logo-top: 34px;
    --site-logo-width: 264px;
    --site-logo-height: 72px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ── 登录页面 ───────────────────────────────── */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 12px;
}

.login-card {
    width: min(400px, calc(100vw - 24px));
    background: var(--card);
    border-radius: 18px;
    padding: 28px 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.login-hero {
    text-align: center;
    margin-bottom: 20px;
}

.login-hero h1 {
    margin: 0 0 4px 0;
    font-size: 32px;
}

.login-hero p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* ── 表单 ──────────────────────────────────── */

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: bold;
    color: #374151;
}

.form-group label .optional {
    font-weight: normal;
    color: var(--muted);
    font-size: 13px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--input-focus);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* ── 消息 ──────────────────────────────────── */

.message {
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--green);
}

.message.info {
    color: var(--muted);
}

/* ── 按钮 ──────────────────────────────────── */

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
    display: block;
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--blue);
    color: white;
}

.btn-primary:hover {
    background: var(--blue-hover);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    margin-top: 8px;
}

.btn-ghost:hover {
    background: var(--input-bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--muted);
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider span {
    padding: 0 10px;
}

/* ── 弹窗（复用现有风格） ────────────────────── */

.modal-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.34);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 全局确认弹窗必须在所有动态弹窗之上 */
#global-modal-mask {
    z-index: 1100;
}

.modal-mask.show {
    display: flex;
}

.modal-card {
    width: min(440px, calc(100vw - 32px));
    background: white;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.20);
    padding: 24px 20px;
    text-align: center;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: bold;
    margin: 0 auto 12px auto;
}

.modal-icon.success {
    background: #ecfdf5;
    color: var(--green);
}

.modal-icon.warning {
    background: #fffbeb;
    color: #d97706;
}

.modal-icon.info {
    background: #eff6ff;
    color: var(--blue);
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text);
}

.modal-body {
    font-size: 14px;
    color: #374151;
    line-height: 1.8;
    margin-bottom: 18px;
    white-space: pre-wrap;
    text-align: left;
    background: var(--input-bg);
    border-radius: 10px;
    padding: 12px 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions button {
    padding: 10px 22px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-actions button.primary {
    background: var(--blue);
    color: white;
}

.modal-actions button.primary:hover {
    background: var(--blue-hover);
}

.modal-actions button.secondary {
    background: #6b7280;
    color: white;
}

.modal-actions button.secondary:hover {
    background: #4b5563;
}

.modal-actions button.danger {
    background: var(--danger);
    color: white;
}

.modal-actions button.danger:hover {
    background: var(--danger-hover);
}

/* ── 账号管理弹窗内联样式补丁 ──────────────── */

.account-field-row {
    margin-bottom: 14px;
    text-align: left;
}

.account-field-row label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: bold;
    color: #374151;
}

.account-field-row input,
.account-field-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--input-bg);
}

.account-field-row input:focus,
.account-field-row textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: var(--input-focus);
}

.account-field-row textarea {
    resize: vertical;
    min-height: 60px;
}

.account-save-msg {
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.account-save-msg.error {
    color: var(--danger);
}

.account-save-msg.success {
    color: var(--green);
}

/* ── 模式页统一头部 ────────────────────────── */

.page-top-shell {
    position: relative;
    margin-bottom: 18px;
    min-height: 132px;
    padding: 22px 0 18px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.92);
}

.page-top-shell .page-version-chip,
.version-switch-btn {
    position: fixed;
    top: 36px;
    left: calc(var(--site-logo-left) + var(--site-logo-width) + 24px);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #f59e0b;
    background: #fef3c7;
    color: #92400e;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
}

.site-logo-link {
    position: fixed;
    top: var(--site-logo-top);
    left: var(--site-logo-left);
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--site-logo-width);
    height: var(--site-logo-height);
    text-decoration: none;
}

.site-logo-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-top-shell .page-version-chip:hover,
.version-switch-btn:hover {
    background: #fde68a;
}

.page-title-block {
    text-align: center;
    padding-top: 6px;
}

.page-title-block h1 {
    margin: 0 0 8px 0;
    font-size: 38px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.page-title-block p {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.header-actions,
.page-top-shell .header-actions {
    position: fixed;
    top: 18px;
    right: var(--top-action-right);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border: 1px solid rgba(229, 231, 235, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(14px);
}

.header-actions .header-account-btn,
.page-top-shell .header-actions .header-account-btn {
    position: static;
    top: auto;
    right: auto;
    width: 92px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.header-actions .header-account-btn:hover,
.page-top-shell .header-actions .header-account-btn:hover {
    background: #eff6ff;
}

.header-actions .header-account-btn.danger,
.page-top-shell .header-actions .header-account-btn.danger {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.header-actions .header-account-btn.danger:hover,
.page-top-shell .header-actions .header-account-btn.danger:hover {
    background: var(--danger-hover);
}

.page-mode-toolbar {
    position: fixed;
    top: 86px;
    right: var(--top-action-right);
    z-index: 90;
    width: max-content;
    max-width: calc(100vw - 36px);
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.page-mode-toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    pointer-events: auto;
    max-width: 100%;
}

.page-mode-toolbar-group > a,
.page-mode-toolbar-group > button {
    min-width: 92px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-decoration: none;
}

.page-mode-toolbar-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── 右上角按钮 ────────────────────────────── */

.header-account-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: background 0.15s;
    text-decoration: none;
    display: inline-block;
}

.header-account-btn:hover {
    background: var(--input-focus);
}

@media (max-width: 980px) {
    .page-top-shell {
        min-height: 184px;
        padding-top: 92px;
    }

    .page-title-block h1 {
        font-size: 32px;
    }
}

@media (max-width: 820px) {
    .page-top-shell {
        min-height: 0;
        padding-top: 0;
    }

    .site-logo-link {
        position: static;
        width: 220px;
        height: 60px;
        margin-bottom: 10px;
    }

    .page-top-shell .page-version-chip,
    .version-switch-btn {
        position: static;
        margin: 0 auto 14px 0;
    }

    .header-actions,
    .page-top-shell .header-actions {
        position: static;
        width: fit-content;
        max-width: 100%;
        margin: 0 0 18px auto;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .page-mode-toolbar {
        position: static;
        width: 100%;
        min-height: 0;
        margin: 0 0 18px 0;
        padding: 0;
    }

    .page-title-block {
        padding-top: 0;
    }

    .page-title-block h1 {
        font-size: 30px;
    }

    .page-title-block p {
        font-size: 15px;
    }
}

@media (max-width: 560px) {
    .header-actions,
    .page-top-shell .header-actions {
        width: 100%;
        gap: 8px;
        justify-content: stretch;
    }

    .header-actions .header-account-btn,
    .page-top-shell .header-actions .header-account-btn {
        width: auto;
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .page-mode-toolbar {
        justify-content: stretch;
    }

    .page-mode-toolbar-group {
        width: 100%;
    }

    .page-mode-toolbar-group > * {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        text-align: center;
    }
}
