@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Inter:wght@300;400;500;600&family=Cairo:wght@400;600;700&display=swap');

:root {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --bg-dark: #0b0f1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --white: #ffffff;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 70px;
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(139, 92, 246, 0.1);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary-glow: rgba(139, 92, 246, 0.2);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Outfit', 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

section {
    padding: 100px 0;
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}
[dir="rtl"] .nav-links { margin-right: auto; margin-left: 2rem; }
[dir="rtl"] .hero-text { text-align: right; }
[dir="rtl"] .section-title::after { left: auto; right: 0; }
[dir="rtl"] .timeline::before { left: auto; right: 0; }
[dir="rtl"] .timeline-item { padding-left: 0; padding-right: 2rem; }
[dir="rtl"] .timeline-item::before { left: auto; right: -5px; }

/* Header & Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    height: var(--nav-height);
    transition: var(--transition);
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -1px;
    font-family: 'Outfit', sans-serif;
}

.logo span { color: var(--primary); }

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover { color: var(--primary); }

.hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 1001;
    transition: var(--transition);
}

.hamburger:hover { color: var(--primary); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.toggles {
    display: flex;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.mobile-only {
    display: none;
}

.mobile-toggles {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 700;
}

.toggle-btn:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Typography & Titles */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 3.5rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px -10px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.95rem;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

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

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    background: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}

.hero-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero-text h1 span {
    background: linear-gradient(to right, var(--primary), #d8b4fe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1.2rem;
}

.hero-image {
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    max-width: 450px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    border: 4px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    animation: blob 8s linear infinite;
    transition: var(--transition);
}

@keyframes blob {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    33% { border-radius: 68% 32% 45% 55% / 46% 76% 24% 54%; }
    66% { border-radius: 40% 60% 33% 67% / 55% 27% 73% 45%; }
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-category h3 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.skill-tag {
    background: rgba(139, 92, 246, 0.08);
    color: var(--primary);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(139, 92, 246, 0.15);
    transition: var(--transition);
}

.skill-tag:hover {
    background: var(--primary);
    color: var(--white);
    transform: scale(1.05);
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2.5rem;
}

.project-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    position: relative;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-img img {
    transform: scale(1.1);
}

.project-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    background: rgba(var(--primary-rgb, 124, 58, 237), 0.1);
    border: 1px solid rgba(var(--primary-rgb, 124, 58, 237), 0.2);
    border-radius: 50px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    margin: 0 0.3rem;
    vertical-align: middle;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(var(--primary-rgb, 124, 58, 237), 0.1);
    min-width: 17rem;
    display: inline-flex;
    justify-content: center;
}

.role-badge:hover {
    background: rgba(var(--primary-rgb, 124, 58, 237), 0.15);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(var(--primary-rgb, 124, 58, 237), 0.2);
}

#typing-text {
    background: linear-gradient(90deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    border-right: 2px solid var(--primary);
    padding-right: 4px;
    animation: blink 0.7s infinite alternate;
}

@keyframes blink {
    from { border-color: var(--primary); }
    to { border-color: transparent; }
}

[data-theme="dark"] .role-badge {
    background: rgba(255, 255, 255, 0.05);
}

.project-card p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 1.5rem;
}

.project-links {
    display: flex;
    gap: 1.5rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1.2rem;
}

.project-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.project-link:hover { color: var(--primary); }

.experience-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 1rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background: var(--glass-border);
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 3rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.timeline-date {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Contact Form */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 5rem;
}

.contact-info h3 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.contact-info h3 span { color: var(--primary); }

.contact-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 1.8rem;
}

.contact-item span {
    word-break: break-all;
    overflow-wrap: break-word;
}

.contact-item i {
    width: 45px;
    height: 45px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.2rem;
}

input, textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 16px;
    color: var(--text-main);
    font-family: inherit;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.03);
}

/* RTL Support tweaks */
[dir="rtl"] .timeline::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .timeline-item {
    padding-left: 0;
    padding-right: 2rem;
}

[dir="rtl"] .timeline-item::before {
    left: auto;
    right: -6px;
}
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid var(--glass-border);
        z-index: 999;
    }

    [dir="rtl"] .nav-links {
        right: auto;
        left: -100%;
        border-left: none;
        border-right: 1px solid var(--glass-border);
    }

    .nav-links.active {
        right: 0;
    }

    [dir="rtl"] .nav-links.active {
        left: 0;
    }

    .nav-links .mobile-only {
        display: block;
    }

    .toggles {
        display: none;
    }

    .hamburger { display: block; }
    
    .hero-content { grid-template-columns: 1fr; text-align: center; gap: 3rem; }
    .hero-text h1 { font-size: 3rem; }
    .hero-buttons { justify-content: center; }
    .hero-image { order: -1; margin-bottom: 2rem; }
    .hero-image img { max-width: 280px; }
}

@media (max-width: 768px) {
    .section-title { font-size: 2rem; margin-bottom: 2.5rem; }
    .skills-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
    .experience-grid { grid-template-columns: 1fr; gap: 3rem; }
    .contact-container { grid-template-columns: 1fr; gap: 3rem; }
    .contact-info { text-align: center; }
    .contact-item { justify-content: center; }
    .glass-card { padding: 1.5rem; }
    
    #hire-btn-nav { display: none; }
}

@media (max-width: 480px) {
    .logo { font-size: 1.3rem; }
    .nav-right { gap: 0.5rem; }
    .toggles { padding: 2px; }
    .toggle-btn { width: 30px; height: 30px; font-size: 0.8rem; }
    .hamburger { font-size: 1.5rem; }

    .hero-text h1 { font-size: 2rem; line-height: 1.2; }
    .hero-p { font-size: 0.95rem; }
    .hero-buttons { flex-direction: column !important; width: 100%; gap: 1rem; }
    .btn { width: 100% !important; justify-content: center; }
    .role-badge { min-width: auto; font-size: 0.85rem; padding: 0.2rem 1rem; width: fit-content; margin: 0.5rem auto; }
    .section-title { font-size: 1.8rem; }
    .projects-grid { grid-template-columns: 1fr; }
}