/**
 * High-End Modern Portfolio - Complete Design Overhaul
 * With Glassmorphism, Gradients, Animations & FontAwesome Icons
 */

/* ========== CSS Variables ========== */
:root {
    /* Dynamic Colors from Database */
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;

    /* Color Palette */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-alt: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);

    /* Typography - Cairo Font */
    --font-primary: 'Cairo', 'Segoe UI', Tahoma, sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

/* Dark Mode */
[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-alt: #374151;
    --border-color: #4b5563;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

/* ========== Reset & Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-fast);
}

ul {
    list-style: none;
}

/* ========== Container ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all var(--transition-normal);
}

[data-theme="dark"] .navbar {
    background: rgba(17, 24, 39, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar.scrolled {
    box-shadow: 0 4px 20px var(--shadow);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: width var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.theme-toggle {
    background: var(--bg-alt);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* ========== Hero Section ========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl) 0;
    margin-top: 70px;
    position: relative;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    overflow: hidden;
}

/* Hero Background Shapes */
.hero-bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    bottom: -150px;
    left: -150px;
    animation: float 15s ease-in-out infinite reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 25s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Two Column Layout with Image */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    align-items: center;
}

.hero-text {
    text-align: right;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
}

.gradient-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

/* Hero Image with Floating Animation */
.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.image-wrapper.floating {
    animation: floatImage 6s ease-in-out infinite;
}

@keyframes floatImage {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 10px rgba(99, 102, 241, 0.1);
    position: relative;
    z-index: 2;
    transition: all 0.5s ease;
}

.image-wrapper img:hover {
    border-radius: 40% 60% 70% 30% / 40% 70% 30% 60%;
    transform: scale(1.05);
}

.image-wrapper::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    z-index: 1;
    opacity: 0.2;
    animation: morphBlob 8s ease-in-out infinite;
}

@keyframes morphBlob {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
    75% { border-radius: 60% 30% 60% 50% / 60% 40% 60% 30%; }
}

/* Centered Layout without Image */
.hero-centered-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-centered .hero-buttons {
    justify-content: center;
}

/* Social Links */
.social-links {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-start;
}

.hero-centered .social-links {
    justify-content: center;
}

.social-link {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    font-size: 1.2rem;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.social-link:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 25px var(--shadow);
}

