/* ============================================================
   抽奖模块 - 扁平化设计
   ============================================================ */

/* ===== 抽奖列表页 ===== */
#pageLottery {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: 90;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lottery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lottery-header .back-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg);
    cursor: pointer;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
}

.lottery-header .back-btn:active {
    background: var(--color-border);
    transform: scale(0.92);
}

.lottery-header .back-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.lottery-header .lottery-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    flex: 1;
    text-align: center;
    letter-spacing: 0.3px;
}

.lottery-header .header-placeholder {
    width: 36px;
}

/* ===== 抽奖卡片（扁平化） ===== */
/* ===== 抽奖卡片（横图 + 上下结构） ===== */
.lottery-card {
    position: relative;
    display: flex;
    flex-direction: column;        /* ✅ 上下结构 */
    background: var(--color-bg-card);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 14px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.02);
    -webkit-tap-highlight-color: transparent;
}

.lottery-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ✅ 顶部横图（16:9） */
.lottery-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;            /* ✅ 横图 */
    overflow: hidden;
    background: var(--color-bg);
}

.lottery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.lottery-card:active .lottery-card-image img {
    transform: scale(1.05);
}

/* ✅ 底部渐变（让 badge 更清晰） */
.lottery-card-image::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent);
    pointer-events: none;
    z-index: 1;
}

/* ✅ 右上角状态标签 */
.lottery-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary);
    letter-spacing: 0.3px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lottery-card-badge.ended {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.lottery-card-badge.draw {
    background: #8B5CF6;
}

/* ✅ 右侧/下方信息 */
.lottery-card-info {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lottery-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    letter-spacing: 0.2px;
}

/* ✅ 奖品标签行 */
.lottery-card-prizes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.prize-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--color-primary-light, #FFF0E6);
    color: var(--color-primary);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
}

.prize-tag svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.prize-tag span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ✅ 底部 meta */
.lottery-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: 500;
}

.lottery-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lottery-card-meta-item svg {
    width: 13px;
    height: 13px;
    stroke: var(--color-text-light);
    flex-shrink: 0;
}
/* ============================================================
   抽奖详情页
   ============================================================ */
#pageLotteryDetail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: 90;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.lottery-detail-content {
    padding: 12px 16px 120px;
}

/* ===== 封面图 ===== */
.lottery-detail-cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.lottery-detail-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ✅ 封面底部渐变 */
.lottery-detail-cover-wrap::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    pointer-events: none;
}

/* ✅ 标题叠在封面上 */
.lottery-detail-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 18px;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
    letter-spacing: 0.3px;
}

/* ===== 倒计时（扁平卡片） ===== */
.countdown-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-bg-card);
    border-radius: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

/* ✅ 左侧品牌色竖条 */
.countdown-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-secondary, #FFA94D) 100%);
}

.countdown-card.ended::before {
    background: var(--color-text-light);
}

.countdown-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--color-primary-light, #FFF0E6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.countdown-card.ended .countdown-icon-wrap {
    background: var(--color-bg);
}

.countdown-icon-wrap svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-primary);
    fill: none;
}

.countdown-card.ended .countdown-icon-wrap svg {
    stroke: var(--color-text-light);
}

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

.countdown-label {
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: 500;
    margin-bottom: 2px;
    display: block;
    letter-spacing: 0.3px;
}

.countdown-time {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.countdown-card.ended .countdown-time {
    color: var(--color-text-light);
    font-size: 15px;
    font-weight: 600;
}

/* ✅ 倒计时脉冲点 */
.countdown-pulse {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.countdown-pulse span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.4;
    animation: countdownPulse 1.4s ease-in-out infinite;
}

.countdown-pulse span:nth-child(2) {
    animation-delay: 0.2s;
}

.countdown-pulse span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes countdownPulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.countdown-card.ended .countdown-pulse {
    display: none;
}

/* ===== 信息网格 ===== */
.lottery-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.info-card {
    background: var(--color-bg-card);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-primary-light, #FFF0E6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-card-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-primary);
    fill: none;
}

.info-card-body {
    flex: 1;
    min-width: 0;
}

.info-card-label {
    font-size: 11px;
    color: var(--color-text-light);
    font-weight: 500;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.info-card-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 规则卡片 ===== */
.rules-card {
    background: var(--color-bg-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.rules-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.rules-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}

.rules-title svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-primary);
    fill: none;
}

.rules-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== 奖品列表 ===== */
.prize-section {
    margin: 20px 0 16px;
}

.prize-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.prize-section-title svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-primary);
    fill: none;
}

.prize-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-bg-card);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s;
}

.prize-item:active {
    transform: scale(0.98);
}

.prize-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark, #E55A2B) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.25);
}

.prize-icon svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    fill: none;
}

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

.prize-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prize-stock {
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: 500;
}

.prize-stock-bar {
    margin-top: 6px;
    height: 3px;
    background: var(--color-bg);
    border-radius: 3px;
    overflow: hidden;
}

.prize-stock-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary, #FFA94D) 100%);
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ===== 底部按钮 ===== */
.lottery-participate-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px 20px;
    background: linear-gradient(to top, var(--color-bg-card) 70%, transparent);
    z-index: 100;
}

#participateBtn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark, #E55A2B) 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
    transition: transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#participateBtn svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    fill: none;
}

#participateBtn:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.5);
}

#participateBtn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

#participateBtn.pending {
    background: linear-gradient(135deg, #FFA94D 0%, #FF9F43 100%);
    box-shadow: 0 8px 24px rgba(255, 169, 77, 0.4);
}

#participateBtn.ended {
    background: var(--color-text-light);
    box-shadow: none;
    opacity: 0.6;
}

#participateBtn.already-participated {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    box-shadow: 0 8px 24px rgba(46, 204, 113, 0.35);
}

/* ===== 空状态 / 加载 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--color-text-light);
    fill: none;
    opacity: 0.4;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--color-text-light);
    gap: 12px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== 加载更多 ===== */
.load-more-trigger {
    text-align: center;
    padding: 16px 0 24px;
    color: var(--color-text-light);
    font-size: 14px;
}

.load-more-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0 28px;
}

.load-more-line {
    flex: 1;
    max-width: 60px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--color-border), transparent);
}

.load-more-end .load-more-text {
    color: var(--color-text-light);
    font-size: 12px;
    white-space: nowrap;
}

/* ===== 暗黑主题 ===== */
[data-theme="dark"] .lottery-card {
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .countdown-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .rules-card,
[data-theme="dark"] .prize-item {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}