/* ==================== 全局基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #7B1FA2;
    --primary-dark: #6A1B9A;
    --primary-light: #E1BEE7;
    --bg: #EDEDED;
    --white: #FFFFFF;
    --text: #111111;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #E5E5E5;
    --error: #E53935;
    --success: #43A047;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== 登录页 ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 40px;
    width: 100%;
    max-width: 480px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 36px;
    color: white;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-dark);
}

.login-logo p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 登录方式切换 Tab */
.login-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.login-tab:hover {
    color: var(--primary);
}

.login-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 助记词输入 */
.mnemonic-section {
    display: none;
}

.mnemonic-section.active {
    display: block;
}

.mnemonic-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-align: center;
    line-height: 1.6;
}

.mnemonic-hint .icon-warn {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #FF9800;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    margin-right: 4px;
    vertical-align: -1px;
}

.mnemonic-input-area {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.mnemonic-word {
    position: relative;
}

.mnemonic-word .word-index {
    position: absolute;
    top: 2px;
    left: 6px;
    font-size: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.mnemonic-word input {
    width: 100%;
    padding: 8px 6px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.mnemonic-word input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(123, 31, 162, 0.1);
}

.mnemonic-word input.valid {
    border-color: var(--success);
    background: #f1f8e9;
}

.mnemonic-word input.invalid {
    border-color: var(--error);
    background: #fce4ec;
}

.mnemonic-error {
    color: var(--error);
    font-size: 13px;
    margin-top: 8px;
    display: none;
    text-align: center;
}

.mnemonic-error.show {
    display: block;
}

/* 二维码登录 */
.qrcode-section {
    display: none;
    text-align: center;
}

.qrcode-section.active {
    display: block;
}

.qrcode-container {
    display: inline-block;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 16px 0;
}

.qrcode-container canvas,
.qrcode-container img {
    display: block;
    width: 200px;
    height: 200px;
}

.qrcode-tip {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 8px;
}

.qrcode-tip .highlight {
    color: var(--primary);
    font-weight: 500;
}

.qrcode-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-light);
}

.qrcode-status .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.qrcode-status.success {
    color: var(--success);
}

.qrcode-status.error {
    color: var(--error);
}

/* 登录按钮 */
.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 20px;
}

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

.login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.login-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== 对话框/Toast ==================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
}

.modal-dialog .modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.modal-dialog h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.modal-dialog p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.modal-dialog button {
    padding: 10px 24px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast.show {
    opacity: 1;
}

/* ==================== 响应式 ==================== */
@media (max-width: 520px) {
    .login-card {
        padding: 24px 20px;
        border-radius: 12px;
    }
    .mnemonic-input-area {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .mnemonic-word input {
        font-size: 12px;
        padding: 6px 4px 4px 4px;
    }
}