/* Social Media Brand Colors */
.social-link.facebook:hover { background: #1877f2; color: white; border-color: #1877f2; }
.social-link.twitter:hover { background: #1da1f2; color: white; border-color: #1da1f2; }
.social-link.linkedin:hover { background: #0077b5; color: white; border-color: #0077b5; }
.social-link.github:hover { background: #333; color: white; border-color: #333; }
.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border-color: #bc1888;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-normal);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-outline {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn i, .btn span { position: relative; z-index: 1; }

/* ========== Sections ========== */
.section {
    padding: var(--spacing-2xl) 0;
    position: relative;
}

.section-alt { background-color: var(--bg-secondary); }

.section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: var(--text-primary);
    position: relative;
    display: block;
    width: 100%;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 2px;
    background: var(--primary-color);
    margin: var(--spacing-sm) auto 0;
    border-radius: 2px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xl);
}

/* ========== Skills Section ========== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    max-width: 900px;
    margin: 0 auto;
}

.skill-item {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .skill-item {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-lg);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.skill-name {
    font-weight: 600;
    color: var(--text-primary);
}

.skill-percentage {
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.skill-bar {
    height: 10px;
    background: var(--bg-alt);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 1.5s ease;
    position: relative;
    overflow: hidden;
}

.skill-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========== Services Section ========== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.service-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--spacing-xl);
    border-radius: var(--radius-2xl);
    text-align: center;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .service-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.service-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
}

.service-card:hover::before { left: 100%; }
.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px var(--shadow-lg);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.service-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.service-description {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ========== Projects Section ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.project-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .project-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px var(--shadow-lg);
}

.project-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image:empty::before,
.project-image img[src=""]::before,
.project-image img:not([src])::before {
    content: '\f03e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 4rem;
    color: var(--primary-color);
    opacity: 0.3;
}

.project-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.project-card:hover .project-image::after { opacity: 0.3; }

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project-card:hover .project-image img { transform: scale(1.1); }

.project-content { padding: var(--spacing-md); }

.project-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.project-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.project-link {
    color: var(--primary-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.project-link:hover {
    color: var(--secondary-color);
    transform: translateX(-5px);
}

/* ========== OLD Timeline ========== */
.timeline {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    right: 50%;
    transform: translateX(50%);
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
}
.timeline-item {
    margin-bottom: var(--spacing-xl);
    position: relative;
    padding-right: calc(50% + 40px);
}
.timeline-item:nth-child(even) {
    padding-right: 0;
    padding-left: calc(50% + 40px);
}
.timeline-marker {
    position: absolute;
    right: 50%;
    transform: translateX(50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: 4px solid var(--bg-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    z-index: 2;
}
.timeline-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
}
[data-theme="dark"] .timeline-content {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.timeline-content:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px var(--shadow-lg);
}

/* =========================================================================
   NEW CV & RESUME TIMELINE (القسم الجديد للخبرات والتعليم والنافذة المنبثقة)
   ========================================================================= */
.cv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.cv-column-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: right;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cv-column-title i {
    color: var(--primary-color);
}

.cv-timeline {
    position: relative;
    padding-right: 30px;
}

.cv-timeline::before {
    content: '';
    position: absolute;
    right: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.cv-item {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: var(--radius-xl);
    margin-bottom: 25px;
    box-shadow: 0 4px 15px var(--shadow);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .cv-item {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cv-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-lg);
    border-color: var(--primary-color);
}

.cv-marker {
    position: absolute;
    right: -31px;
    top: 25px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 4px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--primary-color);
    transition: all var(--transition-normal);
}

.cv-item:hover .cv-marker {
    background-color: var(--secondary-color);
    box-shadow: 0 0 0 2px var(--secondary-color);
}

.cv-year {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.cv-title {
    font-size: 1.25rem;
    margin: 0 0 5px;
    color: var(--text-primary);
    font-weight: 700;
}

.cv-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
}

.click-hint {
    display: block;
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.cv-item:hover .click-hint {
    color: var(--primary-color);
}

/* CV Modal (النافذة المنبثقة) */
/* =========================================
/* =========================================
   تنسيق الصورة المصغرة (Thumbnail) الصلب والقاطع
   ========================================= */

/* الحاوية الداخلية للبطاقة */
.cv-item-inner {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 20px !important;
    width: 100% !important;
}

/* جزء النص */
.cv-text-content {
    flex: 1 1 auto !important; /* يأخذ المساحة المتاحة ويضغط على النص المرتفع */
    min-width: 0 !important;
    text-align: right !important; /* تأكيد المحاذاة لليمين للغة العربية */
}

/* مربع الصورة المصغرة (الأيقونة) */
.cv-item .cv-image-thumb {
    /* تحديد الحجم بشكل صارم وقاطع 70x70 بيكسل */
    display: block !important;
    width: 70px !important;
    height: 70px !important;
    
    /* منع الانضغاط أو التمدد */
    flex: 0 0 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    min-height: 70px !important;
    max-height: 70px !important;

    /* تنسيق المظهر */
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 2px solid #e5e7eb !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    background-color: #ffffff !important;
    transition: transform var(--transition-normal), border-color var(--transition-normal) !important;
}

/* الصورة داخل المربع */
.cv-item .cv-image-thumb img {
    /* فرض الحجم الكامل للمربع */
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    
    /* اقتطاع الصورة بذكاء لتملأ المربع */
    object-fit: cover !important; 
    object-position: center !important;
    display: block !important;
}

/* تأثير عند مرور الماوس على البطاقة */
.cv-item:hover .cv-image-thumb {
    transform: scale(1.1) rotate(-5deg) !important;
    border-color: var(--primary-color) !important;
}

/* =========================================
   CV Modal (النافذة المنبثقة للشهادات والتفاصيل)
   ========================================= */
.cv-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    padding: 20px; /* إضافة مسافة آمنة للشاشات الصغيرة */
}

.cv-modal.show {
    display: flex;
    opacity: 1;
}

.cv-modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-2xl);
    padding: 40px 30px 30px;
    width: 100%; /* تعديل ليناسب الموبايل */
    max-width: 650px;
    position: relative;
    transform: translateY(-30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* تأثير ظهور أكثر مرونة واحترافية */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .cv-modal-content {
    background-color: var(--bg-secondary);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.cv-modal.show .cv-modal-content {
    transform: translateY(0) scale(1);
}

/* تخصيص شريط التمرير داخل النافذة */
.cv-modal-content::-webkit-scrollbar {
    width: 6px;
}
.cv-modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.cv-modal-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}
[data-theme="dark"] .cv-modal-content::-webkit-scrollbar-thumb {
    background-color: #4b5563;
}

/* زر الإغلاق الاحترافي */
.cv-modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-alt);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: all var(--transition-fast);
    z-index: 10;
}

.cv-modal-close:hover {
    background-color: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg) scale(1.1); /* تأثير دوران وتكبير خفيف */
}

