/* ===== CSS VARIABLES ===== */
:root {
    /* Modern Tech Blue & Cyan Scheme */
    --primary-blue: #0ea5e9; /* Sky Blue */
    --primary-dark: #0284c7; /* Darker Sky */
    --secondary-navy: #0f172a; /* Slate 900 */
    --accent-teal: #2dd4bf; /* Teal Accent */
    --light-blue: #38bdf8; /* Light Sky */
    --dark-bg: #020617; /* Slate 950 */
    --card-bg: #1e293b; /* Slate 800 */
    --text-light: #f8fafc; /* Slate 50 */
    --text-gray: #cbd5e1; /* Slate 300 */
    --border-color: #334155; /* Slate 700 */
    
    /* Typography */
    --font-sans: 'Outfit', sans-serif;
    --font-arabic: 'Tajawal', sans-serif;
    
    /* Spacing */
    --header-height: 70px;
    --section-spacing: 5rem;
    --container-width: 1200px;
    --border-radius: 8px;
    --border-radius-lg: 15px; /* Added for larger radius */
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

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

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

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

/* ===== HEADER & NAVIGATION ===== */
.main-header {
    position: fixed;
    top: 0;
    width: 100%;
    background: transparent;
    border-bottom: 1px solid transparent;
    height: var(--header-height);
    z-index: 1000;
    transition: var(--transition);
}

.main-header.scrolled {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    color: var(--light-blue);
}

/* Navigation */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    order: 2; /* Ensure it's after the lang switcher on mobile */
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    padding-left: 2rem; /* Added padding to create space for the lang switcher */
    align-items: center;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-blue);
    background-color: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.2);
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.1);
}

.nav-link.active::after {
    /* Remove the dot, use background/border style instead for cleaner look */
    content: none;
    /*
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary-blue);
    border-radius: 50%;
    */
}

/* Language Switcher */
.lang-switcher-wrapper {
    /* Integrated into the nav-list flow */
    display: contents;
    order: 1; /* For mobile layout */
}

#lang-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

#lang-switch:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.lang-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: var(--header-height) 0 2rem;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--secondary-navy) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><polygon fill="%230ea5e9" fill-opacity="0.05" points="0,1000 1000,0 1000,1000"/></svg>');
    background-size: cover;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-text .subtitle {
    font-size: 1.25rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
    font-weight: 600;
}

.hero-text p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: var(--text-gray);
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
    box-shadow: 0 4px 15px -5px rgba(14, 165, 233, 0.3), inset 0 -2px 0 rgba(0,0,0,0.2);
}

.action-btn:hover {
    background: linear-gradient(135deg, var(--light-blue), var(--primary-blue));
    transform: translateY(-3px);
    box-shadow: 0 7px 20px -5px rgba(14, 165, 233, 0.4), inset 0 -2px 0 rgba(0,0,0,0.1);
    color: white;
    border-color: transparent;
}

.action-btn.secondary-btn {
    background: rgba(30, 41, 59, 0.5); /* Semi-transparent background */
    color: var(--text-light);
    border-color: var(--border-color);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

.action-btn.secondary-btn:hover {
    background: rgba(14, 165, 233, 0.15); /* Subtle blue glow */
    color: var(--light-blue);
    border-color: var(--light-blue);
    box-shadow: 0 7px 20px -5px rgba(14, 165, 233, 0.2), inset 0 -2px 0 rgba(0,0,0,0.1);
}

.hero-image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: clamp(250px, 100%, 400px);
    aspect-ratio: 1/1;
    margin: 0 auto;
    z-index: 1;
}

.hero-image-wrapper::before {
    content: '';
    position: absolute;
    inset: -4px; /* Adjust inset to account for border */
    border-radius: var(--border-radius-lg); /* Match image border-radius */
    background: radial-gradient(circle, var(--accent-teal), transparent 70%); /* Changed glow color */
    opacity: 0.3;
    transition: var(--transition);
    animation: heroGlow 1.5s ease-out 0.2s backwards;
    z-index: -1;
}
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* Center the top of the image */
    border-radius: var(--border-radius-lg); /* Changed from circle to rounded square */
    border: 4px solid var(--primary-blue); /* Added a prominent border */
    padding: 4px; /* Add some space between image and border */
    background-color: var(--dark-bg); /* Add background color for padding */
    transition: filter 0.4s ease, transform 0.4s ease; /* Adjusted transition */
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3)); /* Apply shadow by default */
    animation: heroImageReveal 1.2s cubic-bezier(0.23, 1, 0.32, 1) 0.4s backwards;
}

