/* =============== CSS VARIABLES =============== */
:root {
    /* Light Theme */
    --bg-color: #ffffff;
    --bg-alt: #f8f9fa;
    --text-main: #1a1a1a;
    --text-muted: #6c757d;
    --primary: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3f37c9;
    --secondary: #f72585;
    --card-bg: #ffffff;
    --border-color: #e9ecef;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 40px rgba(67, 97, 238, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --success: #2ecc71;
    --danger: #e74c3c;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #0f172a;
    --bg-alt: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --secondary: #ec4899;
    --card-bg: #1e293b;
    --border-color: #334155;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 40px rgba(59, 130, 246, 0.2);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* =============== BASE & TYPOGRAPHY =============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

/* Arabic Font */
html[dir="rtl"] body {
    font-family: 'Cairo', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 6rem 0;
}

.bg-alt {
    background-color: var(--bg-alt);
}

.text-center {
    text-align: center;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.section-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: -1.5rem auto 3rem auto;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

/* =============== BUTTONS =============== */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 2px solid var(--primary);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.btn-outline {
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* =============== ANIMATED PARTICLES BACKGROUND =============== */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: var(--bg-color);
    transition: background-color 0.4s ease;
}

/* =============== FLOATING CONTROLS =============== */
.floating-whatsapp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    animation: bounce 2s infinite;
}

html[dir="rtl"] .floating-whatsapp {
    right: auto;
    left: 30px;
}

.floating-whatsapp:hover {
    transform: scale(1.1);
    background: #128C7E;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--glass-bg);
    color: var(--text-main);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.control-btn:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--primary);
}

/* =============== NAVIGATION =============== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 0;
    z-index: 999;
    transition: all 0.4s ease;
}

.navbar.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links li a {
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-main);
    transition: color 0.3s ease;
    position: relative;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background: var(--primary);
    transition: width 0.3s ease;
}

html[dir="rtl"] .nav-links li a::after {
    left: auto;
    right: 0;
}

.nav-links li a:hover::after {
    width: 100%;
}

.nav-links li a:hover {
    color: var(--primary);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

/* =============== HERO SECTION =============== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 5rem;
    position: relative;
    overflow: hidden;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-role {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-main);
    margin-bottom: 2.5rem;
    max-width: 500px;
    opacity: 0.9;
}

.hero-ctas {
    display: flex;
    gap: 1.5rem;
}

.hero-image {
    position: relative;
}

.profile-animation-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.profile-animation {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 50%;
    padding: 8px;
    /* Gap between image and gradient ring */
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    animation: floatingProfile 6s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 15px 40px rgba(67, 97, 238, 0.4);
    z-index: 2;
}

.profile-animation::before {
    content: '';
    position: absolute;
    inset: -6px;
    /* Size of the glow */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary-light));
    background-size: 200% 200%;
    animation: spinGradient 4s linear infinite;
    z-index: -1;
    filter: blur(12px);
    opacity: 0.8;
}

.profile-animation img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 6px solid var(--bg-color);
    /* Ring inside the gradient background */
    position: relative;
    z-index: 1;
}

