/* ==================== Rewards ==================== */

/* ==================== Rewards hero ==================== */

.points-hero {
    text-align: center;
}

.points-hero-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.points-hero-label {
    font-size: var(--text-sm);
    letter-spacing: 0.02em;
    opacity: 0.92;
}

.points-hero-badge {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 3px var(--space-sm);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(2px);
    white-space: nowrap;
}

.points-hero-value {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.points-hero-chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.points-chip {
    font-size: var(--text-xs);
    padding: 4px var(--space-md);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.14);
    opacity: 0.95;
}

/* ==================== Rewards grid ==================== */

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.reward-card {
    position: relative;
    min-width: 0;
    background: var(--surface-muted);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    border: 2px solid transparent;
}

.reward-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-100);
}

.reward-card .icon {
    font-size: 2.4em;
    margin-bottom: var(--space-sm);
    line-height: 1;
}

.reward-card .name {
    font-size: var(--text-base);
    margin-bottom: var(--space-md);
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.reward-card .cost {
    display: inline-block;
    color: var(--primary);
    background: var(--primary-100);
    font-weight: 700;
    font-size: var(--text-sm);
    padding: 3px var(--space-md);
    border-radius: var(--radius-full);
}

.reward-card .reward-lock {
    display: none;
    margin-top: var(--space-sm);
    font-size: var(--text-xs);
    color: var(--text-light);
}

/* 积分不足：置灰、锁定，但仍可点击（后端会拦截并提示） */
.reward-card.locked {
    opacity: 0.6;
}

.reward-card.locked .cost {
    color: var(--text-light);
    background: var(--surface-muted);
}

.reward-card.locked .reward-lock {
    display: block;
}

.reward-card.affordable {
    border-color: var(--primary-100);
}

/* 兑换商品管理 */
.reward-form {
    background: var(--surface-muted);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.reward-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

.reward-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: var(--text-sm);
}

.reward-form input#rewardName {
    flex: 1 1 140px;
    min-width: 140px;
}

.reward-form input#rewardIcon {
    width: 90px;
    text-align: center;
}

.reward-form input#rewardPoints {
    width: 110px;
}

.reward-form .btn-primary {
    padding: 10px 16px;
    font-size: var(--text-sm);
}

.form-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: var(--space-sm);
    min-height: 1.2em;
}

.reward-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.reward-card:hover .reward-actions {
    opacity: 1;
}

.reward-actions .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 14px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
}

.reward-actions .btn-icon:hover {
    background: var(--surface-hover);
}

.reward-actions .btn-danger {
    color: var(--danger);
}

/* ==================== Custom cash exchange ==================== */

.custom-reward {
    background: var(--surface-muted);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.custom-reward-title {
    font-weight: 700;
    font-size: var(--text-base);
    margin-bottom: var(--space-xs);
}

.custom-reward-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.input-coins {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
}

.input-coins input {
    width: 90px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: var(--text-base);
    background: var(--surface);
}

.custom-reward-cost {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

.custom-reward-cost span {
    color: var(--primary);
    font-weight: 700;
}

.custom-reward-cost small {
    display: block;
    color: var(--text-light);
    margin-top: 3px;
}

.custom-reward-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

@media (min-width: 768px) {
    .custom-reward {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-md);
        text-align: left;
    }

    .custom-reward-title {
        flex: 1 1 auto;
        margin-bottom: 0;
    }

    .custom-reward-body {
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .input-coins,
    .custom-reward-cost {
        margin: 0;
    }

    .custom-reward-cost {
        text-align: right;
    }

    .custom-reward-btn {
        width: auto;
        min-width: 120px;
    }
}

/* ==================== Redeem history ==================== */

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-item {
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
}

.history-item .history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-item .history-name {
    font-weight: 600;
    font-size: var(--text-sm);
    line-height: 1.3;
    word-break: break-word;
}

.history-item .history-date {
    font-size: var(--text-xs);
    color: var(--text-light);
}

.history-item .points {
    color: var(--danger);
    font-weight: 700;
    white-space: nowrap;
}

.points-hint {
    background: var(--warning-light);
    border-left: 4px solid var(--warning);
    padding: var(--space-md);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==================== Badges ==================== */

.badge-item.unlocked {
    opacity: 1;
    background: linear-gradient(135deg, #fff9c4, #fff176);
    box-shadow: var(--shadow-sm);
}

.badge-item .icon {
    font-size: 2em;
    margin-bottom: var(--space-xs);
}

.badge-item .name {
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.3;
}

.badge-item .desc {
    font-size: var(--text-xs);
    color: var(--text-light);
    margin-top: var(--space-xs);
    line-height: 1.3;
}

/* ==================== 响应式兑换商城 ==================== */

/* 奖励网格：按断点逐级放宽 */
.rewards-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

@media (min-width: 480px) {
    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (min-width: 768px) {
    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

/* 手机端：兑换表单堆叠、历史记录项换行 */
@media (max-width: 480px) {
    .reward-form .form-row {
        flex-direction: column;
    }
    .reward-form input#rewardName,
    .reward-form input#rewardIcon,
    .reward-form input#rewardPoints {
        width: 100%;
        flex: none;
    }
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .history-item .points {
        align-self: flex-end;
    }
}