.hero-image-wrapper:hover img {
    filter: drop-shadow(0 12px 25px rgba(0, 0, 0, 0.4)); /* Enhanced shadow on hover */
}

.hero-image-wrapper:hover::before {
    opacity: 0.6;
    transform: scale(1.1);
}

/* ===== SECTIONS COMMON STYLES ===== */
.section-spacing {
    padding: var(--section-spacing) 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-blue);
    border-radius: 2px;
}

/* ===== ABOUT SECTION ===== */
.about-content {
    display: grid;
    grid-template-columns: 1fr; /* Changed to single column */
    gap: 3rem;
    align-items: start; /* Align items to the top, allowing them to have their natural height */
}

.about-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* About Actions */
.about-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== BRANDED BUTTONS STYLES ===== */

/* GitHub Button */
.action-btn[href*="github.com"],
.project-btn[href*="github.com"],
.social-links a[href*="github.com"] {
    transition: all 0.3s ease;
}
.action-btn[href*="github.com"]:hover,
.project-btn[href*="github.com"]:hover,
.social-links a[href*="github.com"]:hover {
    background: #24292e !important;
    border-color: #24292e !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(36, 41, 46, 0.4);
}

/* LinkedIn Button */
.action-btn[href*="linkedin.com"],
.social-links a[href*="linkedin.com"] {
    transition: all 0.3s ease;
}
.action-btn[href*="linkedin.com"]:hover,
.social-links a[href*="linkedin.com"]:hover {
    background: #0077b5 !important;
    border-color: #0077b5 !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(0, 119, 181, 0.4);
}

/* Download CV Button (Teal) */
.action-btn[href*=".pdf"] {
    border-color: var(--accent-teal);
    color: var(--accent-teal);
    background: transparent;
}
.action-btn[href*=".pdf"]:hover {
    background: var(--accent-teal) !important;
    color: white !important;
    border-color: var(--accent-teal) !important;
    box-shadow: 0 5px 15px rgba(45, 212, 191, 0.3);
}

/* Instagram Button */
.social-links a[href*="instagram.com"]:hover {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(214, 36, 159, 0.4);
}

/* Facebook Button */
.social-links a[href*="facebook.com"]:hover {
    background: #1877f2 !important;
    border-color: #1877f2 !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(24, 119, 242, 0.4);
}

/* TikTok Button */
.social-links a[href*="tiktok.com"]:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    color: white !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

/* WhatsApp Link */
.contact-item-team[href*="wa.me"]:hover {
    color: #25D366 !important;
}

/* Personal Info Grid */
.personal-info {
    margin-top: 2rem;
}

.personal-info h3 {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.info-grid {
    /* Changed from grid to a simpler block layout */
    display: block;
    border-top: 1px solid var(--border-color); /* Add a top border */
}

.info-item {
    display: flex;
    justify-content: space-between; /* Pushes label and value apart */
    align-items: center;
    padding: 1rem 0; /* Add vertical padding */
    border-bottom: 1px solid var(--border-color); /* Add a bottom border for separation */
}

.info-label {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Space between icon and text */
}

.info-label i {
    color: var(--primary-blue);
    width: 20px; /* Ensure consistent icon alignment */
    text-align: center;
}

.info-item strong {
    color: var(--text-light);
    font-weight: 600; /* Make the label bolder */
}

.info-item span {
    text-align: right; /* Align value to the right */
}
/* Code Block */
.about-code-block {
    /* Glassmorphism effect */
    background: rgba(30, 41, 59, 0.5); /* Semi-transparent version of --card-bg */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */

    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37); /* Softer shadow */
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0; /* Ensures grid item can shrink properly */
}

