* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #f97316;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --radius: 24px;
    --shadow: 0 8px 20px rgba(0,0,0,0.06);
    --transition: 0.3s ease;
}

body {
    font-family: 'Cairo', sans-serif;
    background: radial-gradient(ellipse at top, #fef9c3 0%, #fde047 40%, #7dd3fc 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    direction: rtl;
    color: var(--gray-800);
}

.profile-container {
    width: 100%;
    max-width: 800px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-radius: 35px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

/* الشريط العلوي */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: var(--transition);
}
.back-link:hover { transform: translateX(-5px); }

.profile-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to left, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-placeholder { width: 80px; }

/* بطاقة الملف الشخصي */
.profile-card {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.avatar-large {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 10px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

#profile-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-800);
}

.profile-level {
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 20px;
}

.xp-section {
    background: var(--gray-50);
    border-radius: 20px;
    padding: 15px 20px;
}

.xp-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 8px;
}

.xp-bar-large {
    height: 12px;
    background: #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
}

.xp-fill-large {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 20px;
    transition: width 0.4s ease;
}

/* الإحصائيات */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-icon { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); display: block; }
.stat-label { font-size: 0.85rem; color: var(--gray-600); }

/* الإنجازات */
.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(to left, var(--gray-800), var(--gray-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.achievement-card {
    background: white;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: var(--transition);
}

.achievement-card.unlocked {
    border-color: var(--primary);
    background: #fff7ed;
}

.achievement-card.locked {
    opacity: 0.6;
}

.ach-icon { font-size: 2rem; display: block; margin-bottom: 6px; }
.ach-name { font-weight: 700; font-size: 0.9rem; }

/* زر الخروج */
.logout-btn {
    width: 100%;
    padding: 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Cairo', sans-serif;
}
.logout-btn:hover { background: #fecaca; }

/* تجاوب */
@media (max-width: 500px) {
    .profile-container { padding: 20px; }
    .profile-card { padding: 20px; }
}