/* نصوص النافذة المنبثقة */
.badge-year {
    display: inline-block;
    margin-bottom: 15px;
    padding: 5px 15px;
    background: var(--bg-alt);
    border-radius: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.modal-title {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 800;
    line-height: 1.3;
}

.modal-subtitle {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.modal-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 25px;
}

/* حاوية الصورة / الشهادة داخل النافذة المنبثقة */
.modal-image-container {
    text-align: center;
    margin-top: 20px;
    border-top: 1px dashed var(--border-color);
    padding-top: 25px;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 60vh; /* مساحة ممتازة للشهادة */
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 25px var(--shadow);
    display: block;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

/* تكبير الشهادة قليلاً عند تمرير الماوس داخل النافذة المنبثقة */
.modal-image-container img:hover {
    transform: scale(1.02);
}

/* =========================================
   تجاوبية النافذة المنبثقة لشاشات الموبايل
   ========================================= */
@media (max-width: 768px) {
    .cv-modal-content {
        padding: 40px 20px 20px;
    }
    .modal-title {
        font-size: 1.4rem;
    }
    .modal-subtitle {
        font-size: 1rem;
    }
    .modal-image-container img {
        max-height: 45vh; /* تقليل الارتفاع في الموبايل لتجنب التمرير الطويل */
    }
}
/* ========== Blog Section ========== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.blog-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .blog-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px var(--shadow-lg);
}

.blog-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-image:empty::before,
.blog-image img[src=""]::before,
.blog-image img:not([src])::before {
    content: '\f15c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.3;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.blog-card:hover .blog-image img { transform: scale(1.1); }
.blog-content { padding: var(--spacing-md); }
.blog-date {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.blog-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.blog-read-more {
    color: var(--primary-color);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.blog-read-more:hover {
    color: var(--secondary-color);
    transform: translateX(-5px);
}

/* ========== Contact Section ========== */
.contact-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    max-width: 900px;
    margin: 0 auto;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.contact-item {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-normal);
}

[data-theme="dark"] .contact-item {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 8px 25px var(--shadow-lg);
}

.contact-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.contact-item h4 {
    font-size: 1rem;
    margin-bottom: var(--spacing-xs);
}

.contact-item a {
    color: var(--primary-color);
    font-weight: 600;
}

.contact-form {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-xl);
    border-radius: var(--radius-2xl);
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .contact-form {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group { margin-bottom: var(--spacing-md); }

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }

/* ========== Footer ========== */
.footer {
    background: var(--bg-alt);
    padding: var(--spacing-xl) 0;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}
.footer-social {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-md);
}

/* ========== Utility Classes ========== */
.section-header-with-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}
.text-center { text-align: center; }
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    background: var(--bg-alt);
    color: var(--text-primary);
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        right: 0;
        left: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: var(--spacing-md);
        box-shadow: 0 4px 20px var(--shadow);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
        z-index: 999;
        border-bottom: 3px solid var(--primary-color);
    }
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-link {
        padding: var(--spacing-sm);
        border-bottom: 1px solid var(--border-color);
    }
    .nav-link:last-child { border-bottom: none; }
    .mobile-menu-toggle { display: flex; }
    
    .mobile-menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .mobile-menu-toggle.active span:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    .hero-text { text-align: center; }
    .hero-buttons { justify-content: center; }
    .social-links { justify-content: center; }

    .timeline::before { right: 20px; transform: none; }
    .timeline-item, .timeline-item:nth-child(even) {
        padding-right: 0;
        padding-left: 50px;
    }
    .timeline-marker { right: 11px; transform: none; }

    /* New CV Mobile Settings */
    .cv-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Page Content Styles ========== */