.code-header {
    background: #2d2d2d;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.code-dot.red { background: #ff5f56; }
.code-dot.yellow { background: #ffbd2e; }
.code-dot.green { background: #27c93f; }

.code-title {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.copy-code-btn {
    margin-left: auto;
}
body[dir="rtl"] .copy-code-btn {
    margin-left: 0;
    margin-right: auto;
}

.copy-code-btn {
    background: var(--border-color);
    border: none;
    color: var(--text-gray);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.copy-code-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
}

.copy-code-btn.copied {
    background: var(--accent-teal) !important;
    color: white;
}

.about-code-block pre {
    padding: 1.5rem 1.5rem 1.5rem 3.5rem; /* Add left padding for line numbers */
    margin: 0;
    background: transparent; /* Make pre background transparent */
    color: var(--text-light);
    flex-grow: 1; /* Allow the pre tag to fill available space */
    position: relative;
    counter-reset: line;
    overflow-x: auto; /* Allow horizontal scrolling for long lines */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbar for Code Block */
.about-code-block pre::-webkit-scrollbar {
    height: 6px;
}
.about-code-block pre::-webkit-scrollbar-track {
    background: transparent;
}
.about-code-block pre::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.about-code-block pre code::before {
    content: counter(line);
    counter-increment: line;
    position: absolute;
    left: 0;
    width: 2.5rem;
    text-align: right;
    padding-right: 1rem;
    color: var(--border-color);
    font-size: 0.9rem;
    display: inline-block;
}

.about-code-block code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-comment { color: #6a9955; }
.code-keyword { color: #569cd6; }
.code-string { color: #ce9178; }
.code-function { color: #dcdcaa; }
.code-property { color: #9cdcfe; }

/* Animation for code copy */
.about-code-block.code-copied-animation {
    animation: flash-success 0.7s ease-out;
}

/* ===== SKILLS SECTION ===== */
.skills-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.skill-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    margin-bottom: 0; /* Remove margin as gap is handled by grid */
}

.skill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.skill-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.skill-label i {
    color: var(--primary-blue);
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.skill-name {
    color: var(--text-light);
    font-weight: 600;
}

.skill-percent {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--dark-bg); /* Darker background for contrast */
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid transparent; /* Remove border, use shadow instead */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4); /* Inner shadow for depth */
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.1);
    border-color: var(--primary-blue); /* Highlight border on hover */
}

.progress {
    width: 0; /* Initial width for animation */
    height: 100%;
    background-color: var(--primary-blue);
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    border-radius: var(--border-radius);
    transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth animation */
    animation: progress-stripes 2s linear infinite;
}
.section-description {
    max-width: 700px;
    margin: -2rem auto 3rem auto;
}

/* ===== TEACHHIVE SECTION ===== */
.teachhive-content {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 3rem;
    align-items: start;
}

.teachhive-info h3 {
    color: var(--text-light);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.teachhive-info p {
    margin-bottom: 1.5rem;
}

.leader-text {
    font-style: italic;
    color: var(--primary-blue);
    font-weight: 600;
}

.team-contact-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.team-contact-info h4 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.team-contact-info .social-links {
    justify-content: flex-start;
    margin-bottom: 1.5rem;
}

.contact-details-team {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-item-team {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition);
}

.contact-item-team:hover {
    color: var(--primary-blue);
}

/* Wrapper for projects grid and show more button */
.projects-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== PROJECTS SECTION ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    width: 100%; /* Ensure grid takes full width of its wrapper */
    justify-content: center; /* Center grid items horizontally */
    gap: 2rem;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.2);
}

.project-image {
    height: 220px;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.05);
}

.project-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.project-description {
    flex-grow: 1;
    color: var(--text-gray);
    font-size: 1rem;
    line-height: 1.6;
}

#show-more-projects {
    display: none; /* Hidden by default, shown by JS */
    margin-top: 2rem; /* Keep the top margin */
    padding: 0.75rem 2rem;
}

.project-tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
    list-style: none;
}

.project-tech-list li {
    background: rgba(14, 165, 233, 0.15);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.project-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem; /* Increased gap for better spacing */
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 0.9rem;
    background: transparent;
}

.project-btn:not(.disabled):hover {
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

/* Disabled state for buttons */
.project-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--border-color);
    border-color: var(--border-color);
}

/* ===== NEW PROJECTS SECTION STYLES ===== */
.project-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-image-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
}

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

.project-card:hover .project-image-container img {
    transform: scale(1.1);
}

.project-text-container {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tech-title {
    font-size: 0.9rem;
    color: var(--text-gray);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tech-item {
    font-size: 0.8rem;
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary-blue);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.project-link svg {
    width: 18px;
    height: 18px;
}

.project-link.live-demo {
    color: var(--primary-blue);
}

.project-link.view-code {
    color: var(--text-gray);
}

.project-link:hover {
    text-decoration: underline;
    transform: translateY(-2px);
}

/* ===== SERVICES SECTION STYLES ===== */
.services-container {
    position: relative;
    padding: 2rem 0;
}

.service-bg-img {
    position: absolute;
    z-index: -1;
    opacity: 0.1;
    pointer-events: none;
}

.service-bg-img.img-1 { top: 10%; left: 5%; width: 300px; }
.service-bg-img.img-2 { bottom: 10%; right: 5%; width: 250px; }
.service-bg-img.img-3 { top: 40%; right: 15%; width: 150px; }

.service-card {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-blue);
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15);
}

.service-icon {
    width: 50px;
    height: 50px;
    background: rgba(14, 165, 233, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
}

.service-icon svg {
    width: 28px;
    height: 28px;
}

.card-title {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.card-description {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ===== TIMELINE STYLES ===== */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--primary-blue);
}

.timeline-item {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item:nth-child(odd) {
    flex-direction: row;
}

.timeline-item:nth-child(even) {
    flex-direction: row-reverse;
}

.timeline-date {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: var(--primary-blue);
    padding: 0 2rem;
}

.timeline-content {
    flex: 2;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    position: relative;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 15px;
    height: 15px;
    background: var(--primary-blue);
    border-radius: 50%;
    transform: translateY(-50%);
}

.timeline-item:nth-child(odd) .timeline-content::before {
    right: -7.5px;
}

.timeline-item:nth-child(even) .timeline-content::before {
    left: -7.5px;
}

.timeline-content h3 {
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.company {
    color: var(--primary-blue);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

/* ===== CONTACT SECTION ===== */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.contact-info h3 {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.contact-details {
    margin: 2rem 0;
}

.contact-details .contact-item {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.contact-details .contact-item:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--text-light);
    text-decoration: none;
}

.contact-item i {
    color: var(--primary-blue);
    width: 20px;
}

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

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.social-links a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
/* The brand-specific hovers will override the background color */
.contact-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===== FOOTER ===== */
.main-footer {
    background: var(--secondary-navy);
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-gray);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-blue);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-gray);
}

/* ===== CONTACT PAGE SPECIFIC STYLES ===== */
.contact-page {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--secondary-navy) 100%);
    min-height: 100vh;
}

