/**
 * Lucky Reward System - CSS Styles
 * Hiệu ứng Mở Hộp Quà với animation bung quà vui mắt
 */

/* === Overlay === */
.lucky-reward-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lucky-reward-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* === Container === */
.lucky-reward-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.8) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lucky-reward-overlay.show .lucky-reward-container {
    transform: scale(1) translateY(0);
}

/* Background pattern */
.lucky-reward-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* === Close Button === */
.lucky-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.lucky-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* === Gift Box === */
.gift-box-wrapper {
    position: relative;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.gift-box-wrapper.already-opened .gift-box {
    display: none;
}

.gift-box {
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.gift-box:hover {
    transform: scale(1.05) rotate(-2deg);
}

.gift-box:active {
    transform: scale(0.95);
}

/* Gift Body */
.gift-body {
    width: 120px;
    height: 90px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 8px;
    position: relative;
    box-shadow: 
        inset 0 -10px 20px rgba(0,0,0,0.1),
        0 10px 30px rgba(0,0,0,0.3);
}

/* Ribbons */
.gift-ribbon-h {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(180deg, #ffd93d 0%, #f0c419 100%);
    transform: translateY(-50%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.gift-ribbon-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, #ffd93d 0%, #f0c419 100%);
    transform: translateX(-50%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Gift Lid */
.gift-lid {
    position: absolute;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 25px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -3px 10px rgba(0,0,0,0.2);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center bottom;
}

.gift-lid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(180deg, #ffd93d 0%, #f0c419 100%);
    transform: translateY(-50%);
}

/* Bow */
.gift-bow {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 30px;
}

.gift-bow::before,
.gift-bow::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #ffd93d 0%, #f0c419 100%);
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.gift-bow::before {
    left: 0;
    transform: rotate(-45deg);
}

.gift-bow::after {
    right: 0;
    transform: rotate(45deg) scaleX(-1);
}

/* === Opening Animation === */
.gift-box.opening .gift-lid {
    animation: lidOpen 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.gift-box.opening .gift-body {
    animation: boxShake 0.3s ease-in-out 2;
}

@keyframes lidOpen {
    0% {
        transform: translateX(-50%) rotate(0deg) translateY(0);
    }
    50% {
        transform: translateX(-50%) rotate(-30deg) translateY(-30px);
    }
    100% {
        transform: translateX(-50%) rotate(-40deg) translateY(-60px);
        opacity: 0;
    }
}

@keyframes boxShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-2deg); }
    75% { transform: translateX(5px) rotate(2deg); }
}

.gift-box.opened {
    display: none;
}

/* === Confetti === */
.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
    opacity: 0;
}

.confetti.square {
    border-radius: 2px;
}

.confetti.circle {
    border-radius: 50%;
}

.confetti.triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid currentColor;
    background: transparent !important;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(0);
    }
    10% {
        transform: translateY(-100px) rotate(180deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) rotate(720deg) scale(0.5);
    }
}

/* === Stars === */
.stars-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    font-size: 24px;
    animation: starPop 1s ease-out forwards;
    opacity: 0;
}

@keyframes starPop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(360deg);
    }
}

/* === Result Content === */
.lucky-result {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
    color: white;
}

.lucky-result.show {
    opacity: 1;
    transform: translateY(0);
}

/* Winner Content */
.winner-content {
    padding: 1rem 0;
}

.winner-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: bounce 0.6s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.winner-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.reward-badge {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    animation: pulse 2s ease infinite;
}

.reward-badge.free {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 20px rgba(245, 87, 108, 0.5);
}

.reward-badge.percent {
    background: linear-gradient(135deg, #ffd93d 0%, #ff9500 100%);
    color: #333;
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.5);
}

.reward-badge.fixed {
    background: linear-gradient(135deg, #6bcb77 0%, #38a169 100%);
    box-shadow: 0 4px 20px rgba(107, 203, 119, 0.5);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.reward-name {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

/* Price Breakdown */
.price-breakdown {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.price-row.original .strike {
    text-decoration: line-through;
    opacity: 0.7;
}

.price-row.discount .discount-amount {
    color: #6bcb77;
    font-weight: 600;
}

.price-row.final {
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.price-row.final .final-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffd93d;
}

/* Consolation Content (có mã giảm giá) */
.consolation-content {
    padding: 1rem 0;
}

.consolation-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.consolation-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.consolation-desc {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.discount-code-display {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.code-label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.code-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.code-text {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #764ba2;
    letter-spacing: 2px;
}

.copy-code-btn {
    background: #764ba2;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: #5a3a80;
    transform: scale(1.1);
}

.code-hint {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* No Reward Content */
.no-reward-content {
    padding: 1.5rem 0;
}

.no-reward-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.no-reward-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.no-reward-desc {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* === Tap Instruction === */
.tap-instruction {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    animation: blink 1.5s ease-in-out infinite;
}

.tap-instruction.hidden {
    display: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === Action Buttons === */
.lucky-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.4s ease;
}

.lucky-actions.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lucky-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.lucky-btn.primary {
    background: white;
    color: #764ba2;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.lucky-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.lucky-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.lucky-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === Mobile Responsive === */
@media (max-width: 480px) {
    .lucky-reward-container {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .gift-box-wrapper {
        height: 150px;
    }

    .gift-body {
        width: 100px;
        height: 75px;
    }

    .gift-lid {
        width: 110px;
        height: 22px;
        bottom: 70px;
    }

    .winner-title {
        font-size: 1.5rem;
    }

    .reward-badge {
        font-size: 1.1rem;
        padding: 0.6rem 1.2rem;
    }

    .code-text {
        font-size: 1.25rem;
    }
}

/* === GIFT REWARD STYLES === */
/* Special gift reward content */
.gift-reward-content {
    padding: 1rem 0;
}

.gift-icon-wrapper {
    margin-bottom: 0.5rem;
}

.gift-reward-content .gift-icon {
    font-size: 4rem;
    animation: giftBounce 0.8s ease infinite;
}

@keyframes giftBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-8px) rotate(5deg); }
}

.reward-badge.gift {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

.gift-description {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
}

.gift-description p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
}

.gift-claim-instructions {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(6, 182, 212, 0.3) 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
}

.gift-claim-instructions .claim-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #10b981;
}

.gift-claim-instructions .claim-title .icon {
    font-size: 1.1rem;
}

.gift-claim-instructions p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.price-info-gift {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.price-info-gift .price-note {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.price-info-gift .price-note strong {
    color: #ffd93d;
    font-size: 1.1rem;
}

.price-info-gift .bonus-note {
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 600;
}

/* Gift reward responsive */
@media (max-width: 480px) {
    .gift-reward-content .gift-icon {
        font-size: 3rem;
    }
    
    .gift-description,
    .gift-claim-instructions,
    .price-info-gift {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .gift-description p,
    .gift-claim-instructions p {
        font-size: 0.85rem;
    }
}
