/* COSMIC WALLET MODAL - Quantum Gateway */
.wallet-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 2, 8, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(20px) saturate(180%);
}

.wallet-modal.active {
    display: flex;
}

.wallet-modal-content {
    background: var(--glass-dark);
    backdrop-filter: blur(60px) saturate(200%);
    border: var(--glass-border);
    border-radius: var(--quantum-radius);
    padding: 2.5rem;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--cosmic-shadow), var(--neon-glow);
    animation: quantumPortalIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

/* Cosmic portal entrance animation */
@keyframes quantumPortalIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9) rotateX(10deg);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0);
        filter: blur(0);
    }
}

/* Holographic overlay for modal */
.wallet-modal-content::before {
    content: "";
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, transparent 0%, rgba(26, 93, 255, 0.08) 50%, transparent 100%),
        repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.02) 2px, rgba(255,255,255,0.02) 4px);
    opacity: 0.3;
    animation: hologramScan 8s linear infinite;
    pointer-events: none;
    border-radius: inherit;
}

.wallet-modal-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 2;
}

.wallet-modal-header h3 {
    background: linear-gradient(135deg, var(--cosmic-text), var(--cosmic-accent), var(--cosmic-accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    text-shadow: 0 0 40px rgba(26, 93, 255, 0.6);
}

.wallet-modal-header p {
    color: var(--cosmic-muted);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.wallet-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 2;
}

.wallet-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(26, 93, 255, 0.2);
    border-radius: var(--quantum-radius-sm);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-decoration: none;
    color: var(--cosmic-text);
    position: relative;
    overflow: hidden;
}

.wallet-option::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--cosmic-accent), var(--cosmic-accent-2));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.wallet-option:hover {
    border-color: rgba(26, 93, 255, 0.5);
    background: rgba(26, 93, 255, 0.1);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(26, 93, 255, 0.25), var(--accent-glow);
}

.wallet-option:hover::before {
    opacity: 0.1;
}

.wallet-option:hover .wallet-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 30px rgba(26, 93, 255, 0.6);
}

.wallet-option:hover .wallet-arrow {
    transform: translateX(4px);
    color: var(--cosmic-accent-2);
}

.wallet-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--cosmic-accent), var(--cosmic-accent-2));
    color: var(--cosmic-text);
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 25px rgba(26, 93, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.wallet-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.wallet-option:hover .wallet-icon::before {
    transform: translateX(100%);
}

/* CHANGED: Renamed to avoid conflict with connected wallet state */
.wallet-details {
    flex: 1;
}

.wallet-name {
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--cosmic-text);
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.wallet-description {
    font-size: 0.85rem;
    color: var(--cosmic-muted);
    font-weight: 500;
    line-height: 1.4;
}

.wallet-arrow {
    color: var(--cosmic-muted);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wallet-modal-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(26, 93, 255, 0.15);
    position: relative;
    z-index: 2;
}

.wallet-modal-footer p {
    color: var(--cosmic-muted);
    font-size: 0.85rem;
    margin: 0;
    font-weight: 500;
}

.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(26, 93, 255, 0.1);
    border: 1px solid rgba(26, 93, 255, 0.2);
    color: var(--cosmic-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.close-modal:hover {
    background: rgba(26, 93, 255, 0.2);
    border-color: rgba(26, 93, 255, 0.4);
    color: var(--cosmic-text);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(26, 93, 255, 0.3);
}

/* Loading state - Quantum Charging */
.wallet-option.loading {
    pointer-events: none;
    position: relative;
}

.wallet-option.loading::after {
    content: "";
    position: absolute;
    inset: -2px;
    background: conic-gradient(from 0deg, var(--cosmic-accent), var(--cosmic-accent-2), var(--cosmic-accent-3), var(--cosmic-accent));
    border-radius: calc(var(--quantum-radius-sm) + 2px);
    animation: quantumSpin 1.5s linear infinite;
    z-index: -1;
    opacity: 0.6;
    filter: blur(8px);
}

.wallet-option.loading .wallet-icon {
    animation: quantumPulse 1.5s ease-in-out infinite;
}

.wallet-option.loading .wallet-icon::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: quantumSpin 1s linear infinite;
}

/* Enhanced spin animation */
@keyframes quantumSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Modal */
@media (max-width: 767px) {
    .wallet-modal-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: none;
    }
    
    .wallet-modal-header h3 {
        font-size: 1.5rem;
    }
    
    .wallet-option {
        padding: 1.25rem;
    }
    
    .wallet-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    .close-modal {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .wallet-modal-content {
        padding: 1.75rem 1.25rem;
        border-radius: 20px;
    }
    
    .wallet-modal-header {
        margin-bottom: 2rem;
    }
    
    .wallet-modal-header h3 {
        font-size: 1.4rem;
    }
    
    .wallet-option {
        padding: 1.1rem;
        gap: 1rem;
    }
    
    .wallet-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .wallet-name {
        font-size: 1rem;
    }
}

/* Quantum particles in modal background */
.wallet-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 30% 40%, rgba(26, 93, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(0, 195, 255, 0.1) 0%, transparent 50%);
    opacity: 0.3;
    pointer-events: none;
}