.simple-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
}

.contact-form-section {
    padding: calc(var(--header-height) + 2rem) 0 var(--section-spacing);
}

.contact-header h1 {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.contact-intro {
    font-size: 1.2rem;
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.contact-form-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Contact Info Sidebar */
.contact-info-sidebar {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.contact-info-sidebar h3 {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1.5rem;
    text-align: center;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.contact-method {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.method-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.method-info h4 {
    color: var(--text-light);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.method-info p {
    color: var(--text-gray);
    margin: 0;
    font-size: 0.9rem;
}

.social-links-sidebar h4 {
    color: var(--text-light);
    margin-bottom: 1rem;
    text-align: center;
}

.social-links-sidebar .social-links {
    justify-content: center;
}

/* Contact Form */
#contact-form {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

#contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 600;
}

#contact-form input,
#contact-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    font-size: 1rem;
    transition: var(--transition);
}

#contact-form input:focus,
#contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-submit {
    margin-top: 2rem;
}

.submit-btn {
    position: relative;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

#form-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    display: none;
}

#form-status.success {
    background: #10b981;
    color: white;
    display: block;
}

#form-status.error {
    background: #ef4444;
    color: white;
    display: block;
}

.submit-btn .btn-text {
    transition: opacity 0.3s ease;
}

.submit-btn .loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    display: none; /* Hidden by default */
    animation: spin 1s linear infinite;
}

/* Loading state class will be added by JS */
.submit-btn.loading .btn-text {
    opacity: 0;
    visibility: hidden;
}

.submit-btn.loading .loading-spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.back-to-home {
    text-align: center;
    margin-top: 3rem;
}

/* ===== THANK YOU PAGE STYLES ===== */
.thank-you-page {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--secondary-navy) 100%);
    min-height: 100vh;
}

