/* ==========================================
   积分打卡网站 - 卡通可爱风格CSS v3.0
   修复所有布局问题
   ========================================== */

:root {
    --primary: #FF6B9D;
    --primary-light: #FFB6C8;
    --primary-dark: #E84A7F;
    --secondary: #FFD93D;
    --secondary-light: #FFE566;
    --accent: #6BCB77;
    --accent-light: #A8E6B4;
    --blue: #4D96FF;
    --blue-light: #A8D4FF;
    --purple: #9B59B6;
    --purple-light: #D4A8E0;
    --orange: #FF8C42;
    --orange-light: #FFB87A;
    --red: #FF6B6B;
    --pink: #FFB6C1;
    
    --bg-primary: #FFF5F8;
    --bg-secondary: #FFFBEB;
    --bg-white: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --text-light-2: #999999;
    --border: #F0F0F0;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(255, 107, 157, 0.3);
    
    --radius: 20px;
    --radius-sm: 12px;
    --radius-lg: 30px;
    --radius-full: 999px;
}

/* 全局重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #F0F8FF 100%);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.6;
    position: relative;
}

/* ==========================================
   布局容器
   ========================================== */

/* 主内容容器 - 所有页面的主容器 */
.container,
.main-content,
.page {
    width: 100%;
    max-width: 750px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
}

/* 确保所有直接子元素不超出容器 */
.container > *,
.main-content > *,
.page > * {
    max-width: 100%;
}

/* ==========================================
   动画效果
   ========================================== */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

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

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

/* ==========================================
   按钮样式
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    gap: 8px;
    box-sizing: border-box;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: #996600;
    box-shadow: 0 4px 15px rgba(255, 217, 61, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent), #4CAF50);
    color: white;
    box-shadow: 0 4px 15px rgba(107, 203, 119, 0.4);
}

.btn-blue {
    background: linear-gradient(135deg, var(--blue), #3A7BD5);
    color: white;
    box-shadow: 0 4px 15px rgba(77, 150, 255, 0.4);
}

.btn-sm {
    padding: 10px 18px;
    font-size: 14px;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   表单样式
   ========================================== */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.3s;
    background: var(--bg-white);
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.15);
}

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

/* ==========================================
   卡片样式
   ========================================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

/* ==========================================
   标签徽章
   ========================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    box-sizing: border-box;
}

.badge-pink {
    background: #FFE4EC;
    color: var(--primary);
}

.badge-yellow {
    background: #FFF4CC;
    color: #CC9900;
}

.badge-green {
    background: #D4F5E0;
    color: #2E8B57;
}

.badge-blue {
    background: #D6E8FF;
    color: var(--blue);
}

/* ==========================================
   任务类型选择器
   ========================================== */
.task-type {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.task-type-btn {
    flex: 1;
    min-width: 90px;
    padding: 15px 10px;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    box-sizing: border-box;
}

.task-type-btn.active {
    border-color: var(--primary);
    background: #FFF5F8;
}

.task-type-btn .icon {
    font-size: 28px;
    margin-bottom: 5px;
    display: block;
}

.task-type-btn .label {
    font-size: 13px;
    font-weight: 600;
}

/* ==========================================
   列表项
   ========================================== */
.list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--bg-white);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.3s;
    box-sizing: border-box;
}

.list-item:hover {
    transform: translateX(5px);
}

.list-item .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.list-item .title {
    font-weight: 600;
    margin-bottom: 4px;
}

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

/* ==========================================
   积分展示
   ========================================== */
.points-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-sizing: border-box;
}

.points-display .icon {
    font-size: 32px;
    margin-right: 10px;
}

.points-display .value {
    font-size: 36px;
    font-weight: 800;
    color: #996600;
}

.points-display .unit {
    font-size: 16px;
    color: #996600;
    margin-left: 5px;
}

/* ==========================================
   底部导航
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    box-sizing: border-box;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 15px;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s;
    box-sizing: border-box;
}

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

.nav-item .icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-item .label {
    font-size: 11px;
}

/* ==========================================
   模态框
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    box-sizing: border-box;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: var(--bg-white);
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-sizing: border-box;
}

.modal-close:hover {
    transform: rotate(90deg);
    background: var(--primary);
    color: white;
}

.modal-body {
    padding: 20px;
    box-sizing: border-box;
}

/* ==========================================
   空状态
   ========================================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}

.empty-state .icon {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

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

/* ==========================================
   加载状态
   ========================================== */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==========================================
   图片上传
   ========================================== */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    box-sizing: border-box;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #FFF5F8;
}

.upload-area .icon {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

.upload-area .text {
    color: var(--text-light);
    font-size: 14px;
}

.preview-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.preview-images img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    box-sizing: border-box;
}

/* ==========================================
   奖励卡片
   ========================================== */
.reward-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 15px;
    box-sizing: border-box;
}

.reward-card .image {
    width: 100%;
    height: 100px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-sizing: border-box;
}

.reward-card .content {
    padding: 15px;
}

.reward-card .title {
    font-weight: 600;
    margin-bottom: 5px;
}

.reward-card .points {
    color: var(--primary);
    font-weight: 700;
}

/* ==========================================
   Toast提示
   ========================================== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 2000;
    animation: fadeInUp 0.3s ease;
    box-sizing: border-box;
}

.toast.success {
    background: linear-gradient(135deg, var(--accent), #4CAF50);
}

.toast.error {
    background: linear-gradient(135deg, var(--red), #E74C3C);
}

/* ==========================================
   页面内容区
   ========================================== */
.page-content {
    padding: 15px;
    padding-bottom: 90px;
    box-sizing: border-box;
}

/* ==========================================
   表格
   ========================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.table th,
.table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
}

.table th {
    background: var(--bg-primary);
    font-weight: 600;
    font-size: 14px;
}

/* ==========================================
   统计卡片
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    box-sizing: border-box;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ==========================================
   隐藏类
   ========================================== */
.hidden {
    display: none !important;
}

/* ==========================================
   撒花效果
   ========================================== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    box-sizing: border-box;
}

.confetti {
    position: absolute;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ==========================================
   移动端适配
   ========================================== */
@media (max-width: 480px) {
    .container,
    .main-content,
    .page {
        padding: 0 12px;
    }
    
    .card {
        padding: 15px;
    }
    
    .task-type-btn {
        min-width: 80px;
        padding: 12px 8px;
    }
    
    .task-type-btn .icon {
        font-size: 24px;
    }
    
    .task-type-btn .label {
        font-size: 12px;
    }
    
    .points-display .value {
        font-size: 30px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .value {
        font-size: 24px;
    }
    
    .modal {
        padding: 15px;
    }
    
    .modal-content {
        max-height: 85vh;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .list-item {
        padding: 12px;
    }
    
    .list-item .avatar {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}
