/* ============================================
   BADGES & ACHIEVEMENTS STYLES
   ============================================ */

/* Badge Containers */
.showcased-badges,
.earned-badges,
.available-badges {
    margin-bottom: 2rem;
}

.showcased-badges h3,
.earned-badges h3,
.available-badges h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.showcased-badges h3 i {
    color: #ffd700;
}

.earned-badges h3 i {
    color: var(--primary);
}

.available-badges h3 i {
    color: var(--text-secondary);
}

/* Badge Grid */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.badges-grid.showcased {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.badges-grid.locked {
    opacity: 0.8;
}

/* Badge Card */
.badge-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
}

.badge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.badge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.badge-card:hover::before {
    opacity: 1;
}

/* Badge States */
.badge-card.earned {
    border-color: var(--primary);
}

.badge-card.locked {
    opacity: 0.6;
    filter: grayscale(50%);
}

.badge-card.locked:hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

/* Badge Icon */
.badge-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    position: relative;
    background: var(--bg-tertiary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.badge-card.earned .badge-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    animation: badgePulse 2s ease-in-out infinite;
}

.badge-card.locked .badge-icon {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Badge Earned Checkmark */
.badge-earned-checkmark {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: #4caf50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    border: 3px solid var(--bg-secondary);
}

/* Badge Info */
.badge-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.badge-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.badge-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Badge Rarity */
.badge-rarity {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-rarity.rarity-common {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.badge-rarity.rarity-rare {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
}

.badge-rarity.rarity-epic {
    background: rgba(156, 39, 176, 0.2);
    color: #9c27b0;
}

.badge-rarity.rarity-legendary {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.3));
    color: #ffa500;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Rarity Border Colors */
.badge-card.common {
    border-color: #9e9e9e;
}

.badge-card.rare {
    border-color: #2196f3;
}

.badge-card.epic {
    border-color: #9c27b0;
}

.badge-card.legendary {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* Badge Progress */
.badge-progress {
    margin-top: 0.5rem;
}

.badge-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.badge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.badge-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
}

.badge-earned-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Badge Notification */
.badge-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 400px;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateX(450px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 10000;
    border: 2px solid var(--primary);
    cursor: pointer;
}

.badge-notification.show {
    transform: translateX(0);
}

.badge-notification.legendary {
    border-color: #ffd700;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
    animation: legendaryGlow 2s ease-in-out infinite;
}

.badge-notification-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary);
}

.badge-notification-header i {
    font-size: 1.3rem;
    animation: badgeBounce 0.5s ease-in-out;
}

.badge-notification-body {
    display: flex;
    gap: 1rem;
}

.badge-notification-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    animation: badgeUnlockPulse 1s ease-out;
}

.badge-notification-info {
    flex: 1;
}

.badge-notification-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.badge-notification-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.badge-notification-rarity {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Badge Stats Summary */
.badge-stats-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.badge-stats-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.badge-stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
}

.badge-stats-count {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
}

.badge-stats-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.badge-stats-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.badge-stats-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.badge-stats-progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Badge Rarity Stats */
.badge-stats-rarity {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.badge-rarity-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.badge-rarity-item i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.3rem;
}

.badge-rarity-item span {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

.badge-rarity-item small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.badge-rarity-item i.rarity-common {
    color: #9e9e9e;
}

.badge-rarity-item i.rarity-rare {
    color: #2196f3;
}

.badge-rarity-item i.rarity-epic {
    color: #9c27b0;
}

.badge-rarity-item i.rarity-legendary {
    color: #ffd700;
}

/* Mini Badge Showcase */
.mini-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mini-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: help;
    transition: transform 0.2s;
}

.mini-badge:hover {
    transform: scale(1.1);
}

.mini-badge.rare {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.mini-badge.epic {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.mini-badge.legendary {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.no-badges-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Animations */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    }
}

@keyframes badgeUnlockPulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes legendaryGlow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(255, 215, 0, 0.7);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .badges-grid {
        grid-template-columns: 1fr;
    }

    .badge-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .badge-stats-rarity {
        grid-template-columns: repeat(2, 1fr);
    }

    .badge-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .badge-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .badge-notification-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
