/* ===== CSS Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --accent-color: #f59e0b;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --gray-color: #64748b;
    --success-color: #10b981;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    overflow-x: hidden;
    direction: rtl;
}

/* ===== Language Selector ===== */
.lang-selector {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    padding: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-selector button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    margin: 0 4px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.lang-selector button:hover,
.lang-selector button.active {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Sections Common Styles ===== */
section {
    padding: 100px 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 50px;
    text-align: center;
    position: relative;
    color: var(--dark-color);
}

h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 50%;
    transform: translateX(50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

/* ===== Hero Section ===== */
.hero {
    background: var(--gradient-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-100px, -100px) rotate(360deg); }
}

.hero .container {
    position: relative;
    z-index: 1;
}

.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 30px;
    object-fit: cover;
    box-shadow: var(--shadow-xl);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: slideIn 1s ease-out;
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    opacity: 0.9;
    animation: slideIn 1s ease-out 0.2s both;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    display: inline-block;
    background: var(--gradient-secondary);
    color: white;
    padding: 15px 40px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    animation: slideIn 1s ease-out 0.4s both;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* ===== About Section ===== */
#about {
    background: white;
}

#about p {
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    color: var(--gray-color);
}

/* ===== Services Section ===== */
#services {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.service {
    background: white;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.service:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.service img {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.service h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.service p {
    color: var(--gray-color);
    line-height: 1.6;
}

/* ===== Skills Section ===== */
#skills {
    background: white;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.skill {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.skill:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.skill::before {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: 0.5s;
}

.skill:hover::before {
    right: 100%;
}

/* ===== Portfolio Section ===== */
#portfolio {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.project {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
}

.project:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.project img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.project a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.project h3 {
    padding: 20px 20px 10px;
    font-size: 1.3rem;
    color: var(--dark-color);
}

.project p {
    padding: 0 20px 20px;
    color: var(--gray-color);
    font-weight: 500;
}

.project::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 4px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.project:hover::after {
    width: 100%;
}

/* ===== Reviews Section ===== */
#reviews {
    background: white;
}

.reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.review {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 30px;
    border-radius: var(--radius-lg);
    border-right: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.review:hover {
    transform: translateX(-10px);
    box-shadow: var(--shadow-lg);
}

.review p {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--dark-color);
    margin-bottom: 15px;
    line-height: 1.6;
}

.review h4 {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== Contact Section ===== */
#contact {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
}

#contact h2::after {
    background: var(--gradient-secondary);
}

form {
    max-width: 600px;
    margin: 40px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

input, textarea {
    padding: 15px 20px;
    border: none;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

input:focus,
textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

form button {
    background: var(--gradient-secondary);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

form button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.socials {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.socials a:hover {
    background: var(--gradient-primary);
    transform: translateY(-5px) rotate(360deg);
}

/* ===== Scroll Progress Bar ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 0%;
    height: 4px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.2rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    section {
        padding: 70px 0;
    }
    
    .services-grid,
    .skills-grid,
    .projects-grid,
    .reviews-grid {
        grid-template-columns: 1fr;
    }
    
    .lang-selector {
        top: 10px;
        left: 10px;
    }
    
    .lang-selector button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .back-to-top {
        bottom: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .profile-img {
        width: 150px;
        height: 150px;
    }
    
    .btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

/* ===== Loading Animation ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Typing Effect ===== */
.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3.5s steps(40, end);
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* ===== Particles Background ===== */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}
