/* ============================================
   CSS Variables - Dark Theme (Default)
   ============================================ */
:root {
    --color-bg: #0a0e17;
    --color-bg-card: #111827;
    --color-bg-nav: rgba(10, 14, 23, 0.95);
    --color-primary: #0ea5e9;
    --color-primary-hover: #38bdf8;
    --color-neon: #22d3ee;
    --color-secondary: #1e293b;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border: #334155;
    --color-shadow: rgba(14, 165, 233, 0.3);
    --font-main: 'Space Grotesk', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --transition: 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
    --color-bg: #f8fafc;
    --color-bg-card: #ffffff;
    --color-bg-nav: rgba(248, 250, 252, 0.95);
    --color-primary: #0284c7;
    --color-primary-hover: #0ea5e9;
    --color-neon: #0891b2;
    --color-secondary: #e2e8f0;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-border: #cbd5e1;
    --color-shadow: rgba(2, 132, 199, 0.2);
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.3s ease;
}

body.loading {
    overflow: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ============================================
   Loading Screen
   ============================================ */
.loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 2rem;
    animation: loaderPulse 1s ease-in-out infinite;
}

.loader-bar {
    width: 200px;
    height: 4px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loader-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-neon));
    border-radius: 4px;
    animation: loaderFill 2s ease-in-out forwards;
}

.loader-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

@keyframes loaderPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes loaderFill {
    to { width: 100%; }
}

/* ============================================
   Particles Background
   ============================================ */
.particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s infinite;
}

@keyframes particleFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(100px, -100px) scale(1.2);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50px, -200px) scale(0.8);
        opacity: 0.2;
    }
    75% {
        transform: translate(-150px, -50px) scale(1.1);
        opacity: 0.4;
    }
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    backdrop-filter: blur(0);
    transition: all 0.4s ease;
}

.navbar.scrolled {
    background: var(--color-bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-primary);
    transition: var(--transition);
}

.nav-logo:hover {
    color: var(--color-primary-hover);
    text-shadow: 0 0 20px var(--color-shadow);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-primary);
    cursor: pointer;
    transition: var(--transition);
    margin-right: auto;
    margin-left: 2rem;
}

.theme-toggle:hover {
    background: var(--color-primary);
    color: var(--color-bg);
    transform: rotate(15deg);
}

.theme-toggle .light-icon { display: none; }
.theme-toggle .dark-icon { display: block; }

[data-theme="light"] .theme-toggle .light-icon { display: block; }
[data-theme="light"] .theme-toggle .dark-icon { display: none; }

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-menu a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: var(--transition);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--color-primary);
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

/* ============================================
   Section Styles
   ============================================ */
section {
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--color-text);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), transparent);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

.section-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Home Section
   ============================================ */
.home {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 8rem;
}

.home-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.home-content {
    animation: fadeInLeft 0.8s ease-out;
}

.home-greeting {
    display: inline-block;
    font-size: 1rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.home-name {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.home-title {
    font-size: 1.35rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 1rem;
    min-height: 2rem;
}

.typing-cursor {
    animation: blink 1s step-end infinite;
    color: var(--color-neon);
}

@keyframes blink {
    50% { opacity: 0; }
}

.home-description {
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.home-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Button Styles with Glow */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.4s ease;
    cursor: pointer;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 40px var(--color-shadow);
}

.btn-glow:hover {
    box-shadow: 0 0 30px var(--color-shadow), 0 10px 40px var(--color-shadow);
}

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: var(--color-bg);
    transform: translateY(-3px);
    box-shadow: 0 0 25px var(--color-shadow);
}

/* Floating Profile Image */
.home-image {
    display: flex;
    justify-content: center;
    animation: fadeInRight 0.8s ease-out;
    transform: translateZ(0);
}

.profile-image-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    overflow: hidden; /* يخلي الصورة تلتزم بالدايرة */
    border: 3px solid var(--color-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}
.profile-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* يخلي الصورة تملى الدايرة بدون تشويه */
    border-radius: 50%;}
.profile-image-wrapper.floating {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0);
    }
}
.profile-image-wrapper::before {
    content: '';
    position: absolute;
    inset: -20px;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}

.profile-image-placeholder {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-bg-card));
    border: 3px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: var(--color-primary);
    opacity: 0.8;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

.scroll-indicator span {
    display: block;
    width: 24px;
    height: 40px;
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.scroll-indicator span::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 4px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 2px;
    transform: translateX(-50%);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.02); }
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
    50% { transform: translateX(-50%) translateY(12px); opacity: 0.3; }
}

/* ============================================
   About Section
   ============================================ */
.about {
    background: var(--color-bg-card);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    line-height: 1.8;
}

/* ============================================
   Skills Section
   ============================================ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25rem;
}

.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
}

.skill-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.skill-card i {
    font-size: 2rem;
    color: var(--color-primary);
}

.skill-card span {
    font-weight: 500;
    font-size: 0.9rem;
}

.skill-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--color-primary);
    box-shadow: 0 15px 40px var(--color-shadow);
}

/* ============================================
   Education Section
   ============================================ */
.education {
    background: var(--color-bg-card);
}

.education-timeline {
    max-width: 600px;
    margin: 0 auto;
}

.education-card {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    transition: all 0.4s ease;
    position: relative;
    opacity: 0;
    transform: translateX(-50px);
}

.education-card.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.timeline-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-neon));
    border-radius: 4px 0 0 4px;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.8s ease;
}

