/**
 * 移动端通用样式
 * 用于所有移动版页面的基础样式
 */

/* ============================================
   CSS变量定义
   ============================================ */
:root {
    --primary: #00a6fb;
    --primary-dark: #0086d9;
    --primary-light: #e6f7ff;
    --success: #52c41a;
    --warning: #faad14;
    --error: #ff4d4f;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gray: #f3f4f6;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* ============================================
   顶部导航栏
   ============================================ */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding-top: var(--safe-top);
}

.header-content {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
}

.logo {
    height: 32px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.menu-btn,
.search-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: 18px;
}

/* ============================================
   主内容区域
   ============================================ */
.mobile-main {
    padding-top: calc(56px + var(--safe-top));
    padding-bottom: calc(60px + var(--safe-bottom));
    min-height: 100vh;
}

.mobile-main.no-tabbar {
    padding-bottom: var(--safe-bottom);
}

/* ============================================
   底部导航栏
   ============================================ */
.mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-bottom));
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

.tabbar-content {
    height: 56px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.tab-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: relative;
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.tab-label {
    font-size: 11px;
    font-weight: 500;
}

/* 活动指示器 */
.tab-item.active::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* ============================================
   通用组件样式
   ============================================ */

/* 按钮 */
.btn {
    min-height: 48px;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    font-size: 16px;
    font-weight: 600;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

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

.btn-block {
    width: 100%;
}

.btn-small {
    min-height: 36px;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-large {
    min-height: 56px;
    padding: 16px 32px;
    font-size: 18px;
}

/* 卡片 */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.card-shadow {
    box-shadow: var(--shadow-md);
    border: none;
}

/* 列表 */
.list {
    background: var(--bg-primary);
}

.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

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

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

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

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

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

.list-item-arrow {
    color: var(--text-light);
    font-size: 18px;
}

/* 网格布局 */
.grid {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    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);
}

/* 分割线 */
.divider {
    height: 8px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* ============================================
   表单元素
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 251, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   工具类
   ============================================ */
.container {
    padding: 0 16px;
}

.section {
    padding: 24px 0;
}

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

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

.text-secondary {
    color: var(--text-secondary);
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

/* ============================================
   动画
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

/* ============================================
   响应式微调
   ============================================ */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .btn {
        min-height: 44px;
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    /* 平板适配 */
    .container {
        max-width: 720px;
        margin: 0 auto;
    }
    
    .grid-tablet-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-tablet-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}