/* 推薦系統樣式 */

/* ============================================================
   v2 推薦系統 - 商品頁分享卡片 + 折扣橫幅 + 註冊 Modal
   ============================================================ */

/* 推薦分享卡片（已登入用戶）— SPEC 3.1 設計 */
.referral-share-card {
    background: linear-gradient(135deg, #ff6b9d 0%, #c850c0 50%, #6c63ff 100%);
    border-radius: 12px;
    margin: 16px 0;
    color: white;
    box-shadow: 0 4px 15px rgba(200, 80, 192, 0.3);
    animation: referralCardFadeIn 0.5s ease;
    overflow: hidden;
}

@keyframes referralCardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.referral-share-card__header {
    padding: 12px 16px 0;
}

.referral-share-card__tag {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

.referral-share-card__body {
    padding: 8px 16px 12px;
    text-align: center;
}

.referral-share-card__main-btn {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 25px;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.referral-share-card__main-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.02);
}

.referral-share-card__main-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.referral-share-card__details p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.6;
    opacity: 0.95;
}

.referral-share-card__small {
    font-size: 0.75rem !important;
    opacity: 0.8 !important;
}

.referral-share-card__footer {
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.1);
    text-align: right;
    font-size: 0.75rem;
    opacity: 0.85;
}

/* 推薦折扣橫幅（新用戶看到） */
.referral-discount-banner {
    background: linear-gradient(135deg, #fff0f6 0%, #ffe0ec 100%);
    border: 2px solid #e40580;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 16px 0;
    animation: bannerSlideIn 0.4s ease;
}

/* 已領取狀態（綠色主題） */
.referral-discount-banner--claimed {
    background: linear-gradient(135deg, #f0fff6 0%, #e0ffec 100%);
    border-color: #28a745;
}

/* 已登入可用狀態（強調行動） */
.referral-discount-banner--ready {
    background: linear-gradient(135deg, #fff8f0 0%, #fff0f6 100%);
    border-color: #e40580;
}

@keyframes bannerSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* BEM 結構 */
.referral-discount-banner__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: center;
}

.referral-discount-banner__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.referral-discount-banner__badge {
    display: inline-block;
    background: #e40580;
    color: white;
    padding: 3px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.referral-discount-banner__badge--success {
    background: #28a745;
}

.referral-discount-banner__badge--ready {
    background: #e40580;
}

.referral-discount-banner__text {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.5;
}

.referral-discount-banner__text strong {
    color: #e40580;
    font-weight: 700;
}

.referral-discount-banner--claimed .referral-discount-banner__text strong {
    color: #28a745;
}

.referral-discount-banner__btn {
    background: #e40580;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 28px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(228, 5, 128, 0.3);
}

.referral-discount-banner__btn:hover {
    background: #c70470;
    transform: scale(1.05);
}

.referral-discount-banner__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 推薦分享卡片變體（與折扣卡一致的粉紅色主題） */
.referral-discount-banner--share {
    background: linear-gradient(135deg, #fff0f6 0%, #ffe0ec 100%);
    border-color: #e40580;
}

.referral-discount-banner__subtext {
    width: 100%;
}

.referral-discount-banner__subtext p {
    margin: 0;
    font-size: 0.82rem;
    color: #555;
    line-height: 1.6;
}

.referral-discount-banner__subtext p strong {
    color: #e40580;
    font-weight: 700;
}

.referral-discount-banner__small {
    font-size: 0.75rem !important;
    opacity: 0.8;
}

.referral-discount-banner__expire {
    width: 100%;
    text-align: right;
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

/* 舊版樣式（保留相容性） */

.referral-discount-banner .banner-content {
    flex: 1;
    margin-right: 12px;
}

.referral-discount-banner .banner-badge {
    display: inline-block;
    background: #e40580;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.referral-discount-banner .banner-text {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
}

.referral-discount-banner .banner-text .discount-amount {
    color: #e40580;
    font-weight: 800;
    font-size: 1.15rem;
}

.referral-discount-banner .btn-claim-discount {
    background: #e40580;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(228, 5, 128, 0.3);
}

.referral-discount-banner .btn-claim-discount:hover {
    background: #c70470;
    transform: scale(1.05);
}

/* 推薦註冊 Modal */
#modalReferralRegister .modal-header {
    background: linear-gradient(135deg, #ff6b9d 0%, #c850c0 100%);
    color: white;
    border-bottom: none;
}

#modalReferralRegister .modal-header .close {
    color: white;
    opacity: 0.8;
}

#modalReferralRegister .modal-body {
    padding: 24px;
}

.ref-reg-step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    gap: 8px;
}

.ref-reg-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
    transition: all 0.3s;
}

.ref-reg-step-dot.active {
    background: #e40580;
    transform: scale(1.3);
}

.ref-reg-step-dot.done {
    background: #28a745;
}

.ref-reg-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 2px;
    transition: border-color 0.2s;
}

