/**
 * Main Stylesheet
 * تصميم عصري واحترافي للموقع الشخصي
 */

/* المتغيرات الأساسية */
:root {
    /* لوحة الألوان الجديدة - أزرق ملكي وذهبي */
    --primary-color: #0f2e5a;
    --primary-light: #1e4b8a;
    --secondary-color: #c5a059;
    --secondary-light: #e6c47e;
    --accent-color: #c5a059;
    
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-light: #a0aec0;
    
    --bg-body: #f8f9fa;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-dark: #0a1f3d;
    --bg-overlay: rgba(255, 255, 255, 0.95);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

/* وضع الظلام */
body.dark-mode {
    --primary-color: #3a6ea5;
    --primary-light: #6495ed;
    --secondary-color: #e6c47e;
    --secondary-light: #f0d5a0;
    
    --text-primary: #f0f4f8;
    --text-secondary: #cbd5e0;
    --text-light: #718096;
    
    --bg-body: #1a202c;
    --bg-white: #2d3748;
    --bg-card: #2d3748;
    --bg-dark: #0f1623;
    --bg-overlay: rgba(26, 32, 44, 0.95);
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
}

/* Loading Screen */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-overlay);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader-wrapper.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--primary-color);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* التنسيقات العامة */
body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Fix Card Backgrounds in Dark Mode */
.card {
    background-color: var(--bg-card);
    transition: background-color 0.3s ease;
}

/* Ensure dropdowns are visible in Dark Mode */
.dropdown-menu {
    background-color: var(--bg-white);
    border-color: rgba(0,0,0,0.1);
    box-shadow: var(--shadow-lg);
}

body.dark-mode .dropdown-menu {
    background-color: var(--bg-card);
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .dropdown-item {
    color: var(--text-primary);
}

body.dark-mode .dropdown-item:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--secondary-color);
}

/* Fix Divider in Dark Mode */
body.dark-mode .dropdown-divider {
    border-top-color: rgba(255,255,255,0.1);
}

.stat-card {
    background-color: var(--bg-card);
}


h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

/* تخصيص شريط التمرير */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* شريط التنقل */
.navbar {
    background: rgba(15, 46, 90, 0.98) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--bg-white) !important;
}

.nav-link {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9) !important;
    padding: 0.5rem 0.6rem !important;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    margin: 0 1px;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--secondary-color) !important;
    transform: translateY(-2px);
}

/* قسم البطل (Hero Section) */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--bg-dark) 100%);
    padding: 100px 0;
    color: white;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c5a059' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    max-width: 600px;
}

/* البطاقات */
.card {
    border-radius: var(--radius-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-title {
    color: var(--primary-color);
    font-weight: 700;
}

.card-text {
    color: var(--text-secondary);
}

/* بطاقات الإحصائيات */
.stat-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border-bottom: 4px solid transparent;
}

.stat-card:hover {
    border-bottom-color: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(15, 46, 90, 0.1) 0%, rgba(197, 160, 89, 0.1) 100%);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.1rem;
}

/* الأزرار */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 46, 90, 0.3);
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* العناوين */
.section-title {
    position: relative;
    margin-bottom: 3rem;
    text-align: center;
}

.section-title h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--secondary-color);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* التذييل (Footer) */
.footer {
    background: var(--bg-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 80px 0 30px;
    margin-top: 5rem;
    font-size: 0.95rem;
}

.footer h5 {
    color: var(--bg-white);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 10px;
}

.footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--secondary-color);
}

.footer a {
    color: rgba(255, 255, 255, 0.7);
    display: block;
    margin-bottom: 0.8rem;
}

.footer a:hover {
    color: var(--secondary-color);
    transform: translateX(-5px);
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin-left: 10px;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* الجداول */
.table {
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.table thead {
    background: var(--primary-color);
    color: white;
}

.table-hover tbody tr:hover {
    background-color: rgba(197, 160, 89, 0.05);
}

/* التنبيهات */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    border-right: 4px solid;
}

.alert-success {
    background-color: #f0fff4;
    color: #276749;
    border-color: #48bb78;
}

.alert-danger {
    background-color: #fff5f5;
    color: #c53030;
    border-color: #f56565;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .navbar-collapse {
        background: var(--primary-color);
        padding: 1rem;
        border-radius: var(--radius-sm);
        margin-top: 1rem;
    }

    .stat-card {
        margin-bottom: 1.5rem;
    }
}

/* حركات إضافية */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }

/* تحسينات لوحة التحكم */
.hover-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg) !important;
}

/* تصحيح رأس الجدول الفاتح */
.table thead.table-light {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
}

.table thead.table-light th {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
    font-weight: 700;
}

/* تحسينات إضافية للجداول في الشاشات الصغيرة */
@media (max-width: 768px) {
    .table-responsive {
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-sm);
        margin-bottom: 1rem;
    }
}
