/* ========== 统一购买弹窗 ========== */
.up-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}
.up-modal.show { display: flex; }

.up-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.up-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 94%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: upSlideIn 0.3s ease;
}

@keyframes upSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Header ---- */
.up-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 2;
}
.up-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.up-close {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.up-close:hover { background: #e5e7eb; color: #374151; }

/* ---- Tab 栏 ---- */
.up-tabs {
    display: flex;
    gap: 0;
    padding: 0 1rem;
    background: #fff;
    position: sticky;
    top: 43px;
    z-index: 2;
    border-bottom: 2px solid #e5e7eb;
}
.up-tab {
    flex: 1;
    padding: 0.65rem 0.2rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}
.up-tab-note {
    font-size: 0.78em;
    opacity: 0.92;
    margin-left: 2px;
}
.up-tab:first-child { border-radius: 0; }
.up-tab:last-child  { border-radius: 0; }
.up-tab.active {
    background: transparent;
    color: #2563eb;
    font-weight: 700;
    border-bottom-color: #2563eb;
}
.up-tab:not(.active):hover {
    background: transparent;
    color: #374151;
    border-bottom-color: #d1d5db;
}

/* ---- Body ---- */
.up-body { padding: 0.85rem 1rem; }

/* Tab panels */
.up-panel { display: none; min-height: 400px; }
.up-panel.active { display: block; }

/* ---- 权益介绍框 ---- */
.up-benefit {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    line-height: 1.5;
}
.up-benefit i {
    font-size: 1rem;
    margin-top: 2px;
    flex-shrink: 0;
}
.up-benefit-member {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fde68a;
    color: #92400e;
}
.up-benefit-member i { color: #f59e0b; }

.up-benefit-credits {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #ddd6fe;
    color: #5b21b6;
}
.up-benefit-credits i { color: #8b5cf6; }

.up-benefit-download {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    color: #065f46;
}
.up-benefit-download i { color: #10b981; }

.up-benefit-bundle {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 1px solid #fed7aa;
    color: #9a3412;
}
.up-benefit-bundle i { color: #f97316; }

/* ---- 区块标题 ---- */
.up-section-title {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

/* ---- 学科卡片 ---- */
.up-subjects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.up-subject-label { cursor: pointer; }
.up-subject-label input { display: none; }
.up-subject-card {
    position: relative;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.6rem 0.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.up-subject-card:hover { border-color: #9ca3af; }
.up-subject-label input:checked + .up-subject-card {
    border-color: #3b82f6;
    background: #eff6ff;
}
.up-subject-label input:checked + .up-subject-card::after {
    content: '✓';
    position: absolute;
    top: 6px; right: 8px;
    width: 20px; height: 20px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}
.up-subject-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.3rem;
    font-size: 0.9rem;
    color: #fff;
}
.up-icon-math { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.up-icon-physics { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.up-subject-name {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}
.up-subject-desc {
    font-size: 0.7rem;
    color: #9ca3af;
    line-height: 1.4;
}

/* 开发中（不可选） */
.up-coming-soon {
    cursor: default;
}
.up-coming-soon .up-subject-card {
    border: 2px dashed #d1d5db;
    background: #f9fafb;
    opacity: 0.6;
    cursor: default;
}
.up-coming-soon .up-subject-card:hover {
    border-color: #d1d5db;
}
.up-coming-soon .up-subject-name {
    color: #9ca3af;
}
.up-coming-soon .up-subject-desc {
    color: #d1d5db;
}

/* ---- 套餐卡片 (时长 / 积分) ---- */
.up-plans {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.up-plan-label { cursor: pointer; }
.up-plan-label input { display: none; }
.up-plan-card {
    position: relative;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.up-plan-card:hover { border-color: #9ca3af; }
.up-plan-label input:checked + .up-plan-card {
    border-color: #3b82f6;
    background: #eff6ff;
}
.up-plan-badge {
    position: absolute;
    top: -8px; right: -8px;
    background: #3b82f6;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.up-plan-badge.hot { background: #1f2937; }
.up-plan-badge.newbie { background: #ef4444; }
.up-plan-badge.gold { background: linear-gradient(135deg, #f59e0b, #d97706); }

.up-plan-name {
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 0.15rem;
}
.up-plan-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ea580c;
}
.up-plan-price .per { font-size: 0.75rem; font-weight: 400; }
.up-plan-unit {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* 积分套餐 - 4列（去掉了5元40积分） */
.up-credits-plans {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.up-credits-plans .up-plan-card { padding: 0.85rem 0.3rem; }
.up-credits-plans .up-plan-name { font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.up-credits-plans .up-plan-price { font-size: 1.4rem; }

/* 新人礼包 - 只突出积分数字 */
#up-newbie-option .up-plan-name {
    font-size: 1.15rem;
    color: #dc2626;
    font-weight: 800;
}

/* Newbie card disabled overlay */
.up-plan-label.disabled { pointer-events: none; opacity: 0.5; }
.up-purchased-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    color: #16a34a;
    font-weight: 600;
}
.up-purchased-overlay i { font-size: 1.2rem; }

/* ---- 数量选择器 (下载) ---- */
.up-qty-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.up-qty-label {
    font-size: 0.9rem;
    color: #4b5563;
}
.up-qty-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.up-qty-btn {
    width: 36px; height: 36px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.up-qty-btn:hover { background: #e5e7eb; }
.up-qty-input {
    width: 48px; height: 36px;
    border: none;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    outline: none;
}
.up-qty-unit {
    font-size: 0.85rem;
    color: #6b7280;
}
.up-price-info {
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* ---- 课件包介绍 ---- */
.up-bundle-features {
    margin-bottom: 1rem;
}
.up-bundle-feature {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
    color: #374151;
}
.up-bundle-feature i {
    color: #3b82f6;
    width: 16px;
    text-align: center;
}
.up-bundle-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.up-bundle-preview a {
    color: #0369a1;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}
.up-bundle-preview a:hover { text-decoration: underline; }

/* ---- 价格汇总 ---- */
.up-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.up-summary-label {
    color: #4b5563;
    font-size: 0.95rem;
}
.up-summary-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ea580c;
}

/* ---- 支付提示 ---- */
.up-tip {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #0369a1;
}
.up-tip i { font-size: 1.1rem; }

/* ---- Footer ---- */
.up-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
    position: sticky;
    bottom: 0;
    z-index: 2;
}
.up-btn-cancel {
    flex: 1;
    padding: 0.75rem;
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.up-btn-cancel:hover { background: #d1d5db; }

.up-btn-pay {
    flex: 2;
    padding: 0.75rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.up-btn-pay:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.up-btn-pay:disabled { opacity: 0.7; cursor: not-allowed; }

/* ---- 响应式 ---- */
@media (max-width: 560px) {
    .up-content { max-width: 100%; width: 96%; }
    .up-tabs { padding: 0.5rem 0.75rem 0; }
    .up-tab { font-size: 0.75rem; padding: 0.5rem 0.15rem; }
    .up-tab-note { font-size: 0.7em; margin-left: 1px; }
    .up-body { padding: 1rem 0.75rem; }
    .up-plans { grid-template-columns: 1fr; }
    .up-plan-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
    }
    .up-plan-name { margin: 0; }
    .up-plan-price { font-size: 1.25rem; }
    .up-credits-plans {
        grid-template-columns: repeat(2, 1fr);
    }
    .up-subjects { grid-template-columns: 1fr; }
    .up-footer { padding: 0.75rem; }
}
