/**
 * Badge Display Styles for Game Menus
 */

.badge-display-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--game-surface-alt, rgba(15, 23, 42, 0.6));
    border: 2px solid color-mix(in srgb, var(--game-primary, #64748b) 35%, transparent);
    border-radius: var(--menu-radius-lg, 12px);
    box-shadow: var(--game-shadow-card, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.badge-display-section h3 {
    margin: 0 0 1.25rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #F8FAFC;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-display-grid {
    display: grid;
    grid-template-columns: repeat(var(--badge-cols, 5), minmax(0, 1fr)); /* Standard: 5 across on desktop */
    gap: 1.5rem; /* Increased spacing between badges */
    justify-items: center;
}

.badge-display-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: var(--menu-radius-md, 8px);
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: help;
    width: 100%;
    max-width: 140px; /* Increased to prevent name wrapping */
    position: relative;
}

.badge-display-item:hover {
    transform: translateY(-2px);
}

.badge-display-item:hover .badge-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-8px);
}

.badge-display-item.badge-earned {
    opacity: 1;
}

.badge-display-item.badge-unearned {
    opacity: 0.5;
}

.badge-display-image {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-display-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    transition: filter 0.2s ease;
}

.badge-display-image img.badge-greyed {
    filter: grayscale(100%) brightness(0.4);
    opacity: 0.6;
}

.badge-checkmark {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #10B981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.badge-checkmark i {
    color: white;
    font-size: 14px;
}

.badge-display-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--game-text-muted, #94A3B8);
    text-align: center;
    line-height: 1.3;
    white-space: nowrap; /* Prevent name from splitting across lines */
    overflow: hidden;
    text-overflow: ellipsis; /* Show ellipsis if name is too long */
    width: 100%;
}

.badge-display-item.badge-earned .badge-display-name {
    color: #E2E8F0;
}

.badge-display-empty {
    text-align: center;
    color: var(--game-text-muted, #94A3B8);
    padding: 2rem;
    font-style: italic;
}

/* Badge Tooltip */
.badge-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 1000;
    text-align: left;
}

.badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(15, 23, 42, 0.98);
}

.badge-tooltip-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #F8FAFC;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.badge-tooltip-description {
    font-size: 0.8rem;
    color: var(--game-text-muted, #94A3B8);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.badge-tooltip-status {
    font-size: 0.75rem;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-tooltip-status i {
    font-size: 0.7rem;
}

.badge-tooltip-status.badge-tooltip-locked {
    color: #94A3B8;
}

/* Adjust tooltip position for items near edges */
.badge-display-item:nth-child(1) .badge-tooltip,
.badge-display-item:nth-child(2) .badge-tooltip {
    left: 0;
    transform: translateX(0) translateY(-4px);
}

.badge-display-item:nth-child(1) .badge-tooltip::after,
.badge-display-item:nth-child(2) .badge-tooltip::after {
    left: 20px;
    transform: translateX(0);
}

.badge-display-item:nth-last-child(1) .badge-tooltip,
.badge-display-item:nth-last-child(2) .badge-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(-4px);
}

.badge-display-item:nth-last-child(1) .badge-tooltip::after,
.badge-display-item:nth-last-child(2) .badge-tooltip::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .badge-display-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem; /* Increased spacing on mobile too */
    }

    .badge-display-image {
        width: 60px;
        height: 60px;
    }

    .badge-display-item {
        max-width: 100px; /* Slightly smaller on mobile but still prevents wrapping */
    }

    .badge-display-name {
        font-size: 0.7rem;
        white-space: nowrap; /* Prevent wrapping on mobile too */
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .badge-display-section {
        padding: 1rem;
    }
}

