/* 公共样式文件 */

/* CSS变量定义 */
:root {
    --primary-gradient: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    --secondary-gradient: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    --accent-gradient: linear-gradient(135deg, #ff6b6b 0%, #ffa502 100%);
    --card-gradient: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffd166;
    --background-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e9ecef;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
}

/* 全局重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础字体和布局 */
body {
    font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: none !important;
    background-image: none !important;
    background-color: transparent !important;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 容器样式 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-gradient);
    color: white;
}

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

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

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

/* 头像样式 */
.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    background-color: #ffd6e0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    font-size: 24px;
    color: var(--primary-color);
}

/* 用户信息卡片 */
.user-info {
    background: var(--primary-gradient);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.user-details {
    flex: 1;
    margin-left: 15px;
}

.user-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.user-balance {
    font-size: 14px;
    opacity: 0.9;
}

/* 底部导航栏 */
.tabbar {
    display: flex;
    justify-content: center;
    height: calc(60px + var(--safe-area-inset-bottom));
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: var(--safe-area-inset-bottom);
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 60px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

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

.tabbar-icon {
    font-size: 22px;
    margin-bottom: 3px;
}

.tabbar-text {
    font-size: 12px;
    font-weight: 500;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 消息提示 */
.message {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
}

.message-success {
    background: rgba(6, 214, 160, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(6, 214, 160, 0.2);
}

.message-error {
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 71, 111, 0.2);
}

.message-warning {
    background: rgba(255, 209, 102, 0.1);
    color: #e67e22;
    border: 1px solid rgba(255, 209, 102, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    .modal-content {
        width: 92% !important;
        max-width: 560px !important;
        border-radius: var(--border-radius-lg) !important;
        box-shadow: var(--shadow-lg) !important;
    }
}

/* 通用模态框样式（供各页面复用） */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    border-radius: var(--border-radius-md);
    width: 90%;
    max-width: 640px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
}

/* 列表与卡片增强 */
.list {
    list-style: none;
}
.list-item {
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    margin-bottom: 12px;
}

.chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.05);
    font-size: 12px;
    color: var(--text-secondary);
}

/* 工具类 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.hidden { display: none; }
.visible { display: block; }

.flex { display: flex; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }