/* ============================================
   CENTRALIZED WALLET WIDGET STYLES
   Single source of truth for wallet across all pages
   ============================================ */

/* Wallet shell */
.wallet-widget {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wallet-widget.wallet-ready {
    opacity: 1;
}

.wallet-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.95), rgba(45, 27, 105, 0.95));
    border: 2px solid transparent;
    backdrop-filter: blur(12px);
    border-radius: 999px;
    padding: 18px 32px;
    cursor: pointer;
    user-select: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-size: 1.1rem;
    box-shadow: 0 4px 20px rgba(255, 20, 147, 0.4),
                0 0 0 0 rgba(255, 20, 147, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    letter-spacing: 0.5px;
}

/* Animated gradient border for wallet widget */
.wallet-content::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    padding: 2px;
    background: linear-gradient(135deg, #FF1493, #FF69B4, #00BFFF, #FF1493);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderRotate 3s linear infinite;
}

.wallet-content:hover {
    background: linear-gradient(135deg, rgba(45, 27, 105, 0.95), rgba(75, 0, 130, 0.95));
    transform: translateY(-2px);
    box-shadow: 0 8px 40px rgba(255, 20, 147, 0.6),
                0 0 60px rgba(255, 20, 147, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.wallet-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 42px;
    background: linear-gradient(135deg, #FF69B4, #8B5CF6);
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255, 105, 180, 0.4);
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.3);
}

.wallet-name {
    font-weight: 600;
    color: #fff;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
    font-size: 1.05rem;
}

.wallet-balance {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: relative;
    z-index: 1;
}

#walletAmount {
    font-size: 1.6rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FF69B4, #FF1493);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: shimmerBalance 3s linear infinite;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    filter: drop-shadow(0 0 10px rgba(255, 105, 180, 0.6));
    letter-spacing: 0.5px;
}

@keyframes shimmerBalance {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.wallet-caret {
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
}

.wallet-dropdown {
    position: absolute;
    top: 78px;
    right: 0;
    min-width: 280px;
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.98), rgba(45, 27, 105, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 105, 180, 0.3);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(255, 20, 147, 0.4),
                0 0 60px rgba(138, 43, 226, 0.2);
    padding: 1rem;
    display: none;
    z-index: 100001;
    pointer-events: auto;
}

.wallet-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

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

.wallet-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: #E6E6FA;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 1.05rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.wallet-item span:first-child {
    font-size: 1.25rem;
    filter: drop-shadow(0 0 4px rgba(255, 105, 180, 0.4));
}

.wallet-item:hover {
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.15), rgba(138, 43, 226, 0.15));
    border-color: rgba(255, 105, 180, 0.3);
    transform: translateX(4px);
}

.wallet-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 105, 180, 0.3), transparent);
    margin: 0.75rem 0;
}

/* Enhanced Signed-out button with animations */
.wallet-signin {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    background: linear-gradient(135deg, rgba(26, 0, 51, 0.95), rgba(45, 27, 105, 0.95));
    backdrop-filter: blur(12px);
    border: 2px solid transparent;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(255, 20, 147, 0.4),
                0 0 0 0 rgba(255, 20, 147, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

/* Animated gradient border */
.wallet-signin::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50px;
    padding: 2px;
    background: linear-gradient(135deg, #FF1493, #FF69B4, #00BFFF, #FF1493);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderRotate 3s linear infinite;
}

/* Shimmer effect */
.wallet-signin::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes borderRotate {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Pulsing glow animation */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 20, 147, 0.4),
                    0 0 20px rgba(255, 20, 147, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 20, 147, 0.6),
                    0 0 40px rgba(255, 20, 147, 0.4),
                    inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

.wallet-signin {
    animation: pulseGlow 2s ease-in-out infinite;
}

.wallet-signin:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 40px rgba(255, 20, 147, 0.7),
                0 0 60px rgba(255, 20, 147, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: none; /* Stop pulse on hover */
}

.wallet-signin:active {
    transform: translateY(-1px) scale(0.98);
}

.wallet-signin .sign-in-btn-icon {
    font-size: 1.3rem;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 8px rgba(255, 20, 147, 0.6));
    animation: iconBounce 2s ease-in-out infinite;
}

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

.wallet-signin span:not(.sign-in-btn-icon) {
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .wallet-signin {
        padding: 12px 22px;
        font-size: 0.9rem;
        gap: 10px;
    }

    .wallet-signin .sign-in-btn-icon {
        font-size: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wallet-signin,
    .wallet-signin::before,
    .wallet-signin::after,
    .wallet-signin .sign-in-btn-icon {
        animation: none;
    }
}

/* Safety: ensure overlays never block clicks */
*[data-overlay], .modal, .toast, .floating-banner {
    pointer-events: none;
}

.wallet-widget, .wallet-widget * {
    pointer-events: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wallet-widget {
        top: 10px;
        right: 10px;
    }

    .wallet-content {
        padding: 14px 24px;
        gap: 0.8rem;
        font-size: 1rem;
    }

    .wallet-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }

    .wallet-name {
        max-width: 140px;
        font-size: 1rem;
    }

    #walletAmount {
        font-size: 1.4rem;
    }

    .wallet-dropdown {
        min-width: 240px;
        top: 68px;
    }
}
