/* ========================================
   DEVOTLY - CUSTOM STATS ENHANCEMENT
   Modern, responsive styling for user statistics display
   ======================================== */

/* Main container enhancements */
.custom-stats {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    justify-content: center;
    background: rgba(0, 0, 0, 0.15);
    padding: clamp(1rem, 3vw, 1.5rem) clamp(1.5rem, 4vw, 2rem);
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(244, 196, 64, 0.15);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(244, 196, 64, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: clamp(1.5rem, 4vw, 2.5rem) auto;
    max-width: fit-content;
}

/* Subtle background glow effect */
.custom-stats::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(244, 196, 64, 0.6), 
        transparent
    );
    opacity: 0.8;
}

/* Radial background enhancement */
.custom-stats::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at 30% 20%,
        rgba(244, 196, 64, 0.05) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: -1;
}

/* Hover effects for the container */
.custom-stats:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(244, 196, 64, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(244, 196, 64, 0.25);
}

/* ========================================
   AVATARS SECTION
   ======================================== */

.avatars {
    display: flex;
    position: relative;
    z-index: 2;
}

.avatar-frame {
    width: clamp(40px, 8vw, 50px);
    height: clamp(40px, 8vw, 50px);
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(244, 196, 64, 0.6);
    background: linear-gradient(135deg, 
        rgba(244, 196, 64, 0.2), 
        rgba(244, 196, 64, 0.05)
    );
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(244, 196, 64, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-left: clamp(-8px, -2vw, -12px);
    cursor: pointer;
}

/* First avatar doesn't need negative margin */
.avatar-frame:first-child {
    margin-left: 0;
}

/* Avatar image styling */
.avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    filter: brightness(1.1) contrast(1.05);
}

/* Individual avatar hover effects */
.avatar-frame:hover {
    transform: translateY(-2px) scale(1.1);
    border-color: rgba(244, 196, 64, 0.8);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(244, 196, 64, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.avatar-frame:hover img {
    filter: brightness(1.2) contrast(1.1);
}

/* Stacking order for overlapping avatars */
.avatar-frame:nth-child(1) { z-index: 3; }
.avatar-frame:nth-child(2) { z-index: 2; }
.avatar-frame:nth-child(3) { z-index: 1; }

/* ========================================
   STATS DISPLAY SECTION
   ======================================== */

.stats-display {
    display: flex;
    flex-direction: column;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    position: relative;
    z-index: 2;
}

/* Stars rating */
.stars {
    color: var(--color-accent);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    text-shadow: 0 2px 8px rgba(244, 196, 64, 0.5);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    filter: drop-shadow(0 0 3px rgba(244, 196, 64, 0.6));
    transition: all 0.3s ease;
}

/* Individual star hover effect */
.stars:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(244, 196, 64, 0.8));
}

/* Counter display */
.counter {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: var(--color-light);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Highlight the number */
.counter .number {
    color: var(--color-accent);
    font-weight: 700;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    text-shadow: 0 2px 6px rgba(244, 196, 64, 0.4);
    position: relative;
    display: inline-block;
    transition: all 0.3s ease;
}

/* Number hover effect */
.counter:hover .number {
    transform: scale(1.05);
    text-shadow: 0 3px 10px rgba(244, 196, 64, 0.6);
}

/* ========================================
   ANIMATION ENHANCEMENTS
   ======================================== */

/* Floating animation for the entire container */
@keyframes float {
    0%, 100% { 
        transform: translateY(0px);
    }
    50% { 
        transform: translateY(-3px);
    }
}

/* Apply subtle float animation */
.custom-stats {
    animation: float 6s ease-in-out infinite;
}

/* Pulse animation for numbers when they update */
@keyframes numberPulse {
    0% { 
        transform: scale(1);
        color: var(--color-accent);
    }
    50% { 
        transform: scale(1.1);
        color: rgba(244, 196, 64, 0.9);
        text-shadow: 0 0 15px rgba(244, 196, 64, 0.8);
    }
    100% { 
        transform: scale(1);
        color: var(--color-accent);
    }
}

/* Star twinkle animation */
@keyframes starTwinkle {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Apply star animation with staggered delays */
.stars:hover {
    animation: starTwinkle 1.5s ease-in-out;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet styles */
@media (max-width: 768px) {
    .custom-stats {
        flex-direction: column;
        gap: clamp(1rem, 3vw, 1.5rem);
        padding: clamp(1.8rem, 4vw, 2.5rem);
        border-radius: 30px;
        text-align: center;
        min-width: 280px;
    }
    
    .avatars {
        justify-content: center;
        margin-bottom: 0.3rem;
    }
    
    .avatar-frame {
        margin-left: clamp(-6px, -1.5vw, -10px);
    }
    
    .avatar-frame:first-child {
        margin-left: 0;
    }
    
    .stats-display {
        align-items: center;
        text-align: center;
    }
    
    /* Simplify animations on smaller screens */
    .custom-stats {
        animation: none;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .custom-stats {
        gap: 1.3rem;
        padding: 1.5rem 2rem;
        margin: 2rem auto;
        border-radius: 25px;
        min-width: 260px;
    }
    
    .avatar-frame {
        width: 36px;
        height: 36px;
        border-width: 2px;
        margin-left: -6px;
    }
    
    .avatar-frame:first-child {
        margin-left: 0;
    }
    
    .stars {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }
    
    .counter {
        font-size: 0.8rem;
    }
    
    .counter .number {
        font-size: 0.85rem;
    }
    
    /* Remove hover effects on touch devices */
    .custom-stats:hover {
        transform: none;
    }
    
    .avatar-frame:hover {
        transform: none;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .custom-stats {
        padding: 1.2rem 1.5rem;
        gap: 1rem;
        min-width: 240px;
    }
    
    .avatar-frame {
        width: 32px;
        height: 32px;
        margin-left: -4px;
    }
    
    .stars {
        font-size: 0.85rem;
    }
    
    .counter {
        font-size: 0.75rem;
    }
    
    .counter .number {
        font-size: 0.8rem;
    }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

/* Focus states for keyboard navigation */
.custom-stats:focus-within {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
    border-radius: 50px;
}

.avatar-frame:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .custom-stats,
    .avatar-frame,
    .counter .number,
    .stars {
        animation: none !important;
        transition: none !important;
    }
    
    .custom-stats:hover,
    .avatar-frame:hover {
        transform: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-stats {
        border: 2px solid var(--color-accent);
        background: rgba(0, 0, 0, 0.9);
    }
    
    .avatar-frame {
        border-color: var(--color-accent);
    }
    
    .stars,
    .counter .number {
        color: var(--color-accent);
        text-shadow: none;
    }
    
    .counter {
        color: var(--color-light);
    }
}

/* ========================================
   LOADING AND ANIMATION STATES
   ======================================== */

/* Loading state for when numbers are updating */
.custom-stats.loading .counter .number {
    animation: numberPulse 1s ease-in-out infinite;
}

/* Success state when stats are updated */
.custom-stats.updated {
    animation: float 6s ease-in-out infinite, 
               glow 2s ease-in-out;
}

@keyframes glow {
    0% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(244, 196, 64, 0.1);
    }
    50% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(244, 196, 64, 0.3);
    }
    100% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(244, 196, 64, 0.1);
    }
}