/* =========================================
   1. 全局变量与重置 (Global Variables & Reset)
   ========================================= */
:root {
    /* 美食主题色 */
    --primary-color: #ff4b2b; /* 诱人的火锅红 */
    --secondary-color: #ff416c; /* 渐变粉红 */
    --accent-color: #ff9068; /* 温暖橙 */
    --gold-color: #ffd700; /* 冠军金 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.voting-container {
    max-width: 750px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================
   2. 头部区域 (Header)
   ========================================= */
.voting-header {
    /* 多重背景：渐变遮罩 + 美食底图 */
    background: linear-gradient(135deg, rgba(255, 75, 43, 0.85), rgba(255, 65, 108, 0.8)), 
                url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?q=80&w=1000&auto=format&fit=crop') center/cover no-repeat;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-attachment: fixed;
    min-height: 220px; /* 稍微减小高度 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 20px 20px; /* 顶部留出空间 */
    border-radius: 0 0 30px 30px; /* 底部大圆角 */
}

.voting-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.voting-header > * {
    position: relative;
    z-index: 1;
}

.voting-header h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.voting-header-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 4px;
    font-weight: 600;
}

.voting-header-guide {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
}

/* 统计数据条 */
.voting-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 15px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.15); /* 半透明底框 */
    border-radius: 12px;
    padding: 12px 0;
    backdrop-filter: blur(5px);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* =========================================
   3. 内容区域与故事卡片 (Content & Story)
   ========================================= */
.voting-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 故事区：2x2 田字格布局 */
.story-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #f9f9f9;
    padding: 12px 8px;
    border-radius: 8px;
}

.story-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.story-text p {
    margin: 0;
    font-size: 11px;
    color: #666;
    line-height: 1.4;
}

.story-highlight {
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-color) !important;
    margin-top: 4px !important;
    display: block;
}

/* =========================================
   4. 排行榜列表 (Ranking List)
   ========================================= */
.ranking-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    padding-left: 5px;
    border-left: 4px solid var(--primary-color);
    line-height: 1;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* 底部留白，防止被悬浮按钮挡住 */
    padding-bottom: 80px; 
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    /* 进场动画 */
    animation: slideInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* 瀑布流延迟动画 */
.ranking-item:nth-child(1) { animation-delay: 0.1s; }
.ranking-item:nth-child(2) { animation-delay: 0.2s; }
.ranking-item:nth-child(3) { animation-delay: 0.3s; }
.ranking-item:nth-child(n+4) { animation-delay: 0.4s; }

/* 排名数字 */
.ranking-rank {
    font-size: 20px;
    font-weight: bold;
    width: 35px;
    text-align: center;
    color: var(--secondary-color);
    margin-right: 10px;
    flex-shrink: 0;
}

/* 前三名专属特效 */
.ranking-rank.rank-1 { font-size: 28px; color: #ff6b6b; }
.ranking-rank.rank-1::before {
    content: '👑';
    position: absolute;
    top: -15px;
    left: 15px;
    font-size: 16px;
}
.ranking-rank.rank-2 { color: #ffa500; }
.ranking-rank.rank-3 { color: #ffd700; }

/* 前三名背景高亮 */
.ranking-item:nth-child(1) { background: linear-gradient(to right, #fffdf5, #fff); border: 1px solid #ffe58f; }
.ranking-item:nth-child(2) { background: linear-gradient(to right, #fbfbfb, #fff); border: 1px solid #e0e0e0; }
.ranking-item:nth-child(3) { background: linear-gradient(to right, #fffbf8, #fff); border: 1px solid #ffece0; }

/* 店铺图片 */
.shop-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    background-color: #eee;
    border: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.ranking-info {
    flex: 1;
    margin-right: 5px;
    overflow: hidden; /* 防止文字溢出 */
}

.ranking-name {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-category {
    font-size: 12px;
    color: #999;
}

.ranking-votes {
    text-align: right;
    min-width: 60px;
    margin-right: 10px;
}

.votes-number {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 2px;
}

/* 加油包按钮修复版 */
.vote-btn {
    white-space: nowrap;
    min-width: 65px;
    width: auto;
    padding: 6px 12px;
    border-radius: 20px;
    background: linear-gradient(to right, #ff9966, #ff5e62);
    box-shadow: 0 2px 6px rgba(255, 94, 98, 0.3);
    color: white;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.vote-btn:active {
    transform: scale(0.95);
}

/* =========================================
   5. 底部悬浮栏与Footer (Bottom Bar)
   ========================================= */
/* 底部固定悬浮栏 */
.fixed-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fixed-bottom-bar .btn {
    width: 100%;
    max-width: 600px;
    font-size: 16px;
    padding: 12px;
    letter-spacing: 1px;
    animation: pulse 2s infinite;
}

/* 页脚 */
.voting-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    /* 核心：加高底部，防止被悬浮栏遮挡 */
    padding-bottom: 120px; 
}

.voting-footer p {
    font-size: 12px;
    color: #999;
    margin: 0;
    line-height: 1.6;
}

/* =========================================
   6. 弹窗与通用组件 (Modal & Components)
   ========================================= */
.btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.4);
    border-radius: 50px;
}

/* 弹窗样式 */
.package-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.package-content {
    background-color: white;
    margin: auto;
    padding: 25px;
    border-radius: 16px;
    width: 85%;
    max-width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.package-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.package-item {
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
    margin-bottom: 10px;
}

.package-item.selected {
    border-color: var(--primary-color);
    background: #fff5f5;
    box-shadow: 0 4px 12px rgba(255, 75, 43, 0.15);
}

.package-price {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: bold;
}

.package-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.package-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.package-btn-confirm {
    background: var(--primary-color);
    color: white;
}

.package-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

/* 加载动画 */
.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* 移动端适配 */
@media (max-width: 600px) {
    .voting-header h1 { font-size: 20px; }
    .stat-number { font-size: 20px; }
    .ranking-item { padding: 10px; }
}