@keyframes floatingProfile {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes spinGradient {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* =============== STATS SECTION =============== */
.stats-section {
    padding: 3rem 0 6rem 0;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 2.5rem 1.5rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.stat-card p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

/* =============== ABOUT SECTION =============== */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.about-text.highlight {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin-top: 2rem;
}

html[dir="rtl"] .about-text.highlight {
    border-left: none;
    border-right: 4px solid var(--primary);
    padding-left: 0;
    padding-right: 1.5rem;
}

/* =============== SERVICES SECTION =============== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.service-card {
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    background: linear-gradient(135deg, var(--card-bg), var(--bg-alt));
    border-color: var(--primary);
}

.service-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem auto;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.service-card:hover .service-icon {
    background: var(--primary);
    color: #fff;
    transform: rotateY(360deg);
}

.service-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* =============== SKILLS SECTION =============== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

.skill-category {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.skill-category h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.skill-list li {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
}

.skill-list li span {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.bar {
    width: 100%;
    height: 8px;
    background: var(--bg-alt);
    border-radius: 10px;
    overflow: hidden;
}

.bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    width: 0;
    /* Animated later via JS or inline styles */
    transition: width 1.5s ease;
}

/* =============== PROJECTS SECTION =============== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.project-img-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.project-card:hover .project-img {
    transform: scale(1.1);
}

.project-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover .project-img-wrapper::after {
    opacity: 1;
}

.project-info {
    padding: 2rem;
    text-align: center;
}

.project-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* =============== BEFORE / AFTER SECTION =============== */
.ba-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.ba-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.ba-img-wrapper {
    position: relative;
    height: 300px;
}

.ba-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ba-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

html[dir="rtl"] .ba-badge {
    left: auto;
    right: 20px;
}

.label-before {
    background: var(--danger);
}

.label-after {
    background: var(--success);
}

.ba-content {
    padding: 2rem;
}

.ba-content h4 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.ba-content ul li {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

/* =============== EXPERIENCE SECTION =============== */
.exp-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.timeline {
    position: relative;
    border-left: 2px solid var(--border-color);
    padding-left: 2rem;
    margin-left: 1rem;
}

html[dir="rtl"] .timeline {
    border-left: none;
    border-right: 2px solid var(--border-color);
    padding-left: 0;
    padding-right: 2rem;
    margin-left: 0;
    margin-right: 1rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2.4rem;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 4px solid var(--bg-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
}

html[dir="rtl"] .timeline-dot {
    left: auto;
    right: -2.45rem;
}

.timeline-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.timeline-item h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.timeline-item ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

html[dir="rtl"] .timeline-item ul {
    padding-left: 0;
    padding-right: 1.5rem;
}

.timeline-item ul li {
    margin-bottom: 0.5rem;
}

.timeline-item p {
    color: var(--text-muted);
}

/* =============== CAREER OBJECTIVE =============== */
.career-section {
    position: relative;
    overflow: hidden;
}

.career-section::before {
    content: '"';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 15rem;
    color: var(--primary);
    opacity: 0.05;
    font-family: serif;
    line-height: 0;
}

.objective-text {
    font-size: 2rem;
    line-height: 1.5;
    font-style: italic;
    font-weight: 300;
    max-width: 900px;
    margin: 0 auto 2rem auto;
    position: relative;
    z-index: 1;
}

.signature {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* =============== FOOTER =============== */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 5rem 0 2rem 0;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 4rem;
}

.footer-col h4 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer-col .logo {
    margin-bottom: 1rem;
    display: inline-block;
}

.footer-col p {
    color: var(--text-muted);
}

.contact-links li {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.contact-links li i {
    color: var(--primary);
}

.contact-links li a:hover {
    color: var(--primary);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-5px);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

.back-to-top {
    width: 40px;
    height: 40px;
    background: var(--bg-alt);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.back-to-top:hover {
    background: var(--primary);
    color: #fff;
}

/* =============== ANIMATIONS =============== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.appear {
    opacity: 1;
    transform: translateY(0);
}

/* =============== RESPONSIVE =============== */
@media (max-width: 992px) {

    .grid-2,
    .ba-grid,
    .exp-wrapper {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        text-align: center;
        padding-top: 8rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-desc {
        margin: 0 auto 2.5rem auto;
    }

    .hero-ctas {
        justify-content: center;
    }

    .footer-top {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .contact-links li {
        justify-content: center;
    }

    .social-icons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 80px;
        right: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--bg-color);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transition: right 0.4s ease;
    }

    html[dir="rtl"] .nav-links {
        right: auto;
        left: -100%;
        transition: left 0.4s ease;
    }

    .nav-links.active {
        right: 0;
    }

    html[dir="rtl"] .nav-links.active {
        left: 0;
    }

    .hamburger {
        display: block;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .objective-text {
        font-size: 1.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
    }
}