.page-content {
    min-height: 60vh;
    padding: var(--spacing-2xl) 0;
    margin-top: 70px;
}
.breadcrumb {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    margin-bottom: var(--spacing-xl);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.breadcrumb a { color: var(--primary-color); }
.breadcrumb a:hover { color: var(--secondary-color); }

.page-header-section {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}
.page-main-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}
.page-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* ========== PROJECT DETAIL PAGE ========== */
.project-hero-parallax {
    position: relative;
    height: 60vh !important;
    min-height: 400px !important;
    background-size: cover !important;
    background-position: center !important;
    background-attachment: fixed;
    background-repeat: no-repeat !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl) 0;
}

.project-hero-overlay .container {
    position: relative;
    z-index: 2;
    text-align: center;
}

.project-hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    color: white;
    margin-bottom: var(--spacing-md);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.project-hero-category {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.project-hero-simple {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: var(--spacing-2xl) 0;
    text-align: center;
    margin-top: 70px;
}

.project-hero-simple .project-hero-title { color: white; }
.project-hero-simple .project-hero-category { background: rgba(255, 255, 255, 0.2); color: white; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    transition: all var(--transition-fast);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.project-content-section { padding: var(--spacing-2xl) 0; }
.project-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-2xl);
    align-items: start;
}

.project-main-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .project-main-content {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-heading {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.project-sidebar { position: sticky; top: 100px; }
.sidebar-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 20px var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .sidebar-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.sidebar-item i { font-size: 1.25rem; color: var(--primary-color); margin-top: 2px; }
.sidebar-item div { flex: 1; }
.sidebar-label { display: block; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.sidebar-value { display: block; font-weight: 600; color: var(--text-primary); }

/* ========== BLOG POST DETAIL PAGE ========== */
.post-header-section {
    padding: calc(70px + var(--spacing-2xl)) 0 var(--spacing-xl) 0;
    background: var(--bg-secondary);
}

.post-header-section .back-link {
    color: var(--text-primary);
    background: var(--bg-primary);
    border-color: var(--border-color);
}

.post-header-content { max-width: 800px; margin: 0 auto; text-align: center; }
.post-main-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
    color: var(--text-primary);
}

.post-meta-chips {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--spacing-md);
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .meta-chip {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-featured-image { padding: var(--spacing-xl) 0; }
.featured-image-wrapper {
    max-width: 900px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 10px 40px var(--shadow-lg);
}

.post-article-section { padding: var(--spacing-xl) 0; }
.post-article-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.125rem;
    line-height: 1.9;
    color: var(--text-primary);
}

.post-share-section {
    padding: var(--spacing-2xl) 0;
    background: var(--bg-secondary);
}

.share-buttons-modern {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    box-shadow: 0 2px 10px var(--shadow);
}

[data-theme="dark"] .share-btn-modern {
    background: rgba(31, 41, 55, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.share-btn-modern:hover { transform: translateY(-3px); box-shadow: 0 6px 20px var(--shadow-lg); }

/* ========== RESPONSIVE DESIGN FOR DETAIL PAGES ========== */
@media (max-width: 992px) {
    .project-layout { grid-template-columns: 1fr; }
    .project-sidebar { position: static; }
}

@media (max-width: 768px) {
    .project-hero-title { font-size: 2rem; }
    .post-main-title { font-size: 1.75rem; }
    .share-buttons-modern { flex-direction: column; align-items: stretch; }
    .share-btn-modern { justify-content: center; }
}

/* ========== ABOUT SECTION ========== */
.about-content { max-width: 900px; margin: 0 auto; }
.about-content p {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 20px;
}
.about-content strong, .about-content b { color: var(--primary-color); font-weight: 700; }
.about-content h3, .about-content h4 {
    margin-top: 30px; margin-bottom: 15px; color: var(--text-primary); font-weight: 700;
}
.about-content h3 { font-size: 1.5rem; }
.about-content h4 { font-size: 1.25rem; }

/* ========== Print Styles ========== */
@media print {
    .navbar, .footer, .btn, .social-links, .cv-modal { display: none; }
}