:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --border: #334155;
    --card-hover: #2d3e54;

    --font-en: 'Inter', sans-serif;
    --font-ar: 'Cairo', sans-serif;

    --container-width: 1200px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-en);
    line-height: 1.6;
    overflow-x: hidden;
}

body[dir="rtl"] {
    font-family: var(--font-ar);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 5rem 0;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--accent);
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--accent-hover);
}

/* Header */
header {
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#lang-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;

    transition: var(--transition);
}

#lang-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
    position: relative;
    overflow: hidden;
}

.hero-section .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    width: 100%;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-img {
    width: 350px;
    height: 350px;
    object-fit: cover;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

.hero-img:hover {
    transform: scale(1.02);
    border-color: var(--accent);
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content .subtitle {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

/* Button Variants */
.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Contact Specifics */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 50px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.contact-item:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    color: var(--accent);
}


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

.card {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    background-color: var(--card-hover);
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: var(--accent);
    border-radius: 2px;
}

/* Projects */
.project-card {
    overflow: hidden;
    padding: 0;
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-content {
    padding: 1.5rem;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tech-badge {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    padding: 3rem 0;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.social-links a:hover {
    color: var(--accent);
}

/* Timeline/Experience */
.timeline-item {
    border-left: 2px solid var(--border);
    padding-left: 2rem;
    padding-bottom: 2rem;
    position: relative;
}

body[dir="rtl"] .timeline-item {
    border-left: none;
    border-right: 2px solid var(--border);
    padding-left: 0;
    padding-right: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.4rem;
    top: 0;
    width: 0.8rem;
    height: 0.8rem;
    background-color: var(--accent);
    border-radius: 50%;
}

body[dir="rtl"] .timeline-item::before {
    left: auto;
    right: -0.4rem;
}

/* Responsive */
@media (max-width: 900px) {
    .hero-section .container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2rem;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .hero-img {
        width: 280px;
        height: 280px;
    }

    .hero-section {
        height: auto;
        min-height: auto;
        padding-bottom: 4rem;
    }

    .btn-group {
        justify-content: center;
    }
}

@media (max-width: 768px) {

    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background-color: var(--bg-secondary);
        flex-direction: column;
        padding: 2rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }
}

/* Contact Form */
.contact-form {
    max-width: 600px;
    margin: 2rem auto;
    text-align: left;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-form .btn-submit {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Language Switcher */
.lang-switch {
    display: inline-block;
    width: 70px;
    height: 30px;
    position: relative;
    margin-right: 1rem;
}

.lang-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: '';
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3px;
    background-color: var(--accent);
    transition: .4s;
    border-radius: 50%;
    z-index: 1;
}

.labels {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 11px;
    pointer-events: none;
    box-sizing: border-box;
    font-size: 0.7rem;
    font-weight: 800;
    z-index: 2;
}

/* Base State: Unchecked (Knob Left/AR) */
/* Left Text (AR) is ON KNOB (White) */
/* Right Text (EN) is OFF KNOB (Grey) */

.labels::before {
    content: attr(data-on);
    color: #fff;
    transition: color 0.3s;
}

.labels::after {
    content: attr(data-off);
    color: var(--text-secondary);
    transition: color 0.3s;
}

input:checked+.slider:before {
    transform: translateX(40px);
}

/* Checked State (Knob Right/EN) */
/* Left Text (AR) is OFF KNOB (Grey) */
input:checked~.labels::before {
    color: var(--text-secondary);
}

/* Right Text (EN) is ON KNOB (White) */
input:checked~.labels::after {
    color: #fff;
}