/* ==========================================================================
   CSS Variables & Theme Definitions
   ========================================================================== */
   
   :root {
    /* Fonts */
    --font-en: 'Inter', sans-serif;
    --font-ar: 'Cairo', sans-serif;
    --font-primary: var(--font-en);

    /* Light Theme (default fallback, but we start dark typically) */
    --clr-bg: #f9f5ff;
    --clr-surface: rgba(255, 255, 255, 0.7);
    --clr-surface-blur: rgba(255, 255, 255, 0.4);
    --clr-text-main: #1e1b4b;
    --clr-text-muted: #4f46e5;
    
    --clr-primary: #9333ea;
    --clr-primary-hover: #a855f7;
    --clr-secondary: #ec4899;
    
    --clr-border: rgba(147, 51, 234, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(147, 51, 234, 0.1);
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --clr-bg: #0b0312;
    --clr-surface: rgba(30, 8, 48, 0.5);
    --clr-surface-blur: rgba(15, 2, 28, 0.6);
    --clr-text-main: #f3e8ff;
    --clr-text-muted: #d8b4fe;
    
    --clr-primary: #a855f7;
    --clr-primary-hover: #c084fc;
    --clr-secondary: #f472b6;
    
    --clr-border: rgba(168, 85, 247, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* RTL Support Override */
[dir="rtl"] {
    --font-primary: var(--font-ar);
}

/* ==========================================================================
   Base
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--clr-bg);
    color: var(--clr-text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--clr-bg);
}
::-webkit-scrollbar-thumb {
    background-color: var(--clr-primary);
    border-radius: 6px;
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

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

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

img {
    max-width: 100%;
    display: block;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 1.5rem; }
.w-full { width: 100%; }

/* ==========================================================================
   Background Blobs / Aesthetics
   ========================================================================== */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 15s infinite alternate ease-in-out;
}
.blob-1 {
    width: 300px; height: 300px;
    background: var(--clr-primary);
    top: -100px; left: -100px;
}
.blob-2 {
    width: 400px; height: 400px;
    background: var(--clr-secondary);
    bottom: -150px; right: -100px;
    animation-delay: -5s;
}
.blob-3 {
    width: 250px; height: 250px;
    background: #6b21a8;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
    100% { transform: translateY(20px) scale(0.95); }
}

/* ==========================================================================
   Utilities / Glassmorphism
   ========================================================================== */
.glass {
    background: var(--clr-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--clr-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(147, 51, 234, 0.4);
}
.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(147, 51, 234, 0.6);
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--clr-primary);
    color: var(--clr-text-main);
}
.btn-outline:hover {
    background: var(--clr-primary);
    color: #fff;
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--clr-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}
.btn-icon:hover {
    color: var(--clr-primary);
}

.section-heading {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    color: var(--clr-text-main);
}
.text-center .section-heading {
    left: 50%;
    transform: translateX(-50%);
}
.section-heading::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 4px;
    background: linear-gradient(90deg, var(--clr-primary), var(--clr-secondary));
    bottom: -10px;
    left: 0;
    border-radius: 2px;
}
[dir="rtl"] .section-heading::after {
    right: 0; left: auto;
}
[dir="rtl"] .text-center .section-heading {
    transform: translateX(50%);
}

section {
    padding: 6rem 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1200px;
    z-index: 1000;
    padding: 1rem 2rem;
    border-radius: 50px;
}
.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--clr-text-main);
}
.logo span {
    color: var(--clr-primary);
}
.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}
.nav-links a {
    color: var(--clr-text-main);
    font-weight: 500;
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--clr-primary);
    transition: width 0.3s ease;
}
.nav-links a:hover::after {
    width: 100%;
}
.nav-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}
.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--clr-text-main);
    transition: var(--transition);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 8rem;
}
.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
.pill {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: rgba(147, 51, 234, 0.15);
    color: var(--clr-primary);
    border-radius: 50px;
    border: 1px solid var(--clr-border);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}
