/* ============================================
   AZBlog Security Auth - Enterprise White Theme
   纯白企业级安全认证风格
   ============================================ */

:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-light: #dbeafe;
    --blue-bg: #eff6ff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-placeholder: #cbd5e1;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --border: #e2e8f0;
    --border-focus: #2563eb;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px -5px rgba(0,0,0,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --red: #ef4444;
    --orange: #f59e0b;
    --green: #10b981;
    --green-light: #d1fae5;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* ========== 粒子背景（浅色版） ========== */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========== 主容器 ========== */
.main-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    gap: 1.5rem;
}

/* ========== 品牌区域 ========== */
.brand-section {
    text-align: center;
    animation: fadeInDown .6s ease-out;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.logo {
    width: 64px;
    height: 64px;
    margin: 0 auto .75rem;
}

.logo-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(37,99,235,0.15));
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 6px;
    margin-bottom: .25rem;
}

.brand-subtitle {
    font-size: .85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: .75rem;
}

.status-bar {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 1rem;
    background: var(--green-light);
    border-radius: 20px;
    font-size: .75rem;
    color: var(--green);
    font-weight: 500;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .4; }
}

.time-display {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ========== 认证卡片 ========== */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp .6s ease-out .1s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== 登录标签切换 ========== */
.auth-tabs {
    display: flex;
    gap: .25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .6rem .3rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: .7rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all .2s ease;
    font-family: inherit;
    font-weight: 500;
}

.auth-tab svg {
    transition: all .2s ease;
}

.auth-tab:hover {
    color: var(--text-secondary);
    background: rgba(37,99,235,0.04);
}

.auth-tab.active {
    color: var(--blue);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

/* ========== 面板 ========== */
.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
    animation: panelIn .3s ease-out;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-align: center;
    color: var(--text-primary);
}

/* ========== 表单 ========== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: .9rem .9rem .9rem 2.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: .95rem;
    font-family: inherit;
    transition: all .2s ease;
    outline: none;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--border-focus);
    background: #fff;
    box-shadow: 0 0 0 3px var(--blue-light);
}

.input-group input:valid:not(:placeholder-shown),
.input-group textarea:valid:not(:placeholder-shown) {
    border-color: var(--border);
}

.input-group textarea {
    padding-left: .9rem;
    resize: none;
    font-family: "Courier New", monospace;
    font-size: .85rem;
}

.input-group label {
    position: absolute;
    left: 2.4rem;
    top: .9rem;
    color: var(--text-muted);
    font-size: .9rem;
    pointer-events: none;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    gap: .4rem;
    background: transparent;
}

.input-group label svg {
    opacity: .5;
    flex-shrink: 0;
}

.input-group input:focus ~ label,
.input-group input:valid ~ label,
.input-group textarea:focus ~ label,
.input-group textarea:valid ~ label {
    top: -.45rem;
    left: .6rem;
    font-size: .7rem;
    color: var(--blue);
    background: var(--bg-card);
    padding: 0 .4rem;
}

.input-group input:focus ~ label svg,
.input-group input:valid ~ label svg,
.input-group textarea:focus ~ label svg,
.input-group textarea:valid ~ label svg {
    opacity: 1;
}

.input-line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--blue);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    transition: all .25s ease;
}

.input-group input:focus ~ .input-line,
.input-group textarea:focus ~ .input-line {
    left: 0;
    width: 100%;
}

/* 密码可见性切换 */
.toggle-password {
    position: absolute;
    right: .8rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .25rem;
    transition: color .2s ease;
    z-index: 5;
}

.toggle-password:hover {
    color: var(--blue);
}

/* ========== 验证码区域 ========== */
.security-check {
    display: flex;
    gap: .6rem;
    align-items: flex-end;
}

.captcha-box {
    display: flex;
    align-items: center;
    gap: .3rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: .25rem;
    border: 1px solid var(--border);
}

#captchaCanvas {
    border-radius: 4px;
    display: block;
}

.refresh-captcha {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .3rem;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    border-radius: 4px;
}

.refresh-captcha:hover {
    color: var(--blue);
    background: var(--blue-light);
}

.captcha-input {
    flex: 1;
}

