/* ============================================
   BADGE SYSTEM STYLES
   ============================================ */

:root {
    --badge-common: #10b981;
    --badge-rare: #3b82f6;
    --badge-epic: #8b5cf6;
    --badge-legendary: #fbbf24;
}

/* ============================================
   BADGE SHOWCASE (Profile & Post Cards)
   ============================================ */

.user-badges-showcase {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.badge-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    cursor: pointer;
}

.badge-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.badge-item i {
    font-size: 0.875rem;
}

.badge-more {
    font-size: 0.75rem;
    color: #7c7c7c;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background: #f0f2f5;
    border-radius: 12px;
}

/* Small author badge next to username */
.author-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.75rem;
    color: white;
    margin-left: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   BADGE COLLECTION PAGE
   ============================================ */

.badge-collection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.badge-card {
    background: white;
    border: 2px solid #edeff1;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}

.badge-card.earned {
    border-color: var(--badge-common);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.badge-card.earned:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.badge-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.badge-card i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--badge-common);
}

.badge-card.earned.rarity-rare i {
    color: var(--badge-rare);
}

.badge-card.earned.rarity-epic i {
    color: var(--badge-epic);
}

.badge-card.earned.rarity-legendary i {
    color: var(--badge-legendary);
    animation: shine 2s infinite;
}

.badge-card h5 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1c1c1c;
}

.badge-card p {
    font-size: 0.85rem;
    color: #7c7c7c;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.badge-rarity {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

.badge-rarity.common {
    background: #d1fae5;
    color: #065f46;
}

.badge-rarity.rare {
    background: #dbeafe;
    color: #1e40af;
}

.badge-rarity.epic {
    background: #ede9fe;
    color: #6b21a8;
}

.badge-rarity.legendary {
    background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
    color: #78350f;
    font-weight: 700;
}

.earned-date {
    display: block;
    font-size: 0.75rem;
    color: #10b981;
    font-weight: 600;
    margin-top: 0.5rem;
}

.locked-text {
    display: block;
    font-size: 0.85rem;
    color: #9ca3af;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Badge earned notification animation */
.badge-earned-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border: 3px solid var(--badge-legendary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideIn 0.5s ease, fadeOut 0.5s ease 4.5s;
    max-width: 300px;
}

.badge-earned-notification .badge-icon {
    font-size: 3rem;
    color: var(--badge-legendary);
    margin-bottom: 0.5rem;
    animation: bounce 1s ease;
}

.badge-earned-notification h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1c1c1c;
    margin-bottom: 0.5rem;
}

.badge-earned-notification p {
    font-size: 0.9rem;
    color: #7c7c7c;
    margin: 0;
}

/* ============================================
   BADGE PROGRESS BARS
   ============================================ */

.badge-progress {
    margin-top: 1rem;
}

.badge-progress-bar {
    background: #e5e7eb;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.badge-progress-fill {
    background: linear-gradient(90deg, var(--badge-common) 0%, var(--badge-rare) 100%);
    height: 100%;
    transition: width 0.5s ease;
}

.badge-progress-text {
    font-size: 0.75rem;
    color: #7c7c7c;
    text-align: center;
}

/* ============================================
   BADGE CATEGORIES
   ============================================ */

.badge-category-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.badge-category-section {
    background: white;
    border: 1px solid #edeff1;
    border-radius: 8px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.badge-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes shine {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-20px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-10px);
    }
}

/* ============================================
   PROFILE BADGE SHOWCASE (Enhanced)
   ============================================ */

.profile-badge-showcase {
    background: linear-gradient(135deg, #f6f7f8 0%, #ffffff 100%);
    border: 2px solid #edeff1;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-badge-showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.profile-badge-showcase-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1c1c1c;
    margin: 0;
}

.view-all-badges-link {
    font-size: 0.85rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.view-all-badges-link:hover {
    color: #764ba2;
}

.profile-badge-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.profile-badge-item {
    background: white;
    border: 2px solid #edeff1;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.profile-badge-item:hover {
    border-color: var(--badge-common);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-badge-item i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.profile-badge-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1c1c1c;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .badge-collection {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .badge-category-grid {
        grid-template-columns: 1fr;
    }
    
    .badge-earned-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .profile-badge-showcase-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .badge-item {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ============================================
   BADGE TOOLTIPS
   ============================================ */

.badge-tooltip {
    position: relative;
}

.badge-tooltip:hover::after {
    content: attr(data-badge-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1c;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.badge-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1c1c1c;
    z-index: 1000;
    margin-bottom: -6px;
}

/* ============================================
   BADGE STATISTICS
   ============================================ */

.badge-stats-card {
    background: white;
    border: 2px solid #edeff1;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.badge-stats-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--badge-legendary);
    margin-bottom: 0.5rem;
}

.badge-stats-label {
    font-size: 1rem;
    color: #7c7c7c;
    font-weight: 600;
}

.badge-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