.hero-title span {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}
.hero-cta {
    display: flex;
    gap: 1rem;
}
.hero-visual {
    position: relative;
}
.image-wrapper {
    position: relative;
    padding: 1rem;
    border-radius: 30px;
    border: 1px solid var(--clr-border);
}
.image-wrapper img {
    border-radius: 20px;
    width: 100%;
    object-fit: cover;
}
.floating-badge {
    position: absolute;
    background: var(--clr-surface);
    backdrop-filter: blur(16px);
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--clr-border);
    box-shadow: var(--glass-shadow);
    font-weight: 600;
    animation: float 6s infinite alternate ease-in-out;
}
.badge-1 {
    top: 10%; right: -20px;
}
.badge-2 {
    bottom: 10%; left: -20px;
    animation-delay: -3s;
}
[dir="rtl"] .badge-1 { right: auto; left: -20px; }
[dir="rtl"] .badge-2 { left: auto; right: -20px; }

/* ==========================================================================
   About Section
   ========================================================================== */
.about-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
.experience-card {
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}
.experience-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 6px; height: 100%;
    background: linear-gradient(to bottom, var(--clr-primary), var(--clr-secondary));
}
[dir="rtl"] .experience-card::before {
    left: auto; right: 0;
}
.exp-list {
    list-style: none;
    margin-top: 1.5rem;
}
.exp-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--clr-text-muted);
}
.exp-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--clr-primary);
    font-weight: bold;
}
[dir="rtl"] .exp-list li {
    padding-left: 0; padding-right: 1.5rem;
}
[dir="rtl"] .exp-list li::before {
    content: '←'; left: auto; right: 0;
}

/* ==========================================================================
   Skills Section
   ========================================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}
.skill-category {
    padding: 2rem;
    text-align: center;
}
.skill-category h3 {
    margin-bottom: 1.5rem;
    color: var(--clr-primary);
}
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}
.skill-tags span {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid var(--clr-border);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    transition: var(--transition);
}
.skill-tags span:hover {
    background: var(--clr-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ==========================================================================
   Services Section
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}
.service-card {
    padding: 2.5rem 2rem;
    text-align: center;
    transition: var(--transition);
}
.service-card:hover {
    transform: translateY(-10px);
}
.service-card .icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.project-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}
.filter-btn {
    background: transparent;
    border: 2px solid var(--clr-border);
    color: var(--clr-text-main);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 600;
}
.filter-btn.active, .filter-btn:hover {
    background: var(--clr-primary);
    border-color: var(--clr-primary);
    color: #fff;
}
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}
.project-card {
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}
.project-card:hover {
    transform: translateY(-10px);
}
.project-img-container {
    position: relative;
    height: 220px;
    overflow: hidden;
}
.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.project-card:hover .project-img {
    transform: scale(1.1);
}
.project-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(30, 8, 48, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}
.project-card:hover .project-overlay {
    opacity: 1;
}
.project-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.project-type-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(30, 8, 48, 0.6);
    backdrop-filter: blur(8px);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--clr-border);
    font-size: 1.2rem;
    z-index: 2;
}
[dir="rtl"] .project-type-badge {
    right: auto;
    left: 1rem;
}
.project-info {
    padding: 1.8rem;
    flex-grow: 1;
}
.project-category {
    font-size: 0.75rem;
    color: var(--clr-primary);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    display: block;
}
.project-info h3 {
    margin: 0.5rem 0;
    font-size: 1.4rem;
    color: var(--clr-text-main);
}
.project-info p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* ==========================================================================
   Testimonials Section
   ========================================================================== */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}
