/**
 * Achievements Tab Styles
 * Tier colors: D (gray), C (green), B (blue), A (purple), S (gold)
 */

.achievements-tab-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--text-primary);
}

.achievements-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== ACHIEVEMENT TEXT BANNERS ===== */
.ach-tab-banners {
    margin-bottom: 32px;
}

.ach-tab-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0. 1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-left: 4px solid #8B5CF6;
}

.ach-tab-banner.s-tier {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-left-color: #FFD700;
}

.ach-tab-banner.a-tier {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-left-color: #8B5CF6;
}

.ach-tab-banner-emoji {
    font-size: 24px;
}

.ach-tab-banner-text {
    flex: 1;
    color: var(--text-primary);
}

/* ===== ACHIEVEMENT CARDS ===== */
.achievements-cards-section {
    margin-bottom: 32px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.achievement-card {
    background: rgba(30, 30, 40, 0.5);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Tier borders */
.achievement-card.trophy-tier,
.achievement-card.🏆-tier {
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 217, 0, 0.24) 0%, rgba(48, 48, 48, 0.8) 100%);
}

.achievement-card.s-tier {
    border-color: #8B5CF6;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.achievement-card.a-tier {
    border-color: #3B82F6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.achievement-card.b-tier {
    border-color: #10B981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.achievement-card.c-tier {
    border-color: #6B7280;
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.achievement-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.achievement-card .card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.achievement-card .card-tier-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.achievement-card.trophy-tier .card-tier-badge,
.achievement-card.🏆-tier .card-tier-badge {
    background-color: transparent;
    font-size: 20px;
}

.achievement-card.s-tier .card-tier-badge {
    background-color: #8B5CF6;
}

.achievement-card.a-tier .card-tier-badge {
    background-color: #3B82F6;
}

.achievement-card.b-tier .card-tier-badge {
    background-color: #10B981;
}

.achievement-card.c-tier .card-tier-badge {
    background-color: #6B7280;
}

.achievement-card .card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.achievement-card .card-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 8px;
}

.achievement-card .card-personal-best {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== PERSONAL BESTS SECTION ===== */
.personal-bests-section {
    margin-bottom: 32px;
}

.pb-header {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0.1) 50%, rgba(255, 215, 0, 0.05) 100%);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid #FFD700;
}

.pb-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #FFD700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.pb-card {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.9) 0%, rgba(20, 20, 30, 0.9) 100%);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
}

.pb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.4);
}

.pb-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.pb-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== DEBUG PANEL ===== */
.achievements-debug {
    margin-top: 40px;
    padding: 20px;
    background: rgba(50, 50, 60, 0.6);
    border-radius: 8px;
    border: 2px dashed rgba(150, 150, 150, 0.3);
}

.achievements-debug h3 {
    font-size: 16px;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.achievements-debug h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.debug-section {
    margin-bottom: 20px;
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.debug-table th {
    background: rgba(70, 70, 80, 0.8);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(100, 100, 110, 0.5);
}

.debug-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(80, 80, 90, 0.3);
    color: var(--text-muted);
}

.debug-table tr:hover {
    background: rgba(60, 60, 70, 0.5);
}

.debug-section details summary {
    cursor: pointer;
    padding: 10px;
    background: rgba(60, 60, 70, 0.6);
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 8px;
    transition: background 0.2s ease;
}

.debug-section details summary:hover {
    background: rgba(70, 70, 80, 0.8);
}

.debug-section details pre {
    background: rgba(20, 20, 30, 0.9);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    color: #A0A0B0;
    max-height: 500px;
    overflow-y: auto;
}

/* ===== NO DATA STATE ===== */
.achievements-no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.achievement-card {
    background: rgba(30, 30, 40, 0.5);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-personal-best {
    margin-top: auto;
    /* Push to bottom */
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .pb-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievement-card .card-value {
        font-size: 24px;
    }

    .pb-value {
        font-size: 22px;
    }
}

/* ===== FRIEND COMPARISON ===== */
.achievement-card.has-friends {
    min-height: 180px;
    /* Ensure space for friends */
}

.friend-comparison {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.friend-comparison:hover {
    background: rgba(0, 0, 0, 0.4);
}

.friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(107, 114, 128, 0.5);
    /* Thin gray border */
    flex-shrink: 0;
    object-fit: cover;
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.friend-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.friend-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Friend tier badge */
.friend-tier-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

.friend-tier-badge.trophy-tier,
.friend-tier-badge.🏆-tier {
    background-color: #fff6ced7;
    font-size: 16px;
    color: #000;
    /* Contrast for gold background */
}

.friend-tier-badge.s-tier {
    background-color: #8B5CF6;
}

.friend-tier-badge.a-tier {
    background-color: #3B82F6;
}

.friend-tier-badge.b-tier {
    background-color: #10B981;
}

.friend-tier-badge.c-tier {
    background-color: #6B7280;
}

.friend-tier-badge.d-tier {
    background-color: #4b5563;
}