 :root {
    /* Color Palette - Modern & Professional */
    --primary: #8B5CF6;
    --primary-dark: #7C3AED;
    --primary-light: #A78BFA;
    --primary-soft: rgba(139, 92, 246, 0.1);
    
    --secondary: #1E293B;
    --secondary-light: #334155;
    
    --accent: #F472B6;
    --accent-dark: #EC4899;
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    --bg-light: #FAFAFE;
    --bg-white: #FFFFFF;
    --bg-gray: #F1F5F9;
    
    --text-main: #1E293B;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    
    --border-color: #E2E8F0;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    --gradient-accent: linear-gradient(135deg, #F472B6 0%, #EC4899 100%);
    --gradient-surface: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-primary: 0 10px 15px -3px rgba(139, 92, 246, 0.3);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Fonts */
    --font-main: 'Cairo', sans-serif;
    
    /* Sidebar */
    --sidebar-width: 300px;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--sidebar-width)); /* Default hidden to the right (RTL) */
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-white);
    z-index: 2000;
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-normal), left var(--transition-normal);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    overflow-y: auto; /* تمكين التمرير */
    scrollbar-width: thin; /* لمتصفحات فايرفوكس */
    scrollbar-color: var(--primary-light) transparent;
}

/* تحسين مظهر شريط التمرير للقائمة الجانبية */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

[dir="ltr"] .sidebar {
    right: auto;
    left: calc(-1 * var(--sidebar-width));
    border-left: none;
    border-right: 1px solid var(--border-color);
}

.sidebar.active {
    right: 0;
}

[dir="ltr"] .sidebar.active {
    left: 0;
    right: auto;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar-user {
    background: var(--primary-soft);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    border: 1px solid var(--primary-light);
}

.sidebar-user-avatar {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-user-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.sidebar-user-welcome {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-close {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    background: var(--bg-gray);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--danger);
    color: white;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    color: var(--text-main);
    transition: var(--transition-fast);
}

.sidebar-link i {
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    transform: translateX(-5px);
}

[dir="ltr"] .sidebar-link:hover {
    transform: translateX(5px);
}

.sidebar-link.logout {
    margin-top: auto;
    color: var(--danger);
}

.sidebar-link.logout i {
    color: var(--danger);
}

.sidebar-link.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.menu-toggle {
    display: none; /* Hidden by default on desktop */
    background: var(--bg-gray);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition-fast);
    border: 1px solid var(--border-color);
}

@media (max-width: 992px) {
    .menu-toggle {
        display: flex; /* Show on mobile */
    }
}

.menu-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Language Toggle Global */
.lang-switcher-global {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-gray);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 700;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.lang-switcher-global:hover {
    border-color: var(--primary);
    background: var(--bg-white);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-light: #0F172A;
    --bg-white: #1E293B;
    --bg-gray: #334155;
    
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --text-light: #64748B;
    
    --border-color: #334155;
    
    --gradient-surface: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

button, input, select, textarea {
    font-family: inherit;
}

/* Layout Containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 5rem 0;
}

/* Header & Navigation */
.header {
    background: rgba(var(--bg-white), 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.user-profile-btn {
    width: 45px;
    height: 45px;
    background: var(--bg-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    .user-profile-btn {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    .menu-toggle {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
}

.user-profile-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    transform: scale(1.05);
}

.header-container {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 4px 6px rgba(139, 92, 246, 0.2));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-link.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -5px rgba(139, 92, 246, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-soft);
    transform: translateY(-3px);
}

.btn-ghost {
    background: var(--bg-gray);
    color: var(--text-main);
}

.btn-ghost:hover {
    background: var(--border-color);
}

.btn-full {
    width: 100%;
}

.btn-round {
    border-radius: var(--radius-full);
}

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-main);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* Hero Section Styles */
.hero {
    background: var(--gradient-primary);
    color: white;
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    font-weight: 900;
    margin-bottom: 1.5rem;
}

.hero-desc {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 3rem;
    max-width: 600px;
}

/* Custom Utilities */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Settings Page Responsiveness */
.settings-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .settings-nav {
        display: none;
    }
}
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.flex {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-column {
    flex-direction: column;
}

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Responsive Adjustments */
@media (max-width: 992px) {
    .nav-menu {
        display: none;
    }
    .grid-4, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 3rem;
    }
    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .hero-desc {
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .grid-4, .grid-3 {
        grid-template-columns: 1fr;
    }
    .section {
        padding: 3rem 0;
    }
    .hero {
        padding: 4rem 0;
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2rem;
    }
    .footer-logo {
        justify-content: center;
    }
    .footer-social {
        justify-content: center;
    }
    .header-container {
        height: 70px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    .btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
    }
    .container {
        padding: 0 1rem;
    }
}

/* Fix for Button Group in Settings */
.btn-group {
    display: flex;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    flex: 1;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

[dir="rtl"] .btn-group .btn:first-child {
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

[dir="rtl"] .btn-group .btn:last-child {
    border-radius: var(--radius-full) 0 0 var(--radius-full);
}
