/* assets/css/sidebar.css - نسخة كاملة ومحدثة مع زر إغلاق على شكل سهم */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: var(--bg-secondary);
    z-index: 1001;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    padding: 25px 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.sidebar-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    margin: 0;
}

/* ===== زر الإغلاق على شكل سهم ===== */
.close-sidebar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.close-sidebar i {
    transition: transform 0.3s ease;
}

.close-sidebar:hover {
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.3);
}

.close-sidebar:hover i {
    transform: rotate(180deg);
}

/* ===== معلومات المستخدم في القائمة الجانبية ===== */
.sidebar-user {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.sidebar-user-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    margin-bottom: 10px;
    transition: var(--transition);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.sidebar-user-name {
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 3px;
}

.sidebar-user-username {
    color: var(--text-muted);
    font-size: 13px;
}

.sidebar-user-badges {
    margin: 5px 0;
}

.sidebar-user-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.sidebar-stat {
    text-align: center;
}

.sidebar-stat-value {
    font-weight: 800;
    font-size: 16px;
}

.sidebar-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== رصيد الماسات ===== */
.sidebar-diamonds {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    padding: 12px 20px;
    margin: 15px 20px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.sidebar-diamonds i {
    font-size: 18px;
}

.sidebar-diamonds .value {
    font-size: 18px;
    font-weight: 800;
}

/* ===== قائمة الروابط ===== */
.sidebar-menu {
    padding: 10px 15px;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    margin-bottom: 5px;
    position: relative;
    overflow: hidden;
}

.sidebar-menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-light);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: -1;
}

.sidebar-menu-item:hover::before {
    transform: translateX(0);
}

.sidebar-menu-item:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
}

.sidebar-menu-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-menu-item i {
    width: 24px;
    font-size: 18px;
    text-align: center;
}

.sidebar-menu-item span {
    flex: 1;
    font-size: 14px;
}

.sidebar-menu-item .badge {
    margin-right: auto;
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 11px;
}

.sidebar-menu-item .badge.gold {
    background: #ffd700;
    color: #000;
}

/* ===== تذييل القائمة الجانبية ===== */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.theme-toggle-sidebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-tertiary);
    border-radius: 30px;
    margin-bottom: 15px;
}

.theme-toggle-sidebar span {
    font-size: 13px;
    font-weight: 500;
}

.theme-toggle-sidebar button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.theme-toggle-sidebar button:hover {
    transform: rotate(15deg);
}

.sidebar-footer-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.sidebar-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: var(--transition);
}

.sidebar-footer-links a:hover {
    color: var(--primary-color);
}

.sidebar-footer-copyright {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== تحسينات للشاشات الصغيرة ===== */
@media (max-width: 480px) {
    .sidebar {
        width: 85%;
    }
    
    .sidebar-user-avatar {
        width: 70px;
        height: 70px;
    }
    
    .sidebar-user-name {
        font-size: 16px;
    }
    
    .sidebar-menu-item {
        padding: 10px 12px;
    }
    
    .sidebar-menu-item i {
        width: 20px;
        font-size: 16px;
    }
    
    .sidebar-menu-item span {
        font-size: 13px;
    }
    
    .sidebar-diamonds {
        padding: 10px 15px;
        margin: 10px 15px;
    }
    
    .sidebar-diamonds .value {
        font-size: 16px;
    }
}

/* ===== تحسينات للشاشات المتوسطة ===== */
@media (min-width: 481px) and (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
}

/* ===== شريط التمرير المخصص للقائمة الجانبية ===== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* ===== تأثيرات إضافية ===== */
.sidebar-menu-item i {
    transition: transform 0.2s ease;
}

.sidebar-menu-item:hover i {
    transform: scale(1.1);
}

.sidebar-diamonds i {
    animation: gemShine 2s infinite;
}

@keyframes gemShine {
    0%, 100% {
        text-shadow: 0 0 2px rgba(0,0,0,0.3);
    }
    50% {
        text-shadow: 0 0 8px rgba(255,215,0,0.8);
    }
}

/* ===== زر الإغلاق عند التمرير ===== */
.close-sidebar:active {
    transform: scale(0.95);
}

/* ===== حالة عدم وجود مستخدم ===== */
.sidebar-user-placeholder {
    text-align: center;
    padding: 30px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-login-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.sidebar-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.sidebar-register-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
}

.sidebar-register-link:hover {
    color: var(--primary-color);
}