/* ========================================
   MoonStone Passport - Ant Design 风格
   H5 移动端优先
   ======================================== */

:root {
    --primary: #1677ff;
    --primary-hover: #4096ff;
    --primary-active: #0958d9;
    --success: #52c41a;
    --warning: #faad14;
    --error: #ff4d4f;
    --text: rgba(0,0,0,0.88);
    --text-secondary: rgba(0,0,0,0.65);
    --text-tertiary: rgba(0,0,0,0.45);
    --text-quaternary: rgba(0,0,0,0.25);
    --bg: #f5f5f5;
    --bg-white: #fff;
    --bg-card-hover: #fafafa;
    --bg-input: #fff;
    --border: #d9d9d9;
    --border-light: #f0f0f0;
    --radius: 8px;
    --shadow: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02);
    --shadow-hover: 0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    /* 暗色模式变量 */
    --panel-bg: #000;
    --badge-blue-bg: #e6f4ff;
    --badge-orange-bg: #fff7e6;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #1677ff;
        --primary-hover: #4096ff;
        --primary-active: #0958d9;
        --text: rgba(255,255,255,0.85);
        --text-secondary: rgba(255,255,255,0.65);
        --text-tertiary: rgba(255,255,255,0.45);
        --text-quaternary: rgba(255,255,255,0.25);
        --bg: #141414;
        --bg-white: #1f1f1f;
        --bg-card-hover: #2a2a2a;
        --bg-input: #2a2a2a;
        --border: #434343;
        --border-light: #303030;
        --shadow: none;
        --shadow-hover: 0 3px 6px -4px rgba(0,0,0,0.5), 0 6px 16px 0 rgba(0,0,0,0.4);
        --panel-bg: #000;
        --badge-blue-bg: rgba(22,119,255,0.15);
        --badge-orange-bg: rgba(250,173,20,0.15);
    }
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5715;
    color-scheme: light dark;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ========== Container ========== */
.auth-container { display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg); }
@media (min-width: 768px) { .auth-container { flex-direction: row; } }

/* ========== Left Panel ========== */
.auth-panel { display: block; flex: none; position: relative; overflow: hidden; background: var(--panel-bg); height: 200px; }
.auth-panel-bg { position: absolute; inset: 0; background: url('/c6721391034de935b7715fad998fd6a0.jpg') center/cover no-repeat; filter: brightness(0.55); }
.auth-panel-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 24px; }
.auth-panel-logo { width: 50%; max-width: 240px; height: auto; filter: drop-shadow(0 0 20px rgba(22,119,255,0.3)); }
@media (min-width: 768px) {
    .auth-panel { display: block; flex: 1; height: auto; }
    .auth-panel-content { padding: 48px; }
    .auth-panel-logo { width: 85%; max-width: 500px; }
}

/* ========== Form Side ========== */
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px 40px; background: var(--bg); overflow-y: auto; }
@media (min-width: 768px) { .auth-main { max-width: 480px; flex: none; padding: 48px 40px; } }
@media (max-width: 767px) { .auth-main { padding: 28px 20px 40px; } }
.auth-card { width: 100%; max-width: 400px; }

/* Mobile logo - hidden, using panel logo instead */
.auth-mobile-logo { display: none; }

/* ========== Site Brand Logo ========== */
.brand-logo { height: 26px; width: auto; max-width: 180px; display: block; filter: drop-shadow(0 0 14px rgba(22,119,255,0.25)); }
@media (max-width: 767px) { .brand-logo { height: 22px; } }

.topbar-logo { height: 22px; width: auto; max-width: 130px; display: block; filter: drop-shadow(0 0 10px rgba(22,119,255,0.25)); }

/* ========== Typography ========== */
.page-title { font-size: 24px; font-weight: 600; color: var(--text); text-align: center; line-height: 1.35; margin-bottom: 8px; }
.page-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 32px; line-height: 1.5; }

/* ========== Ant Design Card ========== */
.ant-card { background: var(--bg-white); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }

