/* Custom CSS Properties - Theming */
:root {
    --bg-color: #ffffff;
    --bg-alt: #f4f7f6;
    --text-main: #333333;
    --text-muted: #666666;
    --primary-color: #2563eb; 
    --primary-hover: #1d4ed8;
    --accent-color: #3b82f6;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark Mode Colors (Default) */
.dark {
    --bg-color: #0f172a; 
    --bg-alt: #1e293b; 
    --text-main: #f8fafc; 
    --text-muted: #cbd5e1; 
    --primary-color: #3b82f6; 
    --primary-hover: #60a5fa;
    --accent-color: #2563eb;
    --border-color: #334155; 
    --card-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    text-align: justify;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

a { text-decoration: none; color: var(--primary-color); transition: var(--transition); }
a:hover { color: var(--primary-hover); }
ul { list-style: none; }
p { text-align: justify; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.2; margin-bottom: 1rem; color: var(--text-main); }
.text-primary { color: var(--primary-color); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1.5rem; }
.text-sm { font-size: 0.875rem; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.section { padding: 6rem 0; }
.bg-alt { background-color: var(--bg-alt); }
.section-title { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; position: relative; }
.section-title::after {
    content: ''; display: block; width: 60px; height: 4px;
    background-color: var(--primary-color); margin: 0.5rem auto 0; border-radius: 2px;
}

.navbar {
    position: fixed; top: 0; width: 100%;
    background-color: var(--bg-color); opacity: 0.95;
    z-index: 1000; border-bottom: 1px solid var(--border-color);
}
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 70px; }
.logo { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.nav-links { display: flex; gap: 1rem; }
.nav-links li a { color: var(--text-main); font-weight: 500; }
.nav-links li a:hover { color: var(--primary-color); }

.nav-actions { display: flex; align-items: center; gap: 1rem; }
.lang-switcher { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; font-weight: 600; }
.lang-btn { color: var(--text-muted); transition: var(--transition); text-decoration: none; }
.lang-btn:hover, .lang-btn.active { color: var(--primary-color); }
.lang-separator { color: var(--border-color); user-select: none; }

#theme-toggle { background: none; border: none; color: var(--text-main); font-size: 1.2rem; cursor: pointer; padding: 0.5rem; display: flex; align-items: center; justify-content: center; }
.dark-icon { display: none; }
.light-icon { display: inline-block; }
.dark .dark-icon { display: inline-block; }
.dark .light-icon { display: none; }
.hamburger { display: none; font-size: 1.5rem; cursor: pointer; color: var(--text-main); }

.mobile-menu {
    position: fixed; top: 70px; left: 0; width: 100%;
    background-color: var(--bg-color); padding: 1rem 0;
    transform: translateY(-150%); transition: transform 0.3s ease-in-out;
    z-index: 999; border-bottom: 1px solid var(--border-color);
}
.mobile-menu.active { transform: translateY(0); }
.mobile-menu ul { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.mobile-menu ul li a { color: var(--text-main); font-size: 1.2rem; font-weight: 500; }

.btn {
    display: inline-block; padding: 0.75rem 1.5rem; border-radius: 6px;
    font-weight: 600; cursor: pointer; text-align: center; border: 2px solid transparent;
}
.btn-primary { background-color: var(--primary-color); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); color: #ffffff; }
.btn-outline { background-color: transparent; border-color: var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background-color: var(--primary-color); color: #ffffff; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding-top: 70px; }
.hero-title {
    font-size: 3.5rem; margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-subtitle { font-size: 1.5rem; font-weight: 400; color: var(--text-muted); margin-bottom: 2rem; }
.hero-text { max-width: 800px; margin: 0 auto 3rem; font-size: 1.125rem; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; }

.about-content { display: grid; grid-template-columns: 3fr 2fr; gap: 4rem; align-items: center; }
.about-text p { margin-bottom: 1.5rem; font-size: 1.05rem; color: var(--text-muted); }
.subsection-title { margin: 2rem 0 1.5rem; font-size: 1.5rem; }
.about-image-wrapper {
    position: relative;
    max-width: 280px;
    margin: 0 auto;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animated Glowing Frame Backgrounds */
.about-image-wrapper::before,
.about-image-wrapper::after {
    content: '';
    position: absolute;
    inset: -6px;
    background: linear-gradient(45deg, var(--primary-color), #8b5cf6, var(--accent-color), #3b82f6, var(--primary-color));
    background-size: 400%;
    z-index: -1;
    animation: glowing-frame 10s linear infinite, morph-blob 8s ease-in-out infinite;
}

/* The blurred glow */
.about-image-wrapper::after {
    filter: blur(15px);
    opacity: 0.65;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Hover effects */
.about-image-wrapper:hover::after {
    opacity: 1;
    filter: blur(25px);
}

@keyframes glowing-frame {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

@keyframes morph-blob {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

.profile-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    border: 4px solid var(--bg-color); /* Creates an inner border separating the image from the glow */
    position: relative;
    z-index: 1;
    animation: morph-blob 8s ease-in-out infinite;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.about-image-wrapper:hover .profile-image {
    transform: scale(1.05) translateY(-5px) rotate(2deg);
}

.academic-timeline { border-left: 2px solid var(--primary-color); padding-left: 2rem; position: relative; }
.academic-timeline li { margin-bottom: 2rem; position: relative; }
.academic-timeline li::before {
    content: ''; position: absolute; left: -2.35rem; top: 0.2rem; width: 1rem; height: 1rem;
    background-color: var(--primary-color); border-radius: 50%; border: 3px solid var(--bg-color);
}
.timeline-date { font-weight: 600; color: var(--primary-color); margin-bottom: 0.25rem; }
.timeline-content h4 { margin-bottom: 0.25rem; }
.timeline-content p { color: var(--text-muted); margin-bottom: 0; font-size: 0.95rem; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.skill-card {
    background-color: var(--card-bg); padding: 2.5rem 2rem; border-radius: 12px;
    box-shadow: var(--card-shadow); transition: var(--transition); text-align: center; border: 1px solid var(--border-color);
}
.skill-card:hover { transform: translateY(-5px); box-shadow: var(--hover-shadow); border-color: var(--primary-color); }
.skill-card i { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 1.5rem; }
.skill-card p { color: var(--text-muted); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.project-card {
    background-color: var(--card-bg); padding: 2rem; border-radius: 12px;
    box-shadow: var(--card-shadow); transition: var(--transition); border: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-5px); box-shadow: var(--hover-shadow); }
.project-icon {
    width: 50px; height: 50px; background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color); border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 1.5rem; margin-bottom: 1.5rem;
}
.project-card p { color: var(--text-muted); margin-bottom: 2rem; flex-grow: 1; }
.project-link { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.project-link i { transition: transform 0.3s ease; }
.project-link:hover i { transform: translateX(5px); }

.hub-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem; }
.hub-item {
    background-color: var(--card-bg); padding: 2.5rem; border-radius: 12px;
    border-left: 4px solid var(--primary-color); box-shadow: var(--card-shadow);
}
.hub-item p { color: var(--text-muted); margin-bottom: 1.5rem; }

.dual-column { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; }
.service-list li { margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 1rem; color: var(--text-muted); }
.service-list i { margin-top: 0.25rem; }
.objective-text {
    font-size: 1.1rem; font-style: italic; color: var(--text-muted);
    border-left: 3px solid var(--primary-color); padding-left: 1.5rem; margin-bottom: 2rem;
}

.contact-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
    background-color: var(--card-bg); padding: 3rem; border-radius: 16px;
    box-shadow: var(--card-shadow); border: 1px solid var(--border-color);
}
.contact-info p { color: var(--text-muted); margin-bottom: 2rem; }
.social-links { display: flex; gap: 1.5rem; }
.social-links a {
    width: 45px; height: 45px; background-color: var(--bg-alt); color: var(--text-main);
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    font-size: 1.25rem; transition: var(--transition);
}
.social-links a:hover { background-color: var(--primary-color); color: #ffffff; transform: translateY(-3px); }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.75rem 1rem; background-color: var(--bg-alt);
    border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main);
    font-family: inherit; transition: border-color 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-color); }
.contact-form .btn { width: 100%; }

.footer { background-color: var(--bg-alt); padding: 2rem 0; border-top: 1px solid var(--border-color); }
.footer-content { display: flex; justify-content: space-between; align-items: center; }
.footer p { color: var(--text-muted); font-size: 0.9rem; }
.back-to-top {
    width: 40px; height: 40px; background-color: var(--primary-color); color: #ffffff;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: var(--transition);
}
.back-to-top:hover { background-color: var(--primary-hover); color: #ffffff; transform: translateY(-3px); }

.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s ease; }
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }

/* Dropdown Menu Styles */
.dropdown { position: relative; }
.dropdown-content {
    display: none; position: absolute; background-color: var(--card-bg);
    min-width: 160px; box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color); border-radius: 6px;
    z-index: 1001; top: 100%; left: 0; padding: 0.5rem 0;
}
.dropdown-content li { width: 100%; }
.dropdown-content li a {
    display: block; padding: 0.5rem 1rem; color: var(--text-main); font-weight: 500;
}
.dropdown-content li a:hover { background-color: var(--bg-alt); color: var(--primary-color); }
.dropdown:hover .dropdown-content, .dropdown.open .dropdown-content { display: block; }
.mobile-menu .dropdown-content {
    position: static; box-shadow: none; border: none; background: transparent;
    padding: 0; display: none; padding-left: 1rem; margin-top: 0.5rem;
}
.mobile-menu .dropdown:hover .dropdown-content, .mobile-menu .dropdown.open .dropdown-content { display: flex; flex-direction: column; gap: 0.5rem; }

@media (max-width: 1100px) {
    .logo { font-size: 1.25rem; }
    .nav-links { gap: 0.75rem; }
    .nav-links li a { font-size: 0.9rem; }
}
@media (max-width: 992px) {
    .about-content, .dual-column, .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .about-image-wrapper { order: -1; }
    .hero-title { font-size: 3rem; }
}
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: block; }
    .hero-title { font-size: 2.25rem; }
    .hero-subtitle { font-size: 1.25rem; }
    .section { padding: 4rem 0; }
    .contact-grid { padding: 2rem; }
}
@media (max-width: 576px) {
    .hub-container { grid-template-columns: 1fr; }
    .hero-buttons { flex-direction: column; }
}

/* Arabic Typography & Layout Support */
:lang(ar), [dir="rtl"] {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
    line-height: 1.65;
}

:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) h4, :lang(ar) h5, :lang(ar) h6,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
:lang(ar) .logo, [dir="rtl"] .logo,
:lang(ar) .section-title, [dir="rtl"] .section-title {
    font-family: 'Cairo', 'Inter', sans-serif;
    font-weight: 600;
}