.captcha-input input {
    padding-left: .8rem;
}

.captcha-input label {
    left: .8rem;
}

.captcha-input input:focus ~ label,
.captcha-input input:valid ~ label {
    left: .4rem;
}

/* ========== 提交按钮 ========== */
.submit-btn {
    position: relative;
    width: 100%;
    padding: .85rem 1.5rem;
    background: var(--blue);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-family: inherit;
    margin-top: .25rem;
}

.submit-btn:hover {
    background: var(--blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.submit-btn.loading .btn-text,
.submit-btn.loading .btn-arrow {
    display: none;
}

.submit-btn.loading .btn-loader {
    display: block;
}

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

.btn-arrow {
    transition: transform .2s ease;
}

.submit-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* ========== 链接 ========== */
.form-links {
    display: flex;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .85rem;
    transition: color .2s ease;
}

.link:hover {
    color: var(--blue);
}

/* ========== 人脸识别 ========== */
.face-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: .75rem;
    border: 1px solid var(--border);
}

#faceVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#faceOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.face-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--blue);
    opacity: 0;
    z-index: 5;
}

.face-scan-line.scanning {
    opacity: 1;
    animation: scanDown 2s ease-in-out infinite;
}

@keyframes scanDown {
    0%   { top: 0; }
    50%  { top: 100%; }
    100% { top: 0; }
}

.face-scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    opacity: 0;
    z-index: 5;
    transition: opacity .3s ease;
}

.face-scan-ring.active {
    opacity: 1;
    animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50%      { transform: translate(-50%, -50%) scale(1.08); }
}

.face-status {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(248,250,252,0.92);
    z-index: 10;
    transition: opacity .3s ease;
    backdrop-filter: blur(2px);
}

.face-status.hidden {
    opacity: 0;
    pointer-events: none;
}

.face-status-icon {
    margin-bottom: .6rem;
}

.face-status-text {
    color: var(--text-secondary);
    font-size: .85rem;
}

.face-start-btn {
    margin-bottom: .75rem;
}

.face-tips {
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.face-tips a {
    color: var(--blue);
    text-decoration: none;
}

.face-tips a:hover {
    text-decoration: underline;
}

/* ========== 短信验证码 ========== */
.sms-code-group {
    display: flex;
    gap: .5rem;
}

.sms-code-group .input-group {
    flex: 1;
}

.sms-send-btn {
    padding: .8rem .9rem;
    background: var(--blue-bg);
    border: 1px solid var(--blue-light);
    border-radius: var(--radius-sm);
    color: var(--blue);
    font-size: .8rem;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    font-family: inherit;
    font-weight: 500;
}

.sms-send-btn:hover:not(:disabled) {
    background: var(--blue-light);
}

.sms-send-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.send-timer {
    display: none;
}

.send-timer.active {
    display: inline;
}

.send-text.hidden {
    display: none;
}

/* ========== 注册卡片 ========== */
.register-card {
    animation: fadeInUp .5s ease-out;
}

.password-strength {
    display: flex;
    gap: 4px;
    margin-top: .4rem;
    padding: 0 .15rem;
}

.strength-bar {
    flex: 1;
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    transition: all .25s ease;
}

.strength-bar.weak   { background: var(--red); }
.strength-bar.medium { background: var(--orange); }
.strength-bar.strong { background: #fbbf24; }
.strength-bar.very-strong { background: var(--green); }

/* 协议复选 */
.terms-check {
    margin-top: -.25rem;
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    cursor: pointer;
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    margin-top: 1px;
    background: #fff;
}

.checkmark::after {
    content: '';
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: all .2s ease;
    margin-bottom: 1px;
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--blue);
    border-color: var(--blue);
}

.checkbox-container input:checked ~ .checkmark::after {
    opacity: 1;
}

.checkbox-container a {
    color: var(--blue);
    text-decoration: none;
}

/* ========== 忘记密码面板 ========== */
.forgot-card {
    animation: fadeInUp .5s ease-out;
}

.forgot-tabs {
    display: flex;
    gap: .4rem;
    margin-bottom: 1.25rem;
}

.forgot-tab {
    flex: 1;
    padding: .55rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .82rem;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
}

.forgot-tab.active {
    color: var(--blue);
    border-color: var(--blue);
    background: var(--blue-bg);
}

.forgot-panel {
    display: none;
}

.forgot-panel.active {
    display: block;
    animation: panelIn .3s ease-out;
}

.key-tips {
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .75rem;
    line-height: 1.7;
}

.key-tips a {
    color: var(--blue);
    text-decoration: none;
}

/* ========== 安全提示条 ========== */
.security-tips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .5rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .75rem;
    color: var(--text-muted);
    box-shadow: var(--shadow);
    animation: fadeInUp .6s ease-out .2s both;
}

