/* CSS Variables for Theming (Dark/Light Mode) */
:root {
    /* NEW: Professional Dark Mode Palette */
    --color-bg: #121212; /* Almost black */
    --color-bg-secondary: #1E1E1E; /* Dark gray for secondary elements */
    --color-card: #2A2A2A; /* Slightly lighter gray for cards */
    --color-border: #3A3A3A; /* Subtle border */
    --color-primary: #00A9FF; /* A vibrant, electric sky blue */
    --color-primary-hover: #57C5FF; /* Lighter blue for hover */
    --color-headings: #FFFFFF; /* Pure white for main titles */
    --color-body: #EAEAEA; /* Off-white for body text for eye comfort */
    --color-muted: #A0A0A0; /* Softer gray for muted text */
    --shadow-color: rgba(0, 0, 0, 0.25);
    --gradient-start: rgba(0, 169, 255, 0.05);
    /* UPDATED: Font Families */
    --font-family-ar: 'IBM Plex Sans Arabic', sans-serif;
    --font-family-en: 'IBM Plex Sans', sans-serif;
}

.light {
    /* Light Mode Palette (Unchanged) */
    --color-bg: #f8fafc;
    --color-bg-secondary: #ffffff;
    --color-card: #ffffff;
    --color-border: #e2e8f0;
    --color-primary: #0ea5e9;
    --color-primary-hover: #0284c7;
    --color-headings: #1e293b;
    --color-body: #334155;
    --color-muted: #64748b;
    --shadow-color: rgba(15, 23, 42, 0.08);
    --gradient-start: rgba(14, 165, 233, 0.05);
}

/* Base Body Styles */
body {
    /* Default to Arabic font */
    font-family: var(--font-family-ar);
    scroll-behavior: smooth;
    background-color: var(--color-bg);
    color: var(--color-body);
    transition: background-color 0.4s ease, color 0.4s ease;
    background-image: linear-gradient(180deg, #1C1C1C 0%, #121212 100%), 
                      radial-gradient(ellipse at top, var(--gradient-start), transparent 60%);
    background-attachment: fixed;
    /* UPDATED: Smaller base font size */
    font-size: 15px;
    line-height: 1.7;
}

/* Apply English font when 'ltr' direction is set on the html tag */
html[dir="ltr"] body {
    font-family: var(--font-family-en);
}


.light body {
    background-image: radial-gradient(ellipse at top, var(--gradient-start), transparent 60%);
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 { color: var(--color-headings); font-weight: 700; }
html[dir="ltr"] h1, html[dir="ltr"] h2, html[dir="ltr"] h3, html[dir="ltr"] h4, html[dir="ltr"] h5, html[dir="ltr"] h6 {
    font-weight: 600; /* Adjusted weight for IBM Plex Sans */
}

.text-primary { color: var(--color-primary); }
.bg-primary { background-color: var(--color-primary); }
.hover\:bg-primary-hover:hover { background-color: var(--color-primary-hover); }
.border-primary { border-color: var(--color-primary); }
.ring-primary { --tw-ring-color: var(--color-primary); }
.bg-bg-secondary { background-color: var(--color-bg-secondary); }
.border-border { border-color: var(--color-border); }
.text-headings { color: var(--color-headings); }
.text-muted { color: var(--color-muted); }
.hover\:text-primary:hover { color: var(--color-primary); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background-color: var(--color-bg-secondary); }
::-webkit-scrollbar-thumb { background-color: var(--color-primary); border-radius: 10px; border: 2px solid var(--color-bg-secondary); }
::-webkit-scrollbar-thumb:hover { background-color: var(--color-primary-hover); }

/* Header Styling */
#header {
    background-color: transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
#header.scrolled {
    border-bottom-color: var(--color-border);
    box-shadow: 0 2px 10px var(--shadow-color);
}
.dark #header.scrolled {
    background-color: rgba(28, 28, 28, 0.7);
}
.light #header.scrolled {
    background-color: rgba(255, 255, 255, 0.7);
}

/* NEW: Logo Background Style */
.logo-background {
    background-color: white;
    border-radius: 50%;
    padding: 2px; /* Adjust padding to control the border thickness */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Reveal on Scroll Animation */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.165, 0.84, 0.44, 1), transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* Card Styling */
.card-base {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.light .card-base {
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color);
}
.card-base:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px -5px var(--shadow-color);
    border-color: var(--color-primary);
}

/* Scroll to Top Button */
#progress-container {
    position: fixed; bottom: 30px; 
    transition: opacity 0.4s, visibility 0.4s, transform 0.4s;
    z-index: 1000;
}
html[dir="rtl"] #progress-container { right: 30px; }
html[dir="ltr"] #progress-container { left: 30px; }