.ref-reg-input:focus {
    outline: none;
    border-color: #e40580;
    box-shadow: 0 0 0 3px rgba(228, 5, 128, 0.15);
}

.ref-reg-input.otp-input {
    letter-spacing: 8px;
    font-size: 1.5rem;
    font-weight: 700;
}

.btn-ref-reg-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
}

.btn-ref-reg-primary.pink {
    background: linear-gradient(135deg, #ff6b9d 0%, #e40580 100%);
    color: white;
}

.btn-ref-reg-primary.pink:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 5, 128, 0.4);
}

.btn-ref-reg-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ref-reg-error {
    color: #dc3545;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 10px;
}

/* Step 4 成功慶祝 */
.ref-reg-success {
    text-align: center;
    padding: 20px 0;
}

.ref-reg-success .success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: celebrateBounce 0.6s ease;
}

@keyframes celebrateBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.ref-reg-success .success-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.ref-reg-success .success-coupon {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b9d 0%, #e40580 100%);
    color: white;
    padding: 8px 24px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 800;
    margin: 12px 0;
}

.ref-reg-success .success-hint {
    font-size: 0.9rem;
    color: #666;
}

/* ============================================================
   v2 推薦系統 - /referrals 頁面
   ============================================================ */

/* v2 推薦獎勵摘要卡片 */
.referral-v2-summary {
    background: linear-gradient(135deg, #ff6b9d 0%, #e40580 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(228, 5, 128, 0.3);
}

.referral-v2-summary .summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    opacity: 0.95;
}

.referral-v2-summary .summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.referral-v2-summary .summary-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 14px 8px;
}

.referral-v2-summary .summary-item .summary-value {
    font-size: 1.8rem;
    font-weight: 800;
}

.referral-v2-summary .summary-item .summary-label {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 4px;
}

/* v2 推薦紀錄卡片 */
.referral-v2-record {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
    background: white;
}

.referral-v2-record:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.referral-v2-record .record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.referral-v2-record .record-user {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    flex-shrink: 0;
    margin-right: 12px;
}

/* 三泡泡進度條 */
.record-progress {
    display: flex;
    align-items: center;
    gap: 0;
}

.record-progress .progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.record-progress .step-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    transition: all 0.2s;
}

.record-progress .progress-step.active .step-dot {
    border-color: #856404;
    background: #fff3cd;
}

.record-progress .step-label {
    font-size: 0.65rem;
    color: #aaa;
    white-space: nowrap;
}

.record-progress .progress-step.active .step-label {
    color: #856404;
    font-weight: 600;
}

.record-progress .progress-line {
    width: 20px;
    height: 2px;
    background: #ddd;
    margin: 0 2px;
    margin-bottom: 16px;
    transition: background 0.2s;
}

.record-progress .progress-line.active {
    background: #856404;
}

.referral-v2-record .record-detail {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #666;
}

