/* ========= CASE MODAL STYLES ========= */

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(245,158,11,0.4); transform: scale(1); }
    50%       { box-shadow: 0 6px 25px rgba(245,158,11,0.7); transform: scale(1.01); }
}

/* ========= STARTER PACK MODAL ========= */
.starter-pack-modal {
    display: none;
    position: fixed;
    z-index: 11000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
}
.starter-pack-modal.show { display: flex; }
.starter-pack-content {
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    border: 2px solid #f59e0b;
    border-radius: 20px;
    padding: 30px;
    max-width: 460px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(245,158,11,0.3);
    animation: caseSlideIn 0.3s ease-out;
}

.case-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: fadeIn 0.3s ease-out;
}

.case-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-modal.closing {
    animation: fadeOut 0.3s ease-in;
}

.case-modal-content.closing {
    animation: caseSlideOut 0.3s ease-in;
}

.case-modal-content.closing-smooth {
    animation: slideOutDown 0.4s ease-in;
}

.case-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 16px;
    padding: 18px 20px;
    max-width: 680px;
    width: 95%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid #4a9eff;
    animation: caseSlideIn 0.3s ease-out;
}

/* Case modal specific animations */
@keyframes caseSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.case-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid #4a9eff;
}

.case-modal-header h2 {
    color: #fff;
    font-size: 24px;
    margin: 0;
    text-shadow: 0 0 10px #4a9eff;
}

.close-case-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-case-modal:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* ========= CASE SELECTION ========= */
.case-selection {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 14px;
}

.case-type-btn {
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: 1.5px solid #4a9eff;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 0;
    white-space: nowrap;
}

.case-type-btn:hover {
    background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
    border-color: #5ba9ff;
    transform: translateY(-2px);
}

.case-type-btn.active {
    background: linear-gradient(135deg, #4a9eff, #2e7d32);
    border-color: #2e7d32;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

/* ========= CASE BOX ========= */
.case-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.case-box {
    position: relative;
    width: 130px;
    height: 100px;
    perspective: 1000px;
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

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

.case-lid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 38%;
    background: linear-gradient(135deg, #4a9eff 0%, #7c3aed 50%, #4a9eff 100%);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 4px 12px rgba(124,58,237,0.5);
    transform-origin: bottom;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(139,92,246,0.6);
    border-bottom: none;
}

.case-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(74,158,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(74,158,255,0.3);
    border-top: none;
}

/* Shine sweep effect */
.case-body::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: shineSweep 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shineSweep {
    0%   { left: -60%; }
    50%  { left: 120%; }
    100% { left: 120%; }
}

.case-logo {
    position: absolute;
    z-index: 2;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.case-logo img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6)) brightness(1.15);
    animation: floatRotate 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes floatRotate {
    0%   { transform: rotate(0deg) translateY(0px) scale(1); }
    25%  { transform: rotate(5deg) translateY(-4px) scale(1.03); }
    50%  { transform: rotate(10deg) translateY(-8px) scale(1.06); }
    75%  { transform: rotate(5deg) translateY(-4px) scale(1.03); }
    100% { transform: rotate(0deg) translateY(0px) scale(1); }
}

.case-glow {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 80% !important;
    height: 60% !important;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.3) 0%, transparent 70%) !important;
    border-radius: 50% !important;
    animation: pulse 2s infinite !important;
}

.case-info {
    flex: 1;
    color: #fff;
}

.case-info h3 {
    font-size: 20px;
    margin: 0 0 10px 0;
    color: #4a9eff;
}

.case-info p {
    margin: 0 0 15px 0;
    color: #ccc;
    line-height: 1.4;
}

.case-price {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

.sol-icon {
    font-size: 20px;
    color: #4a9eff;
}

/* ========= REWARDS GRID ========= */
.case-rewards {
    margin-bottom: 14px;
}

.case-rewards h4 {
    color: #fff;
    margin: 0 0 8px 0;
    font-size: 13px;
}

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 6px;
}

.reward-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 4px;
    text-align: center;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.reward-item:hover {
    border-color: #4a9eff;
    transform: translateY(-2px);
}

.reward-item.common {
    border-color: #9ca3af;
}

.reward-item.rare {
    border-color: #3b82f6;
}

.reward-item.epic {
    border-color: #8b5cf6;
}

.reward-item.legendary {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.reward-item.mythic {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.reward-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 3px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.reward-name {
    font-size: 10px;
    color: #fff;
    margin: 0;
    line-height: 1.2;
}

.reward-chance {
    font-size: 9px;
    color: #999;
    margin: 0;
}

/* ========= CASE ACTIONS ========= */
.case-actions {
    text-align: center;
}

.open-case-btn {
    background: linear-gradient(135deg, #4a9eff 0%, #0066cc 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(74, 158, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 15px;
}

.open-case-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.4);
}

.open-case-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wallet-balance {
    color: #ccc;
    font-size: 14px;
}

/* ========= CASE OPENING ANIMATION ========= */
.case-opening-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

/* Toast notification */
.case-toast{
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 10002;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.15);
}

.case-opening-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-opening-modal.closing {
    animation: fadeOut 0.3s ease-in;
}

.case-opening-content.closing {
    animation: slideOut 0.3s ease-in;
}

.case-opening-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid #4a9eff;
}

.opening-animation {
    margin-bottom: 30px;
}

.case-opening-box {
    position: relative;
    width: 300px;
    height: 200px;
    margin: 0 auto 30px;
    perspective: 1000px;
}

.case-opening-lid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    transform-origin: bottom;
    animation: caseOpen 2s ease-in-out;
}

.case-opening-body {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 50%, #8b4513 100%);
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.3);
}

.case-opening-glow {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 80% !important;
    height: 60% !important;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.5) 0%, transparent 70%) !important;
    border-radius: 50% !important;
    animation: glowPulse 1s infinite !important;
}

.rewards-scroll {
    width: 100%;
    height: 100px;
    overflow: hidden;
    border: 2px solid #4a9eff;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.rewards-track {
    display: flex;
    height: 100%;
    transition: transform 3s ease-out;
}

.reward-scroll-item {
    min-width: 100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-scroll-icon {
    width: 50px;
    height: 50px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-bottom: 5px;
}

.reward-scroll-name {
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.opening-result {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid #4a9eff;
    animation: resultAppear 0.5s ease-out;
    position: relative;
}

.result-arrow {
    font-size: 48px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.result-item {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: itemBounce 0.6s ease-out;
}

.result-rarity {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.result-rarity.common { color: #9ca3af; }
.result-rarity.rare { color: #3b82f6; }
.result-rarity.epic { color: #8b5cf6; }
.result-rarity.legendary { color: #f59e0b; }
.result-rarity.mythic { color: #ef4444; }

.result-name {
    font-size: 20px;
    color: #fff;
    font-weight: bold;
}

.opening-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.claim-reward-btn, .open-another-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.claim-reward-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.open-another-btn {
    background: linear-gradient(135deg, #4a9eff 0%, #0066cc 100%);
    color: white;
}

.claim-reward-btn:hover, .open-another-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ========= ANIMATIONS ========= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes caseOpen {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes resultAppear {
    from { 
        opacity: 0;
        transform: scale(0.5);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes itemBounce {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* ========= RESPONSIVE ========= */
@media (max-width: 768px) {
    .case-modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .case-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .case-box {
        width: 150px;
        height: 120px;
    }
    
    .rewards-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }
    
    .case-opening-content {
        padding: 20px;
        margin: 20px;
    }
    
    .case-opening-box {
        width: 250px;
        height: 150px;
    }
}