/* Legal notice card */
.legal-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--bg-white); border: 1px solid var(--border-light); border-radius: var(--radius); margin-bottom: 12px; }
.legal-item-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.legal-item-icon.blue { background: var(--badge-blue-bg); color: var(--primary); }
.legal-item-icon.orange { background: var(--badge-orange-bg); color: var(--warning); }
.legal-item-body h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.legal-item-body p { font-size: 12px; color: var(--text-secondary); line-height: 1.6; }

/* ========== Agreement ========== */
.agreement-block { background: var(--bg-white); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.agreement-block h4 { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 14px; }
.agreement-links { display: flex; gap: 8px; margin-bottom: 14px; font-size: 14px; }
.agreement-links a { color: var(--primary); font-weight: 500; }
.agreement-links .divider { color: var(--border); }

.ant-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; margin-bottom: 10px; line-height: 1.5; }
.ant-checkbox input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.ant-checkbox input:disabled { opacity: 0.4; cursor: not-allowed; }
.ant-checkbox a { color: var(--primary); font-weight: 500; }

/* ========== Timer ========== */
.timer-block { margin-bottom: 24px; }
.timer-bar { height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.timer-bar-fill { height: 100%; width: 0; background: var(--primary); border-radius: 2px; transition: width 0.3s linear; }
.timer-label { font-size: 12px; color: var(--text-tertiary); text-align: center; }
.timer-label.done { color: var(--success); }

/* ========== Form ========== */
.ant-form-item { margin-bottom: 20px; }
.ant-form-item label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.ant-form-item label .required { color: var(--error); margin-left: 2px; }
.ant-form-item label .hint { font-size: 12px; color: var(--text-tertiary); font-weight: 400; }
.ant-input-wrapper { position: relative; display: flex; align-items: center; }
.ant-input-wrapper .ant-input-prefix { position: absolute; left: 12px; color: var(--text-tertiary); pointer-events: none; display: flex; }
.ant-input { width: 100%; height: 40px; padding: 0 12px 0 36px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; outline: none; transition: all 0.2s; font-family: var(--font); }
.ant-input:hover { border-color: var(--primary-hover); }
.ant-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,0.15); }
.ant-input::placeholder { color: var(--text-tertiary); }
input[type="date"] { padding-right: 12px; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; filter: invert(var(--date-icon-invert, 0)); }
@media (prefers-color-scheme: dark) { input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.6); } }
.ant-input-suffix { position: absolute; right: 10px; background: none; border: none; color: var(--text-tertiary); cursor: pointer; padding: 4px; display: flex; }
.ant-input-suffix:hover { color: var(--text-secondary); }

/* Password meter */
.pass-meter { height: 3px; background: var(--border-light); border-radius: 2px; margin-top: 6px; }
.pass-meter-bar { height: 100%; border-radius: 2px; transition: all 0.3s; }
.pass-meter-bar.weak { width: 25%; background: var(--error); }
.pass-meter-bar.medium { width: 50%; background: var(--warning); }
.pass-meter-bar.strong { width: 75%; background: var(--primary); }
.pass-meter-bar.best { width: 100%; background: var(--success); }

/* ========== reCAPTCHA ========== */
.recaptcha-wrap { margin-bottom: 24px; min-height: 78px; }
.recaptcha-wrap > div { display: flex; justify-content: center; }

/* ========== Buttons ========== */
.ant-btn { display: block; width: 100%; height: 44px; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 500; cursor: pointer; text-align: center; transition: all 0.2s; font-family: var(--font); letter-spacing: 1px; }
.ant-btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 0 rgba(22,119,255,0.06); }
.ant-btn-primary:hover { background: var(--primary-hover); }
.ant-btn-primary:active { background: var(--primary-active); }
.ant-btn-primary:disabled { background: var(--border-light); color: var(--text-quaternary); box-shadow: none; cursor: not-allowed; }
.ant-btn-default { background: var(--bg-white); border: 1px solid var(--border); color: var(--text); }
.ant-btn-default:hover { color: var(--primary); border-color: var(--primary); }