.thank-you-section {
    padding: calc(var(--header-height) + 2rem) 0 var(--section-spacing);
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.thank-you-content {
    max-width: 800px;
    margin: 0 auto;
}

.success-icon {
    font-size: 5rem;
    color: #10b981;
    margin-bottom: 2rem;
    animation: bounceIn 1s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.thank-you-content h1 {
    font-size: 3.5rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.success-message {
    font-size: 1.2rem;
    color: var(--text-gray);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.next-steps {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.next-steps h3 {
    color: var(--text-light);
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1.5rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.step-item {
    text-align: center;
}

.step-number {
    width: 50px;
    height: 50px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 auto 1rem;
}

.step-item p {
    color: var(--text-gray);
    margin: 0;
}

.contact-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.emergency-contact {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.emergency-contact p {
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.contact-direct {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.direct-contact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    background: var(--card-bg);
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2);
}

.direct-contact:hover {
    background: var(--primary-dark);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3), inset 0 -1px 0 rgba(0,0,0,0.1);
}

/* ===== SIMPLE FOOTER (Used on sub-pages) ===== */
.simple-footer {
    background: var(--secondary-navy);
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
}

.simple-footer .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.footer-social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.03);
}

.footer-social-links a:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    color: var(--primary-blue);
    background: rgba(14, 165, 233, 0.1);
}

/* ===== BACK TO TOP BUTTON ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.4);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    animation: popIn 0.3s ease-out forwards;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.5);
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-4 { margin-top: 4rem; }
.mb-4 { margin-bottom: 4rem; }

/* ===== ANIMATIONS ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== LOADED STATE ANIMATIONS ===== */
body.loaded .animate-on-scroll {
    animation: fadeInUp 0.8s ease-out forwards;
}

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

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
/* New custom keyframes for the hero image animation */
@keyframes heroGlow {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 0.3; /* Default opacity */
        transform: scale(1.1);
    }
}

@keyframes heroImageReveal {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* Keyframe for animated progress bar stripes */
@keyframes progress-stripes {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}

/* Keyframe for code copy success flash */
@keyframes flash-success {
    0% {
        box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.5), 0 15px 30px rgba(0,0,0,0.3);
    }
    100% {
        box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    }
}

/* ===== SKILLS SECTION (CARD-BASED) ===== */
.skills-grid-cards {
    display: grid;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.skill-card {
    background: rgba(30, 41, 59, 0.4); /* خلفية شبه شفافة */
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: left; /* محاذاة لليسار لشكل تقني أكثر */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100%;
}

.skill-card::before {
    /* خط علوي ملون يظهر عند التحويم */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-teal));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.skill-card:hover {
    transform: translateY(-5px);
    background: var(--card-bg);
    border-color: var(--primary-blue);
    box-shadow: 0 10px 30px -10px rgba(14, 165, 233, 0.25);
}

.skill-card:hover::before {
    transform: scaleX(1);
}

.skill-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--text-gray);
    transition: transform 0.3s ease;
    background: none;
    -webkit-text-fill-color: initial;
}

.skill-card:hover .skill-icon {
    transform: scale(1.1);
    color: var(--primary-blue);
}

.skill-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-light);
}

.skill-description {
    font-size: 0.9rem;
    color: var(--text-gray);
    line-height: 1.6;
}
/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .main-header,
    .back-to-top,
    .nav-toggle,
    .lang-switcher-wrapper {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .hero,
    .section-spacing {
        padding: 1rem 0 !important;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0000ff;
        --text-light: #000000;
        --text-gray: #333333;
        --border-color: #000000;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .project-card:hover,
    .hero-image-wrapper:hover img,
    .hero-image-wrapper:hover::before {
        transform: none;
        filter: none;
    }
}

/* RTL specific adjustments */
body[dir="rtl"] .timeline::before {
    right: 20px;
    left: auto;
}

body[dir="rtl"] .timeline-content::before {
    right: -7.5px !important;
    left: auto !important;
}

body[dir="rtl"] .back-to-top {
    right: auto;
    left: 2rem;
}

body[dir="rtl"] .lang-switcher-wrapper {
    /* This is now handled by nav-list padding */
}
body[dir="rtl"] .nav-list {
    padding-left: 0;
    padding-right: 2rem;
}