.tip-icon {
    color: var(--blue);
    display: flex;
    align-items: center;
}

/* ========== 通知弹窗 ========== */
.notification {
    position: fixed;
    top: 1.5rem;
    right: -400px;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: right .35s ease;
}

.notification.show {
    right: 1.5rem;
}

.notification.success { border-left: 3px solid var(--green); }
.notification.error   { border-left: 3px solid var(--red); }
.notification.warning { border-left: 3px solid var(--orange); }

.notification-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.notification.success .notification-icon {
    background: var(--green-light);
    color: var(--green);
}

.notification.error .notification-icon {
    background: #fee2e2;
    color: var(--red);
}

.notification.warning .notification-icon {
    background: #fef3c7;
    color: #d97706;
}

.notification-content h4 {
    font-size: .88rem;
    margin-bottom: .15rem;
    color: var(--text-primary);
    font-weight: 600;
}

.notification-content p {
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: .15rem;
    transition: color .2s ease;
    line-height: 1;
    margin-left: auto;
}

.notification-close:hover {
    color: var(--text-primary);
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241,245,249,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    position: relative;
    width: 64px;
    height: 64px;
}

.spinner-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2.5px solid transparent;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 1.1s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 55%;
    height: 55%;
    top: 22.5%;
    left: 22.5%;
    border-top-color: var(--blue-light);
    animation-direction: reverse;
    animation-duration: .85s;
}

.spinner-ring:nth-child(3) {
    width: 28%;
    height: 28%;
    top: 36%;
    left: 36%;
    border-top-color: var(--blue-dark);
    animation-duration: .55s;
}

.loading-text {
    margin-top: 1.25rem;
    color: var(--blue);
    font-size: .9rem;
    font-weight: 500;
    animation: textPulse 1.5s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .45; }
}

/* ========== 二维码登录 ========== */
.qrcode-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.qrcode-display {
    position: relative;
    width: 200px;
    height: 200px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qrcode-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    color: var(--text-muted);
    font-size: .82rem;
}

.qrcode-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241,245,249,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    z-index: 5;
}

.qrcode-mask p {
    color: var(--text-secondary);
    font-size: .85rem;
}

.qrcode-info {
    text-align: center;
}

.qrcode-info p {
    font-size: .85rem;
    color: var(--text-secondary);
    margin: .2rem 0;
}

.qrcode-url {
    font-size: .72rem;
    color: var(--text-muted);
    word-break: break-all;
    max-width: 260px;
    font-family: "Courier New", monospace;
}

.qrcode-tips {
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ========== 响应式 ========== */
@media (max-width: 480px) {
    .brand-title {
        font-size: 1.5rem;
        letter-spacing: 3px;
    }

    .auth-card {
        padding: 1.5rem;
        margin: 0 .25rem;
    }

    .auth-tab span {
        font-size: .65rem;
    }

    .security-check {
        flex-direction: row;
        align-items: center;
        gap: .4rem;
    }

    .captcha-box {
        width: auto;
        flex-shrink: 0;
        padding: .15rem;
    }

    .captcha-input {
        flex: 1;
        min-width: 0;
    }

    .captcha-input input {
        padding-left: .7rem;
        padding-right: .7rem;
    }

    .captcha-input label {
        left: .7rem;
    }

    .captcha-input input:focus ~ label,
    .captcha-input input:valid ~ label {
        left: .4rem;
    }

    .notification {
        width: calc(100vw - 2rem);
        right: -100vw;
    }

    .notification.show {
        right: 1rem;
    }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

::selection {
    background: var(--blue-light);
    color: var(--blue-dark);
}
