/* ============================================
   小画饼铺 - 粉丝端自定义样式
   主题：暖橙色调 · 毛玻璃 · 圆润卡片
   优化：国内加速 · 移动端性能提升
============================================ */

/* 全局变量 */
:root {
    --primary: #F4A261;           /* 柔和杏仁橙 */
    --primary-dark: #E07A5F;      /* 沉稳珊瑚橙（悬停/激活） */
    --primary-light: #FFD8A8;     /* 浅杏色 */
    --secondary: #FFE8A0;         /* 淡黄辅助 */
    --accent: #F4A261;            /* 浅橙（与主色统一） */
    --danger: #C0553F;            /* 陶土红，白色背景上更清晰 */
    --dark: #1E293B;              /* 深蓝灰，保证文字对比度 */
    --gray: #64748B;              /* 中灰色 */
    --light-bg: #FAFAF9;          /* 极浅灰白背景 */
    --white-glass: rgba(255, 255, 255, 0.92);  /* 柔和纯白卡片 */
    --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.08);
    --radius-card: 20px;
    --radius-element: 16px;
}

body {
    background-color: #FAFAFA;
    /* ✅ 优化：移除 Poppins (Google Fonts)，使用国内可秒开的系统字体栈 */
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, -apple-system, sans-serif;
    transition: background 0.5s ease; /* ✅ 优化：延长过渡时间，配合背景图加载时的平滑显现 */
}

/* 毛玻璃导航栏 */
.navbar {
    background: rgba(255, 255, 255, 0.60) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0,0,0,0.03);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary) !important;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s;
}
.nav-link:hover {
    color: var(--primary) !important;
}

/* 卡片通用样式 */
.card {
    border: none;
    border-radius: var(--radius-card);
    background: var(--white-glass);
    /* ✅ 优化：移除 backdrop-filter: blur(2px) */
    /* 原因：卡片是滚动元素，blur会导致移动端滚动严重掉帧卡顿 */
    backdrop-filter: none; 
    box-shadow: var(--shadow-sm);
    /* ✅ 优化：移除 translateY，减少GPU层创建和重绘开销 */
    transition: box-shadow 0.2s ease;
}
    
.card:hover {
    /* ✅ 优化：不再整体上浮，只加深阴影，体验更流畅 */
    transform: none;
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* 画饼值概览卡片 */
.stats-card {
    background: white;
    border-radius: var(--radius-element);
    padding: 1.5rem;
    height: 100%;
    transition: all 0.2s;
}
.stats-card .points-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.stats-card .stats-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 140, 66, 0.1);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 欢迎卡片（毛玻璃） */
.welcome-card {
    background: linear-gradient(135deg, rgba(255,255,245,0.9), rgba(255,230,200,0.7));
    /* ✅ 优化：移除 blur，提高不透明度补偿视觉效果 */
    backdrop-filter: none;
    border-radius: var(--radius-card);
    border: none;
    padding: 1.2rem 1.5rem;
}

/* 最近记录列表 */
.recent-list {
    max-height: 320px;
    overflow-y: auto;
    /* 开启 iOS 弹性滚动，并避免滚动时卡顿 */
    -webkit-overflow-scrolling: touch;
}
.recent-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
}
.recent-item:hover {
    background: rgba(255, 140, 66, 0.05);
}
.recent-item .recent-name {
    font-weight: 600;
    color: var(--dark);
}
.recent-item .recent-time {
    font-size: 0.7rem;
    color: var(--gray);
}
.recent-item .earn-value {
    color: #10B981;
    font-weight: 700;
}
.recent-item .spend-value {
    color: var(--danger);
    font-weight: 700;
}

/* 右侧任务栏 - 紧凑且现代 */
.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.task-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}
.task-item:hover {
    background-color: rgba(255, 140, 66, 0.03);
}
.task-item details {
    padding: 8px 10px;   /* 原为 10px 12px，略微紧凑 */
}
.task-item details summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}
.task-item details summary::-webkit-details-marker {
    display: none;
}
.task-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;   /* 允许子元素（.task-name）被压缩并显示省略号 */
}
.task-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}
/* 每日任务默认状态：任务名称可能被截断（省略号） */
.task-name {
    font-size: 0.8rem;          /* 原为 0.85rem */
    font-weight: 500;
    color: var(--dark);
    white-space: nowrap;        /* 强制不换行 */
    overflow: hidden;           /* 超出隐藏 */
    text-overflow: ellipsis;    /* 显示省略号 */
}
/* 每日任务展开状态：任务名称完整显示 */
.task-item details[open] .task-name {
    white-space: normal;      /* 允许换行，完整显示 */
    overflow: visible;        /* 取消隐藏 */
    text-overflow: clip;      /* 取消省略号 */
    word-break: break-word;   /* 长单词/连续字符强制换行 */
}
.badge-completed, .badge-pending {
    font-size: 0.6rem;          /* 原为 0.65rem */
    padding: 2px 6px;           /* 原为 3px 8px */
    border-radius: 30px;
    white-space: nowrap;
}
.badge-completed {
    background: linear-gradient(135deg, #10B981, #34D399);
    color: white;
}
.badge-pending {
    background: #e9ecef;
    color: #6c757d;
}
.task-desc {
    margin-top: 8px;
    padding-left: 30px;
    font-size: 0.7rem;
    color: var(--gray);
    border-left: 2px solid var(--primary-light);
}

/* 按钮风格 */
.btn-primary {
    background: linear-gradient(95deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 40px;
    padding: 8px 24px;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 140, 66, 0.3);
}
.btn-outline-primary {
    border-radius: 40px;
    border-color: var(--primary);
    color: var(--primary);
}
.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* 模态框风格 */
.modal-content {
    border-radius: 28px;
    border: none;
    overflow: hidden;
}
.modal-header {
    border: none;
}
.modal-footer {
    border: none;
}

/* 动画 */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 滚动条美化 */
.recent-list::-webkit-scrollbar {
    width: 4px;
}
.recent-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.recent-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

/* ✅ 新增：移动端性能专项优化 */
@media (max-width: 768px) {
    .stats-card .points-value {
        font-size: 1.8rem;
    }
    .card-body {
        padding: 1rem;
    }
    .welcome-card {
        padding: 1rem;
    }
    /* 移动端直接关闭导航栏模糊，大幅提升滑动流畅度 */
    .navbar {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.95) !important; /* 提高不透明度补偿视觉效果 */
    }
}

/* 每日任务折叠箭头（FontAwesome 风格） */
.task-item details summary::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free', 'FontAwesome', 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.6rem;
    color: #adb5bd;
    transition: transform 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}
.task-item details[open] summary::after {
    transform: rotate(90deg);
}
