/* ========================================
   清泉送水 - 公共样式
   ======================================== */

/* CSS变量 */
:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --primary-light: #e6f7ff;
    --secondary: #52c41a;
    --warning: #faad14;
    --error: #ff4d4f;
    --success: #52c41a;
    
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-tertiary: #8c8c8c;
    --text-muted: #bfbfbf;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #fafafa;
    
    --border-color: #e8e8e8;
    --border-light: #f0f0f0;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 基础重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* 页面容器 */
.page-container {
    min-height: 100vh;
    padding-bottom: calc(80px + var(--safe-bottom));
}

/* 头部导航 */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.header-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

/* 搜索栏 */
.search-bar {
    padding: 0 16px 12px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.95);
    border-radius: var(--radius-xl);
    padding: 10px 16px;
    gap: 8px;
}

.search-icon {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + var(--safe-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    z-index: 100;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    font-size: 1.4rem;
    position: relative;
}

.tab-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--error);
    color: white;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.tab-label {
    font-size: 0.7rem;
}

/* 卡片样式 */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-more {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-body {
    padding: 16px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #389e0d 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d48806 100%);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

/* 标签样式 */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.tag-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.tag-success {
    background: #f6ffed;
    color: var(--success);
}

.tag-warning {
    background: #fffbe6;
    color: var(--warning);
}

.tag-error {
    background: #fff2f0;
    color: var(--error);
}

/* 价格样式 */
.price {
    color: var(--error);
    font-weight: bold;
}

.price-unit {
    font-size: 0.75em;
}

.original-price {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 0.85em;
}

/* 列表样式 */
.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

.list-item:last-child {
    border-bottom: none;
}

.list-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-right: 12px;
}

.list-content {
    flex: 1;
}

.list-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.list-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.list-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* 加载状态 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 分割线 */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 12px 0;
}

/* 间距工具类 */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mx-12 { margin-left: 12px; margin-right: 12px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }

/*  flex 工具类 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* 文字工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: bold; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }

/* 隐藏滚动条 */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* 响应式 */
@media (max-width: 375px) {
    html { font-size: 14px; }
}

@media (min-width: 414px) {
    html { font-size: 17px; }
}
