/* ── Achievements Sidebar ── */
.achievements-sidebar {
    position: fixed;
    top: 0;
    inset-inline-end: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-2);
    backdrop-filter: blur(20px);
    border-inline-start: 1px solid var(--border);
    z-index: 2000;
    transition: inset-inline-end 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.5);
}

[dir="rtl"] .achievements-sidebar {
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
}

.achievements-sidebar.open {
    inset-inline-end: 0;
}

.sidebar-header {
    padding: 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text);
}

.sidebar-close {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--bg-3);
    color: var(--accent);
}

.sidebar-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Sidebar Custom Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* XP Section */
.xp-section {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

.xp-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.xp-label span {
    color: var(--accent);
    margin-inline-start: 4px;
}

.xp-bar {
    height: 10px;
    background: var(--surface);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}

.xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-needed {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Badges Grid */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.badge-card {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0.5;
    filter: grayscale(1);
    position: relative;
    overflow: hidden;
}

.badge-card.unlocked {
    opacity: 1;
    filter: grayscale(0);
    border-color: var(--accent);
}

.badge-card.gold.unlocked { border-color: #ffd700; }
.badge-card.silver.unlocked { border-color: #c0c0c0; }
.badge-card.bronze.unlocked { border-color: #cd7f32; }

.badge-card i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    color: var(--text-dim);
}

.badge-card.unlocked i {
    color: var(--accent);
}

.badge-card h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.badge-card p {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Achievement Toggle in Header */
.ach-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.ach-toggle:hover {
    color: #ffd700;
    background: var(--bg-3);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

/* Achievement Toast */
.achievement-toast {
    position: fixed;
    top: 100px;
    inset-inline-end: 30px;
    z-index: 1000;
    background: var(--bg-2);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(108,99,255,0.3);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

[dir="rtl"] .achievement-toast {
    transform: translateX(-400px);
}

.achievement-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .achievements-sidebar {
        width: 100%;
        inset-inline-end: -100%;
    }
    
    .badges-grid {
        grid-template-columns: 1fr;
    }
}
