/* === Enhanced Pack Opening Animations === */

/* Pack Opening Overlay Base */
#pack-opening-area {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(135deg, #0a0a0a, #151515) !important;
    z-index: 999999 !important;
    display: none;
    overflow: hidden !important;
    flex-direction: column !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

#pack-opening-area.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    animation: fadeIn 0.5s ease-in-out !important;
}

/* Background Effects */
.pack-opening-overlay-style {
    background: radial-gradient(ellipse at center, rgba(30, 30, 30, 0.4) 0%, rgba(15, 15, 15, 0.6) 100%);
    position: relative;
}

.pack-opening-overlay-style::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><filter id="noise"><feTurbulence baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter></defs><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
    pointer-events: none;
}

/* Dynamic Rarity Backgrounds */
.reveal-bg-rare {
    background: linear-gradient(135deg, #333366, #444477, #333366);
    animation: rarityPulse 2s ease-in-out infinite alternate;
}

.reveal-bg-legendary {
    background: linear-gradient(135deg, #666633, #777744, #666633);
    animation: legendaryShimmer 3s ease-in-out infinite;
}

/* Pack Visual Styles */
.pack-visual-overlay {
    width: 300px;
    height: 420px;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #444444;
    overflow: hidden;
}

.pack-visual-overlay::before {
    content: '📦';
    font-size: 120px;
    color: #666666;
    text-shadow: 0 0 20px rgba(102, 102, 102, 0.3);
    animation: packFloat 2s ease-in-out infinite;
}

.pack-visual-overlay:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

/* Pack Type Specific Styling */
.pack-visual-starter {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #a9dfbf;
}

.pack-visual-rare {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    border-color: #d7bde2;
}

.pack-visual-legendary {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border-color: #f8c471;
    animation: legendaryGlow 1.5s ease-in-out infinite alternate;
}

.pack-visual-birdwell {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    border-color: #76d7c4;
}

.pack-visual-basement {
    background: linear-gradient(135deg, #7f8c8d, #95a5a6);
    border-color: #bdc3c7;
}

/* Tear Animation */
.pack-visual-overlay.tearing {
    animation: tearOpen 1.5s ease-out forwards;
}

@keyframes tearOpen {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.1);
        filter: brightness(1.2);
    }
    50% {
        transform: scale(1.05) rotateY(10deg);
        filter: brightness(1.1);
    }
    75% {
        transform: scale(0.95) rotateY(-5deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotateY(180deg);
        opacity: 0;
        filter: brightness(0);
    }
}

/* Card Display Area */
.pack-card-display-area-overlay {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 20px;
    max-width: 90vw;
    animation: cardsAppear 0.8s ease-out;
}

@keyframes cardsAppear {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Individual Card Animations */
.pack-revealed-card-overlay {
    position: relative;
    transform: scale(0.9);
    transition: all 0.4s ease;
    margin: 10px;
}

.card-appear {
    animation: cardSlideIn 0.6s ease-out forwards;
}

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(100px) rotateY(180deg) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(-10px) rotateY(90deg) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateY(0deg) scale(1);
    }
}

/* Face-down card styling */
.face-down {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    border: 3px solid #95a5a6;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.face-down::before {
    content: '?';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    color: #ecf0f1;
    text-shadow: 0 0 10px rgba(236, 240, 241, 0.5);
}

.face-down .card-content {
    opacity: 0;
}

/* Pulsing animation for clickable cards */
.pulsing {
    animation: cardPulse 1.5s ease-in-out infinite;
}

@keyframes cardPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(52, 152, 219, 0.8);
    }
}

/* Card Flip Animation */
.pack-revealed-card-overlay.flipping {
    animation: cardFlip 0.6s ease-in-out forwards;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(90deg) scale(1.1);
    }
    100% {
        transform: rotateY(0deg) scale(1);
    }
}

/* Rarity-specific effects for pack opening cards */
.pack-revealed-card-overlay.rarity-common {
    border-color: #95a5a6 !important;
    box-shadow: 0 15px 30px rgba(149, 165, 166, 0.3) !important;
}