#progress-container {
    height: 50px; width: 50px; display: grid;
    place-items: center; border-radius: 50%;
    cursor: pointer; opacity: 0; visibility: hidden;
}
#progress-container:hover { transform: scale(1.1); }
#progress-container.active { opacity: 1; visibility: visible; }
#progress-container #progress-value {
    position: absolute; height: 42px; width: 42px;
    border-radius: 50%; background: var(--color-card);
    border: 1px solid var(--color-border); display: grid;
    place-items: center; color: var(--color-primary);
}
#progress-container svg {
    position: absolute; width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.progress-bg { stroke: var(--color-border); stroke-width: 4; fill: none; }
.progress-bar { stroke: var(--color-primary); stroke-width: 5; fill: none; stroke-linecap: round; }

/* Shine Effect for Buttons */
.shine-effect { position: relative; overflow: hidden; }
.shine-effect::after {
    content: ''; position: absolute; top: -50%;
    width: 75%; height: 200%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg); 
}
html[dir="rtl"] .shine-effect::after { left: -150%; transition: left 0.8s ease-in-out; }
html[dir="ltr"] .shine-effect::after { right: -150%; transition: right 0.8s ease-in-out; }

.shine-effect:hover::after { 
    html[dir="rtl"] & { left: 150%; }
    html[dir="ltr"] & { right: 150%; }
}


/* Section Title Styling */
.section-title { position: relative; display: inline-block; padding-bottom: 0.75rem; }
html[dir="rtl"] .section-title { font-weight: 700; }
html[dir="ltr"] .section-title { font-weight: 700; }

.section-title::after {
    content: ''; position: absolute; bottom: 0; 
    width: 70px; height: 4px;
    background-color: var(--color-primary); border-radius: 2px;
}
html[dir="rtl"] .section-title::after { right: 50%; transform: translateX(50%); }
html[dir="ltr"] .section-title::after { left: 50%; transform: translateX(-50%); }


/* Portfolio Section Styling */
.portfolio-image {
    width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover;
    transition: transform 0.4s ease-out;
}
.group:hover .portfolio-image { transform: scale(1.05); }

.portfolio-filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-weight: 600;
    background-color: transparent;
    color: var(--color-muted);
    border: 2px solid var(--color-border);
    transition: all 0.2s;
}
.portfolio-filter-btn:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: white;
}
.portfolio-filter-btn.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 169, 255, 0.2);
}

#portfolio-grid.is-filtering {
    pointer-events: none;
}

.portfolio-item {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.portfolio-item.filtering-out {
    transform: scale(0.95);
    opacity: 0;
}
.portfolio-item.hidden {
    display: none;
}

/* FAQ Styling */
.faq-item summary { transition: margin 0.3s ease; }
.faq-item[open] summary { margin-bottom: 0.75rem; }
.faq-question {
    /* UPDATED: Smaller font size */
    font-size: 1rem; 
    cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
html[dir="rtl"] .faq-question { font-weight: 600; }
html[dir="ltr"] .faq-question { font-weight: 600; }

.faq-arrow { transition: transform 0.3s; color: var(--color-muted); }
.faq-question:hover .faq-arrow { color: var(--color-primary); }
.faq-item[open] .faq-arrow { transform: rotate(180deg); }

/* Form Styling */
.form-label {
    display: block; margin-bottom: 0.5rem; 
    /* UPDATED: Smaller font size */
    font-size: 0.8125rem;
    font-weight: 500; color: var(--color-muted);
}
.form-input {
    background-color: var(--color-bg-secondary); border: 1px solid var(--color-border);
    color: var(--color-headings); font-size: 1rem; border-radius: 0.5rem;
    display: block; width: 100%; padding: 0.75rem 1rem; transition: all 0.3s;
}
.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 169, 255, 0.3);
}
.light .form-input:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* Calculator Styles */
.calculator-step {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    transition: opacity 0.4s, transform 0.4s;
}
.calculator-step.disabled { opacity: 0.4; transform: scale(0.98); pointer-events: none; }
.calculator-step:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.calculator-label {
    cursor: pointer; transition: all 0.2s ease-in-out;
    background-color: var(--color-card); border: 2px solid var(--color-border);
    color: var(--color-muted); font-weight: 600;
}
.calculator-label:hover { border-color: var(--color-primary); color: var(--color-headings); transform: translateY(-2px); }
input:checked + .calculator-label {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(0, 169, 255, 0.3);
}
.calculator-option { transition: opacity 0.4s, max-height 0.5s ease-in-out, margin-top 0.4s; opacity: 1; max-height: 500px; overflow: hidden; }
.calculator-option.hidden { opacity: 0; max-height: 0; margin-top: 0 !important; }