.education-card.animate-in .timeline-line {
    transform: scaleY(1);
}

.education-card:hover {
    transform: translateX(10px);
    border-color: var(--color-primary);
}

.education-card.animate-in:hover {
    transform: translateX(10px);
}

.education-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-neon));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.education-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.education-content h4 {
    font-size: 1rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.education-year {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ============================================
   Feedback Section
   ============================================ */
.feedback-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feedback-card {
    padding: 2rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
}

.feedback-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.feedback-card i.fa-quote-left {
    font-size: 2rem;
    color: var(--color-primary);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.feedback-card p {
    color: var(--color-text-muted);
    font-style: italic;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.feedback-author span {
    font-size: 0.9rem;
    color: var(--color-primary);
}

.feedback-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 20px 50px var(--color-shadow);
}

.feedback-card.animate-in:hover {
    transform: translateY(-8px);
}

/* ============================================
   Services Section - 3D Hover
   ============================================ */
.services {
    background: var(--color-bg-card);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.service-card {
    padding: 2rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    text-align: center;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
}

.service-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.service-card.service-3d {
    perspective: 1000px;
}

.service-card.service-3d:hover {
    transform: translateY(-12px) rotateX(5deg) rotateY(5deg);
    border-color: var(--color-primary);
    box-shadow: 0 25px 50px var(--color-shadow);
}

.service-card i {
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
    transition: var(--transition);
}

.service-card:hover i {
    transform: scale(1.15);
    color: var(--color-neon);
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.service-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ============================================
   Projects Section
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
}

.project-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 20px 50px var(--color-shadow);
}

.project-image {
    height: 180px;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--color-primary);
    transition: var(--transition);
}

.project-card:hover .project-image {
    color: var(--color-neon);
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    font-weight: 500;
    transition: var(--transition);
}

.project-link:hover {
    color: var(--color-neon);
    transform: translateX(5px);
}

/* ============================================
   Contact Section
   ============================================ */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
}

.contact-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.contact-item i {
    font-size: 2rem;
    color: var(--color-primary);
    transition: var(--transition);
}

.contact-item span {
    font-weight: 600;
}

.contact-item small {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.contact-item.contact-glow:hover {
    transform: translateY(-8px);
    border-color: var(--color-primary);
    box-shadow: 0 0 30px var(--color-shadow), 0 15px 40px rgba(0,0,0,0.2);
}

.contact-item:hover i {
    color: var(--color-neon);
    transform: scale(1.2);
}

/* ============================================
   Footer - Animated Wave
   ============================================ */
.footer {
    position: relative;
    padding: 6rem 2rem 2rem;
    text-align: center;
    overflow: hidden;
}

.footer-wave {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
}

.footer-wave svg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 150px;
}

.wave-path {
    fill: var(--color-bg-card);
}

.footer-wave path:nth-child(1) {
    animation: footerWave1 6s ease-in-out infinite;
}

.footer-wave path:nth-child(2) {
    animation: footerWave2 8s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes footerWave1 {
    0%, 100% {
        transform: translateX(0) translateY(0) scaleX(1);
    }
    33% {
        transform: translateX(30px) translateY(-20px) scaleX(1.02);
    }
    66% {
        transform: translateX(-20px) translateY(-10px) scaleX(0.98);
    }
}

@keyframes footerWave2 {
    0%, 100% {
        transform: translateX(0) translateY(0) scaleX(1);
    }
    50% {
        transform: translateX(-40px) translateY(-25px) scaleX(1.03);
    }
}

.footer-text {
    font-size: 1rem;
    color: var(--color-text-muted);
    position: relative;
    z-index: 1;
}

.footer-text.glow-text {
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 5px var(--color-primary), 0 0 10px rgba(14, 165, 233, 0.3);
    }
    to {
        text-shadow: 0 0 20px var(--color-primary), 0 0 40px var(--color-shadow);
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 992px) {
    .home-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-description { margin-left: auto; margin-right: auto; }
    .home-buttons { justify-content: center; }

    .profile-image-placeholder {
        width: 220px;
        height: 220px;
        font-size: 4.5rem;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--color-bg-nav);
        width: 100%;
        text-align: center;
        padding: 2rem;
        transition: var(--transition);
        border-bottom: 1px solid var(--color-border);
        gap: 1.5rem;
    }

    .nav-menu.active { left: 0; }

    .nav-toggle { display: flex; }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) { opacity: 0; }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .home-name { font-size: 2rem; }
    .section-title { font-size: 2rem; }

    .skills-grid { grid-template-columns: repeat(2, 1fr); }

    .education-card {
        flex-direction: column;
        text-align: center;
    }

    .education-card:hover {
        transform: translateY(-5px);
    }

    .education-card.animate-in:hover {
        transform: translateY(-5px);
    }

    .theme-toggle { margin-left: 1rem; }
    
    .profile-image-wrapper {
    width: 200px;
    height: 200px;
}
.profile-image-wrapper.floating{
    animation: float 3s ease-in-out infinite;
}

.profile-image-wrapper::before {
    inset: -15px;
}
}

@media (max-width: 480px) {
    section { padding: 5rem 1rem 3rem; }
    .nav-container { padding: 1rem; }
    .home-name { font-size: 1.75rem; }
    .home-buttons { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .skills-grid { grid-template-columns: 1fr; }
    .feedback-grid { grid-template-columns: 1fr; }
    .profile-image-placeholder {
        width: 180px;
        height: 180px;
        font-size: 3.5rem;
    }
}
