/**
 * 5G健康 V5.0 H5生产版 - 公共样式
 * 大厂风格：呼吸感、圆角柔和、阴影克制、交互流畅
 */

/* ========== 通用卡片 ========== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-md);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}

.card:active {
    transform: scale(0.985);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.card-body {
    font-size: var(--font-md);
    color: var(--text-secondary);
    line-height: 1.8;
}

.card-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: var(--font-md);
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: 0 4px 12px rgba(74, 139, 219, 0.25);
}

.btn-primary:active {
    transform: scale(0.96);
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-secondary:active {
    background: var(--primary-bg);
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-lg {
    padding: 15px 32px;
    font-size: var(--font-lg);
    border-radius: var(--radius-full);
}

.btn-sm {
    padding: 6px 14px;
    font-size: var(--font-sm);
}

.btn-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ========== 列表项 ========== */
.list-item {
    display: flex;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.list-item:active {
    background: var(--bg-gray);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: var(--space-md);
    color: var(--primary);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: var(--font-md);
    color: var(--text-primary);
    font-weight: 500;
}

.list-item-desc {
    font-size: var(--font-sm);
    color: var(--text-light);
    margin-top: 4px;
}

.list-item-arrow {
    font-size: 14px;
    color: var(--text-light);
    margin-left: var(--space-sm);
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all var(--transition-fast);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 139, 219, 0.08);
}

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

.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-row .form-group {
    flex: 1;
}

/* ========== 徽章 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 500;
}

.badge-primary {
    background: var(--primary-bg);
    color: var(--primary);
}

.badge-success {
    background: rgba(82, 196, 26, 0.08);
    color: var(--success);
}

.badge-warning {
    background: rgba(250, 173, 20, 0.08);
    color: var(--warning);
}

.badge-danger {
    background: rgba(255, 77, 79, 0.08);
    color: var(--danger);
}

/* ========== 标签页 ========== */
.tabs {
    display: flex;
    background: var(--bg-gray);
    padding: 3px;
    border-radius: var(--radius-full);
    margin: var(--space-md);
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 9px;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.tab-item.active {
    background: var(--bg-white);
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

/* ========== 空状态 ========== */
.empty-state {
    padding: var(--space-xxxl) var(--space-lg);
    text-align: center;
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-state-title {
    font-size: var(--font-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state-desc {
    font-size: var(--font-sm);
    color: var(--text-light);
}

/* ========== 加载状态 ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxxl);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========== 分隔线 ========== */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-md) 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: var(--border-light);
    margin: 0 var(--space-md);
}

/* ========== 头像 ========== */
.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-gray);
}

.avatar-sm { width: 36px; height: 36px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 88px; height: 88px; }

/* ========== 网格布局 ========== */
.grid { display: grid; gap: var(--space-md); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ========== Flex工具 ========== */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ========== 间距工具 ========== */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-xxl { margin-top: var(--space-xxl); }
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-xxl { margin-bottom: var(--space-xxl); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ========== 价格展示 ========== */
.price { color: var(--primary); font-weight: 600; }
.price-large { font-size: var(--font-xxxl); }
.price small { font-size: var(--font-sm); font-weight: normal; color: var(--text-light); }

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    z-index: var(--z-toast);
    animation: toastIn 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ========== 模态框 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: var(--z-modal-backdrop);
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 90%;
    max-width: 340px;
    z-index: var(--z-modal);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header { text-align: center; margin-bottom: var(--space-lg); }
.modal-title { font-size: var(--font-lg); font-weight: 600; color: var(--text-primary); }
.modal-body { margin-bottom: var(--space-xl); color: var(--text-secondary); text-align: center; line-height: 1.7; }
.modal-footer { display: flex; gap: var(--space-md); }
.modal-footer .btn { flex: 1; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== 锁定模块 ========== */
.lock-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lock-overlay .lock-icon { font-size: 36px; margin-bottom: var(--space-sm); }
.lock-overlay p { color: var(--text-light); font-size: var(--font-sm); }

/* ========== 安全区适配 ========== */
.safe-area-bottom {
    padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
}

/* ========== 滚动容器 ========== */
.scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========== 渐变背景 ========== */
.gradient-primary { background: var(--primary-gradient); }
.gradient-bg { background: linear-gradient(180deg, var(--bg-white) 0%, var(--bg-primary) 100%); }