.referral-v2-record .record-detail .detail-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* v2 優惠券狀態 */
.referral-v2-coupon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.referral-v2-coupon {
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.referral-v2-coupon.coupon-active {
    border-color: #28a745;
    background: #f0fff4;
    color: #155724;
}

.referral-v2-coupon.coupon-pending {
    border-color: #ffc107;
    background: #fffdf0;
    color: #856404;
}

.referral-v2-coupon.coupon-used {
    border-color: #6c757d;
    background: #f8f9fa;
    color: #6c757d;
    text-decoration: line-through;
}

.referral-v2-coupon .coupon-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.referral-v2-coupon .coupon-label {
    font-size: 0.7rem;
    margin-top: 4px;
}

.referral-v2-coupon .coupon-expiry {
    font-size: 0.65rem;
    color: #999;
    margin-top: 2px;
}

/* 響應式 */
@media (max-width: 576px) {
    .referral-share-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .referral-share-card .share-info {
        margin-right: 0;
    }

    .referral-discount-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .referral-discount-banner .banner-content {
        margin-right: 0;
    }

    .referral-v2-summary .summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .referral-v2-summary .summary-item .summary-value {
        font-size: 1.4rem;
    }

    .referral-v2-coupon-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .referral-v2-record .record-detail {
        flex-direction: column;
        gap: 4px;
    }
}

/* ============================================================
   v1 推薦系統（保留）
   ============================================================ */

/* 推薦碼顯示 */
.referral-code-display {
    font-size: 1.2rem;
}

.code-label {
    color: #666;
    margin-right: 8px;
}

.code-value {
    font-weight: bold;
    font-size: 1.5rem;
    color: #007bff;
    padding: 4px 12px;
    background: #e7f3ff;
    border-radius: 4px;
}

/* 統計卡片 */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.pending {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 推薦任務面板 */
.referral-tasks-panel .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    user-select: none;
}

.referral-tasks-panel .card-header:hover {
    opacity: 0.95;
}

/* 進度統計小卡片 */
.stat-mini-card {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-mini-card:hover {
    transform: scale(1.05);
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 15px;
}

.stat-content {
    flex: 1;
}

.stat-mini-card .stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0;
}

.stat-mini-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* 朋友卡片 */
.friends-list {
    margin-top: 20px;
}

.friend-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.friend-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.friend-card-header {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #dee2e6;
}

.friend-number {
    font-size: 1.2rem;
}

.friend-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.friend-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.friend-card-body {
    padding: 15px;
}

/* 進度條 */
.progress-section {
    margin-bottom: 15px;
}

.progress-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.coupon-progress-bar {
    display: flex;
    gap: 4px;
    font-size: 1.5rem;
    line-height: 1;
    font-family: monospace;
}

.progress-block {
    cursor: help;
    transition: transform 0.2s;
}

.progress-block:hover {
    transform: scale(1.2);
}

.progress-block.filled {
    color: #28a745;
}

.progress-block.empty {
    color: #dee2e6;
}

/* 獎勵資訊 */
.reward-info {
    display: flex;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
}

.reward-active {
    color: #28a745;
}

.reward-pending {
    color: #ffc107;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .referral-code-display {
        font-size: 1rem;
    }
    
    .code-value {
        font-size: 1.2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .friend-card-header {
        flex-wrap: wrap;
    }
    
    .coupon-progress-bar {
        font-size: 1.2rem;
    }
    
    .stat-mini-card {
        margin-bottom: 10px;
    }
    
    .reward-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* Badge 樣式 */
.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

/* Bootstrap Icons 相容 */
.bi {
    display: inline-block;
    vertical-align: -0.125em;
}

/* 視覺化進度條樣式 */
.visual-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    position: relative;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
    position: relative;
}

.step-circle.completed {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 3px solid #28a745;
}

.step-circle.ordered {
    background: linear-gradient(135deg, #ffc107 0%, #ffdb4d 100%);
    color: #333;
    border: 3px solid #ffc107;
    animation: pulse 2s infinite;
}

.step-circle.pending {
    background: #f8f9fa;
    color: #adb5bd;
    border: 3px solid #dee2e6;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    }
    50% {
        box-shadow: 0 2px 16px rgba(255, 193, 7, 0.8);
    }
}

.step-check {
    font-size: 1.5rem;
}

.step-number {
    font-size: 1rem;
}

.step-label {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.step-connector {
    position: absolute;
    top: 25px;
    left: 50%;
    width: 100%;
    height: 4px;
    background: #dee2e6;
    z-index: 1;
}

.step-connector.completed {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.step-connector.ordered {
    background: linear-gradient(90deg, #ffc107 0%, #ffdb4d 100%);
}

/* 進度摘要 */
.progress-summary {
    margin-top: 10px;
}

/* 獎勵狀況卡片 */
.reward-status-section {
    margin-top: 20px;
}

.reward-title {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.reward-box {
    transition: transform 0.2s;
}

.reward-box:hover {
    transform: scale(1.05);
}

/* 進度圖例 */
.progress-legend {
    border: 1px solid #dee2e6;
}

.legend-title {
    font-size: 0.85rem;
    color: #6c757d;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.legend-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-circle.completed-demo {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 2px solid #28a745;
}

.legend-circle.ordered-demo {
    background: linear-gradient(135deg, #ffc107 0%, #ffdb4d 100%);
    color: #333;
    border: 2px solid #ffc107;
}

.legend-circle.pending-demo {
    background: #f8f9fa;
    color: #adb5bd;
    border: 2px solid #dee2e6;
}

.legend-item span {
    font-size: 0.75rem;
    color: #6c757d;
    line-height: 1.2;
}

/* 響應式調整 */
@media (max-width: 576px) {
    .step-circle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .step-check {
        font-size: 1.2rem;
    }
    
    .step-number {
        font-size: 0.85rem;
    }
    
    .step-label {
        font-size: 0.65rem;
    }
    
    .step-connector {
        top: 20px;
    }
    
    .reward-box {
        margin-bottom: 10px;
    }
}
/* 倒數計時樣式 */
.coupon-countdown {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    margin-right: 8px;
}

.coupon-countdown.normal {
    background: #d1ecf1;
    color: #0c5460;
}

.coupon-countdown.warning {
    background: #fff3cd;
    color: #856404;
}

.coupon-countdown.urgent {
    background: #f8d7da;
    color: #721c24;
    animation: pulse 2s infinite;
}

.coupon-countdown.expired {
    background: #d6d8db;
    color: #495057;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}