/* ============================================
   身份核验系统 - 全局样式
   深色科技感 UI，无动画卡通元素
   ============================================ */

/* ===== 重置 ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f1623;
    --bg-card: #141b2d;
    --bg-input: #0d1420;
    --border: #1e293b;
    --border-light: #334155;
    --accent: #00d4ff;
    --accent-dim: #0891b2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius: 12px;
    --radius-sm: 8px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
                 Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 布局容器 ===== */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.page-desktop .app-container {
    max-width: 520px;
}

/* ===== 顶部 ===== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.header-status-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== 主内容 ===== */
.app-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.mobile-main {
    padding: 16px;
}

/* ===== 步骤面板 ===== */
.step-panel {
    display: none;
    width: 100%;
}

.step-panel.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== 卡片 ===== */
.panel-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.panel-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 24px;
}

/* ===== 二维码区域 ===== */
.qr-wrapper {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.qr-frame {
    position: relative;
    padding: 20px;
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.15);
}

.qrcode-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-box svg {
    display: block;
}

.qr-corner {
    position: absolute;
}

.qr-tl { top: 6px; left: 6px; }
.qr-tr { top: 6px; right: 6px; }
.qr-bl { bottom: 6px; left: 6px; }
.qr-br { bottom: 6px; right: 6px; }

/* ===== 二维码提示 ===== */
.qr-tips {
    margin-top: 16px;
}

.tip-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 过期倒计时 ===== */
.expire-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.expire-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.expire-track {
    flex: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.expire-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 1s linear;
    width: 100%;
}

.expire-time {
    font-size: 13px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ===== 步骤进度 ===== */
.step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.step-item.done .step-num {
    background: var(--success);
    color: #ffffff;
    border-color: var(--success);
}

.step-item.active .step-num {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.step-label {
    font-size: 11px;
    color: var(--text-muted);
}

.step-item.done .step-label,
.step-item.active .step-label {
    color: var(--text-secondary);
}

.step-line {
    width: 32px;
    height: 1px;
    background: var(--border);
    margin-bottom: 18px;
}

.step-line.active {
    background: var(--accent);
}

/* ===== 大图标 ===== */
.icon-large {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

/* ===== 扫描动画 ===== */
.scan-animation {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.scan-line {
    animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
    0%, 100% { transform: translateY(-60px); opacity: 0.2; }
    50% { transform: translateY(60px); opacity: 0.8; }
}

.scan-dot {
    animation: scanPulse 1.5s ease-in-out infinite;
}

@keyframes scanPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ===== 表单 ===== */
.info-form {
    text-align: left;
    margin-top: 8px;
}

.step-indicator {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin-bottom: 16px;
    font-size: 14px;
}

.step-current {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.step-divider {
    color: var(--text-muted);
}

.step-total {
    color: var(--text-muted);
}

.form-field {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-field input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-field input::placeholder {
    color: var(--text-muted);
}

.form-notice {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.form-notice span {
    font-size: 12px;
    color: var(--warning);
    line-height: 1.5;
}

.form-notice svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ===== 按钮 ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.2s;
    -webkit-appearance: none;
    letter-spacing: 1px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

/* ===== 活体检测 ===== */
.liveness-container {
    width: 100%;
    position: relative;
}

.camera-area {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 480px;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.camera-area video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* 镜像 */
}

.face-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.face-scan-line {
    animation: faceScan 2.5s ease-in-out infinite;
}

@keyframes faceScan {
    0%, 100% { transform: translateY(-100px); opacity: 0; }
    50% { transform: translateY(100px); opacity: 0.6; }
}

.face-status {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(10, 14, 26, 0.85);
    border-radius: 20px;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
}

.face-status-icon {
    display: flex;
    align-items: center;
    color: var(--accent);
}

.face-status span {
    font-size: 13px;
    color: var(--text-primary);
}

/* ===== 动作指令 ===== */
.action-area {
    margin-top: 20px;
    text-align: center;
}

.action-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.action-prompt span {
    font-size: 17px;
    font-weight: 600;
    color: var(--accent);
}

.action-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    transition: background 0.3s;
}

.progress-dot.active {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

/* ===== 加载覆盖层 ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    border-radius: var(--radius);
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

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

.spinner-circle {
    animation: spinnerRotate 1s linear infinite;
    transform-origin: center;
}

@keyframes spinnerRotate {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -240; }
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== 活体检测错误 ===== */
.liveness-error {
    text-align: center;
    padding: 40px 20px;
}

/* ===== 结果页 ===== */
.result-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.result-name {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===== 分数区域 ===== */
.score-section {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.score-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.score-value {
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.score-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.score-hint {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== 结果元信息 ===== */
.result-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    text-align: left;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.meta-label {
    font-size: 13px;
    color: var(--text-muted);
}

.meta-value {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== 微信引导 ===== */
.wechat-guide {
    text-align: center;
}

.wechat-guide svg {
    margin-bottom: 16px;
}

.wechat-guide strong {
    color: var(--accent);
    font-size: 18px;
}

/* ===== 底部 ===== */
.app-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* ===== 手机端适配 ===== */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }

    .panel-card {
        padding: 24px 20px;
    }

    .panel-title {
        font-size: 18px;
    }

    .camera-area {
        max-height: 380px;
    }

    .action-prompt span {
        font-size: 15px;
    }
}

/* ===== 大屏适配 ===== */
@media (min-width: 768px) {
    .app-container {
        max-width: 520px;
        box-shadow: 0 0 60px rgba(0, 212, 255, 0.05);
    }

    .panel-card {
        padding: 40px 32px;
    }
}

/* ===== 安全区域适配（iPhone） ===== */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .app-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}
