/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Dark Mode Variables */
body.dark-mode {
    --text-color: #e4e4e4;
    --light-bg: #1a1a2e;
    --white: #16213e;
    --secondary-color: #e4e4e4;
    --shadow: 0 5px 15px rgba(0,0,0,0.5);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.7);
}

body {
    font-family: 'Cairo', 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    background: var(--light-bg);
}

body[lang="en"] {
    font-family: 'Inter', 'Cairo', sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-en {
    font-size: 0.9rem;
    opacity: 0.8;
}

[lang="en"] .logo-ar {
    display: none;
}

[lang="ar"] .logo-en {
    display: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle,
.lang-toggle {
    background: var(--light-bg);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover,
.lang-toggle:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.1);
}

.lang-toggle {
    font-weight: 600;
    font-size: 0.9rem;
}

[lang="en"] .lang-ar {
    display: inline;
}

[lang="en"] .lang-en {
    display: none;
}

[lang="ar"] .lang-ar {
    display: none;
}

[lang="ar"] .lang-en {
    display: inline;
}

.burger {
    display: none;
    cursor: pointer;
}

.burger div {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    margin: 5px;
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    background: var(--gradient-primary);
    color: var(--white);
    padding: 150px 20px 80px;
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    scroll-margin-top: 0;
    margin-bottom: 0;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero-text {
    animation: fadeInUp 1s ease;
}

.greeting {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.name-en {
    display: block;
    font-size: 0.6em;
    opacity: 0.8;
    margin-top: 0.5rem;
}

[lang="en"] .name-ar {
    display: none;
}

[lang="ar"] .name-en {
    display: none;
}

.hero-subtitle {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: var(--white);
    color: #667eea;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover {
    background: var(--white);
    color: #667eea;
    transform: translateY(-3px);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--white);
    color: #667eea;
    transform: translateY(-5px);
}

/* Profile Image */
.profile-image-container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

.profile-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid rgba(255,255,255,0.3);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-image img[src]:not([src=""]) {
    display: block;
}

.profile-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 150px;
    color: rgba(255,255,255,0.4);
}

.profile-image img[src]:not([src=""]) ~ .profile-placeholder {
    display: none;
}

.profile-decoration {
    position: absolute;
    width: 420px;
    height: 420px;
    border: 3px dashed rgba(255,255,255,0.3);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* About Section */
.about {
    padding: 100px 20px;
    padding-top: 100px;
    background: var(--light-bg);
    scroll-margin-top: 70px;
    margin-top: 0;
    position: relative;
    z-index: 10;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--primary-color);
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-text .highlight {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.6;
}

.features-list {
    list-style: none;
    margin: 2rem 0;
}

.features-list li {
    padding: 0.8rem 0;
    font-size: 1.05rem;
    display: flex;
    align-items: start;
    gap: 10px;
}

.features-list i {
    color: var(--primary-color);
    margin-top: 5px;
    flex-shrink: 0;
}

.about-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.info-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-card h3 {
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.info-card p {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.info-card span {
    font-size: 0.9rem;
    color: #666;
}

body.dark-mode .info-card span {
    color: #aaa;
}

/* Skills Section */
.skills {
    padding: 100px 20px;
    padding-top: 140px;
    background: var(--white);
    scroll-margin-top: 100px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.skill-category {
    background: var(--light-bg);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-5px);
}

.skill-category h3 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.skill-category h3 i {
    margin-left: 10px;
    color: var(--primary-color);
}

.skill-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-item span {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.skill-bar {
    background: #e0e0e0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

body.dark-mode .skill-bar {
    background: #2c2c3e;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #667eea);
    border-radius: 5px;
    transition: width 1s ease;
}

/* Experience Section */
.experience {
    padding: 100px 20px;
    padding-top: 140px;
    background: var(--light-bg);
    scroll-margin-top: 100px;
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 50%;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
}

.timeline-item {
    margin-bottom: 50px;
    position: relative;
}

.timeline-dot {
    position: absolute;
    right: 50%;
    transform: translateX(50%);
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 4px solid var(--white);
    box-shadow: var(--shadow);
    z-index: 1;
}

.timeline-content {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    width: calc(50% - 40px);
    margin-right: auto;
    margin-left: 40px;
    transition: transform 0.3s ease;
}

.timeline-content:hover {
    transform: translateX(-10px);
}

.timeline-item:nth-child(even) .timeline-content {
    margin-right: 40px;
    margin-left: auto;
}

.timeline-item:nth-child(even) .timeline-content:hover {
    transform: translateX(10px);
}

.timeline-date {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-content h3 {
    color: var(--secondary-color);
    margin: 0.5rem 0;
    font-size: 1.4rem;
}

.timeline-content h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.timeline-content ul {
    list-style-position: inside;
    padding-right: 0;
}

.timeline-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    display: flex;
    align-items: start;
    gap: 8px;
}

.timeline-content li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: bold;
    flex-shrink: 0;
}

.timeline-content li span {
    flex: 1;
}

/* Projects Section */
.projects {
    padding: 100px 20px;
    padding-top: 140px;
    background: var(--white);
    scroll-margin-top: 100px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--light-bg);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border-top: 4px solid var(--primary-color);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.project-card.featured {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-top: 4px solid #667eea;
}

.project-icon {
    width: 70px;
    height: 70px;
    background: var(--primary-color);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.project-card:hover .project-icon {
    transform: scale(1.1) rotate(5deg);
}

.project-icon i {
    font-size: 2rem;
    color: var(--white);
}

.project-card h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.project-card p {
    color: #555;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

body.dark-mode .project-card p {
    color: #ccc;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.project-tags span {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.project-features {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

body.dark-mode .project-features {
    border-top-color: #444;
}

.project-features p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: start;
    gap: 8px;
}

.project-features i {
    color: var(--primary-color);
    margin-top: 5px;
    flex-shrink: 0;
}

/* Contact Section */
.contact {
    padding: 100px 20px;
    padding-top: 120px;
    background: var(--light-bg);
    scroll-margin-top: 80px;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: start;
}

.contact-info h3 {
    color: var(--secondary-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.contact-info > p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 2rem;
}

body.dark-mode .contact-info > p {
    color: #aaa;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contact-item i {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.contact-item h4 {
    color: var(--secondary-color);
    margin-bottom: 0.3rem;
}

.contact-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

.social-links-contact {
    display: flex;
    gap: 1rem;
}

.social-links-contact a {
    width: 45px;
    height: 45px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.social-links-contact a:hover {
    transform: translateY(-5px);
    background: var(--secondary-color);
}

.contact-cta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.cta-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
    border-top: 4px solid var(--primary-color);
}

.cta-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.cta-card > i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.cta-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.cta-card p {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

body.dark-mode .cta-card p {
    color: #aaa;
}

.cta-card .btn {
    width: auto;
    padding: 12px 30px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.contact-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: 'Cairo', 'Inter', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: var(--white);
    color: var(--text-color);
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    border-color: #444;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.contact-form .btn {
    width: 100%;
    padding: 1rem;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    justify-content: center;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: var(--white);
    text-align: center;
    padding: 2rem 20px;
}

.footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 968px) {
    .nav-links {
        position: fixed;
        right: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 2rem 0;
    }

    [dir="ltr"] .nav-links {
        left: -100%;
        right: auto;
    }

    .nav-links.active {
        right: 0;
    }

    [dir="ltr"] .nav-links.active {
        left: 0;
    }

    .burger {
        display: block;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .profile-image-container {
        width: 300px;
        height: 300px;
    }

    .profile-decoration {
        width: 320px;
        height: 320px;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .timeline::before {
        right: 20px;
    }

    .timeline-dot {
        right: 11px;
    }

    .timeline-content {
        width: calc(100% - 60px);
        margin-right: 0 !important;
        margin-left: 60px !important;
    }

    .timeline-content:hover {
        transform: translateX(0) !important;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card.featured {
        grid-column: span 1;
    }

    .contact-content {
        grid-template-columns: 1fr;
    }
    
    .cta-card .btn {
        width: 100%;
        max-width: 300px;
    }

    .hero-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.3rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .profile-image-container {
        width: 250px;
        height: 250px;
    }

    .profile-decoration {
        width: 270px;
        height: 270px;
    }

    .profile-placeholder {
        font-size: 100px;
    }
}

/* RTL Support */
[dir="rtl"] .nav-links a::after {
    right: 0;
    left: auto;
}

[dir="rtl"] .timeline::before {
    left: 50%;
    right: auto;
}

[dir="rtl"] .timeline-dot {
    left: 50%;
    right: auto;
}

[dir="rtl"] .timeline-content {
    margin-left: auto;
    margin-right: 40px;
}

[dir="rtl"] .timeline-item:nth-child(even) .timeline-content {
    margin-left: 40px;
    margin-right: auto;
}

@media (max-width: 968px) {
    [dir="rtl"] .timeline::before {
        left: 20px;
    }

    [dir="rtl"] .timeline-dot {
        left: 11px;
    }

    [dir="rtl"] .timeline-content {
        margin-left: 0 !important;
        margin-right: 60px !important;
    }
}