.summary-item {
    display: flex; justify-content: space-between; align-items: center;
    /* UPDATED: Smaller font size */
    font-size: 0.875rem; 
    padding: 0.6rem 0; border-bottom: 1px dashed var(--color-border);
}
.summary-item:last-child { border-bottom: none; }
.summary-delete-btn { background: none; border: none; color: var(--color-muted); cursor: pointer; padding: 0.25rem; transition: color 0.2s; }
.summary-delete-btn:hover { color: #f43f5e; /* rose-500 */ }

/* --- OLD Interactive Timeline Styles --- */
.timeline { 
    position: relative; 
    padding: 2rem 0; 
}
.timeline::before {
    content: ''; 
    position: absolute; 
    top: 0; 
    height: 100%; 
    width: 3px; 
    background: var(--color-border); 
    border-radius: 2px;
}
html[dir="rtl"] .timeline::before { right: 20px; }
html[dir="ltr"] .timeline::before { left: 20px; }

.timeline-progress {
    position: absolute;
    top: 0;
    width: 3px;
    background: var(--color-primary);
    height: 0;
    transition: height 0.2s ease-out;
    z-index: 1;
    border-radius: 2px;
}
html[dir="rtl"] .timeline-progress { right: 20px; }
html[dir="ltr"] .timeline-progress { left: 20px; }

.timeline-item { 
    position: relative; 
    margin-bottom: 2.5rem; 
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
html[dir="rtl"] .timeline-item { padding-right: 4rem; transform: translateX(40px); }
html[dir="ltr"] .timeline-item { padding-left: 4rem; transform: translateX(-40px); }


.timeline-item:last-child { margin-bottom: 0; }
.timeline-item.is-visible {
    opacity: 1;
    transform: translateX(0);
}
.timeline-dot {
    position: absolute; 
    top: 0.25rem; 
    display: flex; 
    align-items: center;
    justify-content: center; 
    width: 44px; 
    height: 44px; 
    border-radius: 50%;
    background-color: var(--color-card); 
    border: 3px solid var(--color-primary); 
    color: var(--color-primary);
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}
html[dir="rtl"] .timeline-dot { right: 0; }
html[dir="ltr"] .timeline-dot { left: 0; }

.timeline-item.is-visible .timeline-dot {
    transform: scale(1);
    transition-delay: 0.3s;
}
.timeline-content { 
    background-color: transparent; 
    padding: 0.5rem 1rem; 
    border-radius: 0.75rem; 
}


/* --- NEW: Professional Work Process Section --- */
.process-grid {
    display: grid;
    gap: 2rem;
    position: relative;
}

.process-connector {
    position: absolute;
    top: 50px; /* Adjust based on icon size */
    left: 50%;
    width: calc(100% - 200px); /* Adjust based on card width */
    height: 2px;
    background-image: linear-gradient(to right, var(--color-border) 50%, transparent 50%);
    background-size: 16px 2px;
    transform: translateX(-50%);
    z-index: 0;
    display: none; /* Hidden by default, shown on larger screens */
}

.process-card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.process-card:hover {
    transform: translateY(-10px);
    border-color: var(--color-primary);
    box-shadow: 0 15px 30px -5px var(--shadow-color);
}

.process-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background-color: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.process-card:hover .process-icon-wrapper {
    background-color: var(--color-primary);
    border-color: var(--color-primary-hover);
}

.process-icon-wrapper i {
    width: 36px;
    height: 36px;
    color: var(--color-primary);
    transition: color 0.3s ease;
}

.process-card:hover .process-icon-wrapper i {
    color: white;
}

.process-step {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
    border: 3px solid var(--color-bg);
}

.process-card h3 {
    /* UPDATED: Smaller font size */
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
}

/* Responsive Grid for Process Section */
@media (min-width: 768px) {
    .process-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .process-grid {
        grid-template-columns: repeat(5, 1fr);
        padding-top: 2rem; /* Space for the connector line */
    }
    .process-connector {
        display: block;
    }
}


/* --- Solution Finder Styles --- */
.finder-option {
    cursor: pointer;
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
}
.finder-option:hover {
    transform: translateY(-4px);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.finder-option.selected {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    transform: translateY(-4px);
}
.finder-screen {
    animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.result-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}
.result-card-feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--color-bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Mobile Menu */
.mobile-menu-container {
    background-color: var(--color-card);
    border-top: 1px solid var(--color-border);
    max-height: 0; overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.mobile-menu-container.open { max-height: 500px; }
.mobile-nav-link {
    display: block; 
    padding: 1rem;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 600; color: var(--color-body);
    border-bottom: 1px solid var(--color-border);
}
html[dir="rtl"] .mobile-nav-link { text-align: center; }
html[dir="ltr"] .mobile-nav-link { text-align: center; }

.mobile-nav-link:hover { background-color: var(--color-primary); color: white; }

/* Scroll Progress Bar */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background-color: var(--color-primary);
  z-index: 9999;
  transition: width 0.2s ease-out;
}
#progress-container .progress-ring {
  transform: rotate(-90deg);
}
#progress-container .arrow-up-icon {
  transform: rotate(0deg);
}