/* =========================================
   common.css - 全局公共组件
   ========================================= */

:root {
    --bg: #FFFFFF;
    --bg-soft: #FBFBFD;
    --bg-card: #F5F5F7;
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --text-tertiary: #86868B;
    --border: #D2D2D7;
    --accent: #0071E3;
    --accent-hover: #0077ED;
    --danger: #FF3B30;
    --success: #34C759;
    --warning: #FF9500;
    
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

/* ===== 基础重置 ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
}

/* ===== 顶栏 ===== */
.topbar {
    flex-shrink: 0;
    height: 44px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
    height: calc(44px + env(safe-area-inset-top, 0));
}

.topbar-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: -8px;
    cursor: pointer;
    color: var(--accent);
    text-decoration: none;
    font-size: 17px;
}

.topbar-back::before {
    content: '‹';
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.topbar-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.topbar-action {
    min-width: 32px;
    text-align: right;
    font-size: 15px;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

/* ===== 步骤指示器 ===== */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--bg-card);
}

.step-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.step-dot .num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.step-dot.active .num {
    background: var(--accent);
    color: white;
}

.step-dot.active {
    color: var(--text-primary);
    font-weight: 600;
}

.step-dot.done .num {
    background: var(--success);
    color: white;
}

.step-line {
    width: 16px;
    height: 1px;
    background: var(--border);
}

/* ===== 底部按钮栏 ===== */
.bottom-bar {
    flex-shrink: 0;        /* 画框内底部,固定高度不压缩 */
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    z-index: 50;
}

.bottom-bar .info {
    flex: 1;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.bottom-bar .info strong {
    color: var(--accent);
    margin: 0 2px;
    font-weight: 600;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #E8E8ED;
}

.btn-ghost {
    background: transparent;
    color: var(--accent);
    padding: 0 12px;
}

.btn-block {
    width: 100%;
}

.btn-flex {
    flex: 1;
}

.btn-large {
    height: 50px;
    font-size: 17px;
}

/* ===== 通用容器 ===== */
.container {
    min-height: 100vh;
    padding-bottom: 80px;
}

.page-content {
    padding: 16px;
}

/* ===== 空状态 ===== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-text {
    font-size: 14px;
}

/* ===== 通用文字 ===== */
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--accent); }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }

/* ===== 通用工具 ===== */
*[hidden] { display: none !important; }
button[hidden] { display: none !important; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ===== 减弱动效 ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}