.pack-revealed-card-overlay.rarity-common .card-rarity {
    background: linear-gradient(45deg, #95a5a6, #bdc3c7) !important;
}

.pack-revealed-card-overlay.rarity-uncommon {
    border-color: #27ae60 !important;
    box-shadow: 0 15px 30px rgba(39, 174, 96, 0.4) !important;
}

.pack-revealed-card-overlay.rarity-uncommon .card-rarity {
    background: linear-gradient(45deg, #27ae60, #2ecc71) !important;
}

.pack-revealed-card-overlay.rarity-rare {
    border-color: #3498db !important;
    box-shadow: 0 15px 30px rgba(52, 152, 219, 0.5) !important;
    animation: rareBorderGlow 2s ease-in-out infinite !important;
}

.pack-revealed-card-overlay.rarity-rare .card-rarity {
    background: linear-gradient(45deg, #3498db, #5dade2) !important;
}

.pack-revealed-card-overlay.rarity-legendary {
    border-color: #f39c12 !important;
    box-shadow: 0 15px 30px rgba(243, 156, 18, 0.6) !important;
    animation: legendaryBorderGlow 1.5s ease-in-out infinite !important;
}

.pack-revealed-card-overlay.rarity-legendary .card-rarity {
    background: linear-gradient(45deg, #f39c12, #f7dc6f) !important;
}

.pack-revealed-card-overlay.rarity-mythic {
    border-color: #9b59b6 !important;
    box-shadow: 0 15px 30px rgba(155, 89, 182, 0.7) !important;
    animation: mythicBorderGlow 1s ease-in-out infinite !important;
}

.pack-revealed-card-overlay.rarity-mythic .card-rarity {
    background: linear-gradient(45deg, #9b59b6, #d2b4de) !important;
}

/* Original rarity effects for other contexts */
.rarity-common {
    border-color: #95a5a6;
    box-shadow: 0 0 10px rgba(149, 165, 166, 0.5);
}

.rarity-uncommon {
    border-color: #27ae60;
    box-shadow: 0 0 15px rgba(39, 174, 96, 0.6);
}

.rarity-rare {
    border-color: #3498db;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.7);
    animation: rareBorderGlow 2s ease-in-out infinite;
}

.rarity-legendary {
    border-color: #f39c12;
    box-shadow: 0 0 25px rgba(243, 156, 18, 0.8);
    animation: legendaryBorderGlow 1.5s ease-in-out infinite;
}

.rarity-mythic {
    border-color: #9b59b6;
    box-shadow: 0 0 30px rgba(155, 89, 182, 0.9);
    animation: mythicBorderGlow 1s ease-in-out infinite;
}

/* Holographic effect */
.holo-effect {
    position: relative;
    overflow: hidden;
}

.holo-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: holoSweep 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes holoSweep {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    50% {
        transform: translateX(0%) translateY(0%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Glow animations */
@keyframes rareBorderGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(52, 152, 219, 0.7);
    }
    50% {
        box-shadow: 0 0 30px rgba(52, 152, 219, 1);
    }
}

@keyframes legendaryBorderGlow {
    0%, 100% {
        box-shadow: 0 0 25px rgba(243, 156, 18, 0.8);
    }
    50% {
        box-shadow: 0 0 40px rgba(243, 156, 18, 1);
    }
}

@keyframes mythicBorderGlow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(155, 89, 182, 0.9);
    }
    50% {
        box-shadow: 0 0 50px rgba(155, 89, 182, 1);
    }
}

/* Background animations */
@keyframes packFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes rarityPulse {
    0% {
        filter: brightness(1) saturate(1);
    }
    100% {
        filter: brightness(1.2) saturate(1.3);
    }
}

@keyframes legendaryShimmer {
    0%, 100% {
        filter: brightness(1) hue-rotate(0deg);
    }
    33% {
        filter: brightness(1.3) hue-rotate(10deg);
    }
    66% {
        filter: brightness(1.1) hue-rotate(-10deg);
    }
}

@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 15px 40px rgba(243, 156, 18, 0.4);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Card Display Area */
.pack-card-display-area-overlay {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: center !important;
    align-items: center !important;
    max-width: 90% !important;
    padding: 20px !important;
    z-index: 10001 !important;
}

/* Pack revealed cards */
.pack-revealed-card-overlay {
    width: 240px !important;
    height: 336px !important;
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
    border-radius: 12px !important;
    border: 2px solid #4a90e2 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6) !important;
    cursor: pointer !important;
    transition: all 0.4s ease !important;
    position: relative !important;
    z-index: 10002 !important;
    padding: 15px !important;
    overflow: hidden !important;
}

.pack-revealed-card-overlay:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 20px 40px rgba(74, 144, 226, 0.4) !important;
    border-color: #9046e2 !important;
}

.pack-revealed-card-overlay .card-content {
    text-align: center !important;
    color: white !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.pack-revealed-card-overlay .card-image {
    width: 180px !important;
    height: 180px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin-bottom: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.pack-revealed-card-overlay .card-name {
    font-size: 18px !important;
    font-weight: bold !important;
    margin-bottom: 8px !important;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7) !important;
    line-height: 1.2 !important;
}

.pack-revealed-card-overlay .card-rarity {
    font-size: 12px !important;
    text-transform: uppercase !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    background: linear-gradient(45deg, #4a90e2, #9046e2) !important;
    margin-bottom: 6px !important;
    color: #ffffff !important;
    font-weight: bold !important;
    letter-spacing: 0.5px !important;
}

.pack-revealed-card-overlay .card-type {
    font-size: 14px !important;
    color: #cccccc !important;
    margin-bottom: 4px !important;
}

.pack-revealed-card-overlay .card-info {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.pack-revealed-card-overlay .card-stats {
    display: flex !important;
    justify-content: space-around !important;
    margin: 6px 0 !important;
    padding: 4px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 8px !important;
}

.pack-revealed-card-overlay .card-stats span {
    font-size: 14px !important;
    font-weight: bold !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    min-width: 24px !important;
    text-align: center !important;
}

.pack-revealed-card-overlay .stat-attack {
    background: rgba(220, 53, 69, 0.7) !important;
    color: #ffffff !important;
}

.pack-revealed-card-overlay .stat-defense {
    background: rgba(40, 167, 69, 0.7) !important;
    color: #ffffff !important;
}

.pack-revealed-card-overlay .stat-health {
    background: rgba(23, 162, 184, 0.7) !important;
    color: #ffffff !important;
}

.pack-revealed-card-overlay .card-cost {
    font-size: 16px !important;
    font-weight: bold !important;
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.2) !important;
    padding: 4px 8px !important;
    border-radius: 50% !important;
    border: 2px solid #ffd700 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    flex-shrink: 0 !important;
}

/* Controls for pack opening */
.pack-opening-controls {
    position: absolute !important;
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 20px !important;
    z-index: 10003 !important;
    opacity: 1 !important;
    visibility: visible !important;
    background: rgba(26, 26, 46, 0.9) !important;
    padding: 20px 30px !important;
    border-radius: 50px !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(74, 144, 226, 0.3) !important;
}

.pack-control-button {
    padding: 14px 28px !important;
    background: linear-gradient(45deg, #4a90e2, #9046e2) !important;
    color: white !important;
    border: none !important;
    border-radius: 28px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 10004 !important;
    font-size: 14px !important;
    min-width: 120px !important;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3) !important;
}

.pack-control-button:hover {
    background: linear-gradient(45deg, #5ba0f2, #a056f2) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.5) !important;
}

.pack-control-button.primary {
    background: linear-gradient(45deg, #f39c12, #e67e22) !important;
}

.pack-control-button.primary:hover {
    background: linear-gradient(45deg, #f7dc6f, #f8c471) !important;
}

/* Particle effect containers */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: particleFloat 3s ease-out forwards;
    pointer-events: none;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .pack-visual-overlay {
        width: 250px;
        height: 350px;
    }
    
    .pack-card-display-area-overlay {
        gap: 15px;
        padding: 15px;
    }
    
    .pack-revealed-card-overlay {
        margin: 5px;
    }
    
    .pack-control-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Loading states */
.loading-indicator {
    color: white;
    font-size: 18px;
    text-align: center;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}