.testimonial-card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.stars {
    color: #fbbf24;
    font-size: 1.2rem;
}
.review-text {
    font-style: italic;
    flex-grow: 1;
}
.reviewer-name {
    font-weight: bold;
    color: var(--clr-text-main);
}
.review-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2.5rem;
}
.review-form-container h3 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2rem;
    color: var(--clr-text-muted);
    cursor: pointer;
    margin-bottom: 1rem;
}
.star-rating span:hover, .star-rating span.active {
    color: #fbbf24;
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 4rem;
}
.social-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--clr-text-main);
}
.social-link:hover {
    color: var(--clr-primary);
}
.form-group {
    margin-bottom: 1.5rem;
}
input, textarea, select {
    width: 100%;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    padding: 1rem;
    border-radius: 10px;
    font-family: inherit;
    transition: var(--transition);
}
[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select {
    background: rgba(255,255,255,0.5);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.2);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 2rem 0;
    border-top: 1px solid var(--clr-border);
    margin-top: 4rem;
}
.admin-link {
    color: var(--clr-text-muted);
    opacity: 0.5;
}
.admin-link:hover {
    opacity: 1;
}


/* ==========================================================================
   Floating Widgets
   ========================================================================== */
.chatbot-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1001;
}
[dir="rtl"] .chatbot-widget {
    right: auto; left: 2rem;
}
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(147, 51, 234, 0.5);
    transition: var(--transition);
}
.chat-toggle-btn:hover {
    transform: scale(1.1);
}
.chat-interface {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: scaleUp 0.3s ease;
}
[dir="rtl"] .chat-interface {
    right: auto; left: 0; transform-origin: bottom left;
}
@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.chat-header {
    padding: 1rem;
    background: var(--clr-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-status {
    font-size: 0.8rem;
    opacity: 0.8;
}
.chat-status::before {
    content: '';
    display: inline-block;
    width: 8px; height: 8px;
    background: #22c55e;
    border-radius: 50%;
    margin-right: 5px;
}
[dir="rtl"] .chat-status::before {
    margin-right: 0; margin-left: 5px;
}
.chat-body {
    flex-grow: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
}
.chat-message {
    max-width: 85%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeIn 0.4s ease;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.chat-message.bot {
    background: var(--clr-surface);
    color: var(--clr-text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--clr-border);
}
[dir="rtl"] .chat-message.bot { border-bottom-left-radius: 18px; border-bottom-right-radius: 4px; }

.chat-message.user {
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-secondary));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
[dir="rtl"] .chat-message.user { border-bottom-right-radius: 18px; border-bottom-left-radius: 4px; }

.chat-quick-replies {
    padding: 0.8rem 1rem;
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(0,0,0,0.05);
}
.chat-quick-replies::-webkit-scrollbar { display: none; }

.chat-chip {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid var(--clr-border);
    color: var(--clr-text-main);
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.chat-chip:hover {
    background: var(--clr-primary);
    color: white;
}
.chat-footer {
    padding: 1rem;
    border-top: 1px solid var(--clr-border);
    display: flex;
    gap: 0.5rem;
    background: var(--clr-surface);
}
.chat-footer input {
    margin: 0;
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}
.chat-footer .btn-icon {
    background: var(--clr-primary);
    color: white;
    width: 42px; height: 42px;
    border-radius: 50%;
    justify-content: center;
    flex-shrink: 0;
}


/* ==========================================================================
   Animations
   ========================================================================== */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}
.fade-in {
    opacity: 0;
    transition: opacity 1s ease;
}
.fade-in.visible {
    opacity: 1;
}
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s ease;
}
.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 992px) {
    .hero-container, .about-container, .contact-wrapper {
        grid-template-columns: 1fr;
        padding: 2rem;
    }
    .hero-title { font-size: 2.5rem; }
    .hero-content { order: 2; text-align: center; }
    .hero-visual { order: 1; max-width: 400px; margin: 0 auto; }
    .hero-cta { justify-content: center; }
    
    .about-visual { max-width: 400px; margin: 0 auto; margin-bottom: 2rem;}
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: -100vh;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--clr-surface-blur);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: top 0.4s ease;
    }
    .nav-links.active {
        top: 0;
    }
    .hamburger { display: flex; z-index: 1002; }
    .nav-controls { z-index: 1002; }

    .chat-interface {
        width: calc(100vw - 4rem);
        bottom: 80px;
        right: 0;
    }
    [dir="rtl"] .chat-interface {
        right: auto; left: 0;
    }
    

}