/* ========== Bottom link ========== */
.bottom-link-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg-white); border: 1px solid var(--border-light); border-radius: var(--radius); color: var(--text); text-decoration: none; transition: all 0.2s; margin-top: 20px; }
.bottom-link-card:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.bottom-link-card .link-icon { color: var(--primary); flex-shrink: 0; }
.bottom-link-card .link-text { flex: 1; }
.bottom-link-card .link-text .t1 { font-size: 14px; color: var(--text); font-weight: 500; }
.bottom-link-card .link-text .t2 { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.bottom-link-card .link-arrow { color: var(--text-tertiary); flex-shrink: 0; }

/* ========== Message ========== */
.ant-message { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; text-align: center; line-height: 1.5; }
.ant-message-error { background: rgba(255,77,79,0.1); border: 1px solid rgba(255,77,79,0.2); color: var(--error); }
.ant-message-success { background: rgba(82,196,26,0.1); border: 1px solid rgba(82,196,26,0.2); color: var(--success); }
.ant-message-info { background: rgba(22,119,255,0.1); border: 1px solid rgba(22,119,255,0.2); color: var(--primary); }

/* ========== Success card ========== */
.success-card { text-align: center; padding: 32px 24px; background: var(--bg-white); border: 1px solid var(--border-light); border-radius: var(--radius); }
.success-card .success-icon { width: 56px; height: 56px; margin: 0 auto 16px; background: rgba(82,196,26,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--success); }
.success-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.success-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.success-card .resend-hint { font-size: 12px; color: var(--text-tertiary); margin: 12px 0 16px; }

/* ========== Modal ========== */
.ant-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.ant-modal-wrap { background: var(--bg-white); border-radius: var(--radius); max-width: 520px; width: 92%; max-height: 75vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-hover); }
.ant-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border-light); }
.ant-modal-header h2 { font-size: 16px; font-weight: 600; color: var(--text); }
.ant-modal-close { background: none; border: none; font-size: 22px; color: var(--text-tertiary); cursor: pointer; line-height: 1; }
.ant-modal-close:hover { color: var(--text); }
.ant-modal-body { padding: 24px; overflow-y: auto; font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.ant-modal-body h4 { color: var(--text); margin: 14px 0 6px; font-size: 15px; }
.ant-modal-body strong { color: var(--text); }

/* ========== Verify page ========== */
.verify-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg);
}
.verify-container { text-align: center; padding: 48px 24px; max-width: 440px; width: 90%; }
.verify-container h1 { font-size: 24px; margin: 20px 0 8px; }
.verify-container p { color: var(--text-secondary); margin-bottom: 24px; }
.verify-container .ant-btn { display: inline-block; width: auto; padding: 0 32px; }

/* ========== Dashboard ========== */
.dashboard-page { background: var(--bg); min-height: 100vh; }
.dashboard-container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.dash-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 16px;
    height: 56px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
    border-radius: 0;
}
@media (min-width: 768px) {
    .dash-nav { padding: 0 24px; border-radius: var(--radius); border: 1px solid var(--border-light); }
}
.dash-nav-brand { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: 1px; }
.dash-nav-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.dash-welcome { padding: 24px 0; text-align: center; }
.dash-welcome h1 { font-size: 24px; margin-bottom: 4px; }
.dash-welcome p { color: var(--text-secondary); }
.dash-cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .dash-cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.dash-card {
    background: var(--bg-white); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 20px; transition: box-shadow 0.2s;
}
.dash-card:hover { box-shadow: var(--shadow-hover); }
.dash-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.dash-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ========== Loading ========== */
@keyframes spin { to { transform: rotate(360deg); } }
.loading-dot {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle; margin-right: 6px;
}

/* ========== Mobile fine-tune ========== */
@media (max-width: 767px) {
    .ant-btn { height: 46px; font-size: 16px; } /* Bigger touch target on mobile */
    .ant-input { height: 44px; font-size: 16px; } /* Prevent iOS zoom on focus */
}
