/* ========================================
   ROOT VARIABLES & THEMES
======================================== */
:root {
    /* Dark Mode Colors (Default) */
    --background-color: #0d0d0d;
    --text-color: #e0e0e0;
    --primary-color: #a7a7a7;
    --primary-text-color: #0d0d0d;
    --secondary-color: #4c86af;
    --accent-color: #4c86af;
    --neutral-color: #B0BEC5;
    --hover-color: #ffffff;
    --header-bg: rgba(0, 0, 0, 0.5);
    --card-bg: rgba(20, 20, 20, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.05);
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-dark: rgba(0, 0, 0, 0.4);
    --gradient-opacity: 0.5;
    --highlight-color: #4c86af;
}

body.light-mode {
    --background-color: #f0f2f5;
    --text-color: #333;
    --primary-color: #607D8B;
    --primary-text-color: white;
    --secondary-color: #388d8e;
    --accent-color: #6486a9;
    --neutral-color: #90A4AE;
    --hover-color: #424242;
    --header-bg: rgba(255, 255, 255, 0.7);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(0, 0, 0, 0.03);
    --shadow-light: rgba(255, 255, 255, 0.8);
    --shadow-dark: rgba(0, 0, 0, 0.15);
    --gradient-opacity: 0.2;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.7;
    transition: background-color 0.4s ease, color 0.4s ease;
    position: relative;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Arabic Font */
body.ar {
    direction: rtl;
    text-align: right;
    font-family: 'Tajawal', system-ui, sans-serif;
}

/* ========================================
   ANIMATIONS - KEYFRAMES
======================================== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

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

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes backgroundPan {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

@keyframes themeFade {
    0% { opacity: 1; }
    50% { opacity: 0.95; }
    100% { opacity: 1; }
}

@keyframes inputGlow {
    0% {
        box-shadow: 0 0 5px rgba(76, 134, 175, 0.3), inset 0 0 5px rgba(76, 134, 175, 0.1);
    }
    50% {
        box-shadow: 0 0 15px rgba(76, 134, 175, 0.6), inset 0 0 8px rgba(76, 134, 175, 0.2);
    }
    100% {
        box-shadow: 0 0 5px rgba(76, 134, 175, 0.3), inset 0 0 5px rgba(76, 134, 175, 0.1);
    }
}

@keyframes inputGlowLight {
    0% {
        box-shadow: 0 0 5px rgba(100, 134, 169, 0.2), inset 0 0 5px rgba(100, 134, 169, 0.05);
    }
    50% {
        box-shadow: 0 0 15px rgba(100, 134, 169, 0.4), inset 0 0 8px rgba(100, 134, 169, 0.15);
    }
    100% {
        box-shadow: 0 0 5px rgba(100, 134, 169, 0.2), inset 0 0 5px rgba(100, 134, 169, 0.05);
    }
}

/* ========================================
   BACKGROUND ANIMATION
======================================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, var(--accent-color) 0%, transparent 25%),
                radial-gradient(circle at bottom right, var(--secondary-color) 0%, transparent 25%);
    background-size: 200% 200%;
    opacity: var(--gradient-opacity);
    animation: backgroundPan 30s ease-in-out infinite alternate;
    z-index: -2;
    pointer-events: none;
}

/* ========================================
   HEADER
======================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5vw;
    position: sticky;
    top: 0;
    width: 100%;
    background-color: var(--header-bg);
    backdrop-filter: blur(15px) saturate(1.8);
    -webkit-backdrop-filter: blur(15px) saturate(1.8);
    z-index: 999;
    box-shadow: 0 4px 20px var(--shadow-dark);
    border-bottom: 1px solid var(--card-border);
    transition: background-color 0.4s ease;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-color);
    letter-spacing: -0.05em;
    transition: color 0.3s ease;
}

header h1:hover {
    color: var(--accent-color);
}

/* RTL Header */
body.ar header {
    flex-direction: row-reverse;
}

body.ar header h1 {
    padding-left: 20px;
    padding-right: unset;
}

/* ========================================
   NAVIGATION
======================================== */
nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-grow: 1;
    justify-content: center;
}

nav a {
    font-size: 1.05rem;
    letter-spacing: 0.05rem;
    text-decoration: none;
    color: var(--text-color);
    position: relative;
    padding: 0.5rem 0;
    transition: color 0.3s ease, transform 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    transition: width 0.4s ease;
}

nav a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

nav a:hover::after {
    width: 100%;
}

/* ========================================
   HEADER ACTIONS
======================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-direction: row;
    direction: ltr;
}

.lang-select {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    padding: 0.6rem 2.2rem 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23e0e0e0'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.99l3.71-3.76a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1.1em;
    transition: all 0.3s ease;
    min-width: 110px;
}

body.light-mode .lang-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23333'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.99l3.71-3.76a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
}

body.ar .lang-select {
    padding: 0.6rem 1.2rem 0.6rem 2.2rem;
    background-position: left 0.8rem center;
}

.lang-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.4);
}

/* Theme Toggle Button */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.15);
}

.btn-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.icon-light-mode { display: block; }
.icon-dark-mode { display: none; }

body.light-mode .icon-light-mode { display: none; }
body.light-mode .icon-dark-mode { display: block; }

/* Signing Button */
.btn-signing {
    background: linear-gradient(135deg, var(--primary-color), var(--neutral-color));
    color: var(--primary-text-color);
    padding: 0.9rem 2.2rem;
    border-radius: 50px;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 15px var(--shadow-dark);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-signing:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 25px var(--shadow-dark), 0 0 20px var(--accent-color);
}

/* ========================================
   MAIN CONTENT
======================================== */
main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 8rem);
    padding-bottom: 4rem;
    position: relative;
    z-index: 10;
}

.content {
    max-width: 75rem;
    margin: 0 auto;
    padding: 0 2.5rem;
    text-align: center;
}

/* ========================================
   HERO SECTION
======================================== */
.hero-section {
    padding-top: 3rem;
}

.tag-box {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background-color: var(--secondary-color);
    padding: 0.6rem 1.8rem;
    border-radius: 50px;
    margin-top: 2.5rem;
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    opacity: 1;
}

main h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
    opacity: 1;
}

.description {
    font-size: 1.25rem;
    line-height: 1.9;
    margin-bottom: 2.5rem;
    color: var(--text-color);
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    opacity: 1;
}

.buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 2.5rem;
    opacity: 1;
}

.btn-get-started {
    background-color: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 0.9rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 400;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--shadow-dark);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-get-started:hover {
    background-color: var(--accent-color);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-dark);
}

/* ========================================
   SECTION TITLES
======================================== */
.section-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 2rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-top: 5rem;
    opacity: 1;
}

.section-subtitle {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* ========================================
   CARDS - UNIFIED STYLING
======================================== */
.card,
.vmv-item, 
.feature-item, 
.value-card, 
.team-member, 
.resource-item, 
.doc-item, 
.contact-item, 
.welcome-message {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow-dark);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px) saturate(1.5);
    -webkit-backdrop-filter: blur(10px) saturate(1.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 1;
}

.card:hover,
.vmv-item:hover, 
.feature-item:hover, 
.value-card:hover, 
.team-member:hover, 
.resource-item:hover, 
.doc-item:hover, 
.contact-item:hover, 
.welcome-message:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-dark), 0 0 20px var(--accent-color);
    border-color: var(--accent-color);
}

/* Card Headers */
.feature-item h3,
.resource-item h3,
.doc-item h3,
.contact-item h3,
.welcome-message h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Card Text */
.feature-item p,
.resource-item p,
.doc-item p,
.contact-item p,
.welcome-message p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 1rem;
}

/* Card Icons */
.feature-item i,
.resource-item i,
.doc-item i {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: block;
}

/* ========================================
   GRIDS
======================================== */
.features-grid,
.resources-grid,
.docs-grid,
.contact-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    justify-items: center;
}

/* Projects Grid - Custom Layout */
.resources-grid {
    grid-template-columns: repeat(2, 1fr);
}

.resources-grid .resource-item:nth-child(1),
.resources-grid .resource-item:nth-child(2),
.resources-grid .resource-item:nth-child(3),
.resources-grid .resource-item:nth-child(4),
.resources-grid .resource-item:nth-child(5) {
    grid-column: span 2;
}

/* Languages Grid - 3 columns */
#languages .docs-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Full Width Experience Card */
.full-width-experience {
    grid-column: 1 / -1;
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   BADGES
======================================== */
.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.8rem;
    justify-content: center;
}

.badge {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
}

.badge:hover {
    background-color: var(--accent-color);
    color: var(--primary-text-color);
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-color);
}

body.light-mode .badge {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .badge:hover {
    background-color: var(--accent-color);
    color: white;
}

/* ========================================
   PROJECT IMAGES GRID
======================================== */
.project-images-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.project-images-grid img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 15px var(--shadow-dark);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.project-images-grid img:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

/* ========================================
   PROJECT META & TECH
======================================== */
.project-meta {
    font-size: 0.95rem;
    color: var(--neutral-color);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.project-tech {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--neutral-color);
    line-height: 1.6;
}

.confidential-note {
    font-size: 0.9rem;
    color: var(--neutral-color);
    font-style: italic;
    margin-top: 1rem;
    padding: 0.8rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* ========================================
   EXPERIENCE SECTION
======================================== */
.experience-section .doc-item ul {
    list-style: none;
    padding-left: 0;
    text-align: left;
}

body.ar .experience-section .doc-item ul {
    text-align: right;
    padding-right: 0;
}

.experience-section .doc-item ul li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
    line-height: 1.7;
}

body.ar .experience-section .doc-item ul li {
    padding-left: 0;
    padding-right: 25px;
}

.experience-section .doc-item ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    background-color: var(--highlight-color);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--highlight-color);
}

body.ar .experience-section .doc-item ul li::before {
    left: auto;
    right: 0;
}

.company-name {
    font-size: 1rem;
    color: var(--neutral-color);
    margin-bottom: 1rem;
}

/* ========================================
   CONTACT SECTION
======================================== */
.contact-item .icon-wrapper-small {
    margin-bottom: 0.8rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.3s ease;
}

.contact-item .icon-wrapper-small i {
    font-size: 28px;
    color: white;
}

.contact-item .icon-wrapper-small:hover {
    background-color: var(--accent-color);
    transform: scale(1.1);
}

.contact-item p a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item p a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Phone number fix for RTL */
body.ar .contact-item p a[href^="tel:"] {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

/* ========================================
   CONTACT FORM
======================================== */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 550px;
    margin: 3rem auto 0 auto;
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-dark);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px) saturate(1.5);
    -webkit-backdrop-filter: blur(12px) saturate(1.5);
}

.contact-form input,
.contact-form textarea {
    padding: 1.2rem;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background-color: transparent;
    color: var(--text-color);
    font-size: 1.05rem;
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: all 0.3s ease;
    direction: ltr;
}

/* RTL support for Arabic form inputs */
body.ar .contact-form .form-input:not(.form-input-ltr) {
    direction: rtl;
    text-align: right;
}

/* Email always stays LTR */
.contact-form .form-input-ltr {
    direction: ltr !important;
    text-align: left !important;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: var(--primary-color);
    opacity: 0.7;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.3);
    background-color: rgba(255, 255, 255, 0.03);
}

.contact-form textarea {
    resize: vertical;
}

.contact-form .btn-submit {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    border: none;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 6px 15px var(--shadow-dark);
    transition: all 0.3s ease;
}

.contact-form .btn-submit:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-dark);
}

/* ========================================
   SOCIAL MEDIA LINKS
======================================== */
.social-media-links {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-media-links .section-subtitle {
    width: 100%;
    margin-bottom: 1rem;
}

.social-media-links a img.social-icon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(0.8) contrast(1.2);
}

body.light-mode .social-media-links a img.social-icon-img {
    filter: brightness(0.4) contrast(1.5);
}

.social-media-links a:hover img.social-icon-img {
    transform: translateY(-8px) scale(1.2);
    filter: none;
}

/* ========================================
   CHATBOT
======================================== */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: popIn 0.5s ease-out forwards 2s;
    transform: scale(0);
}

.chatbot-button:hover {
    transform: scale(1.15) translateY(-5px);
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
}

.chatbot-tooltip {
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%) translateY(-10px);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chatbot-button:hover .chatbot-tooltip {
    opacity: 1;
    transform: translateX(50%) translateY(-20px);
}

/* RTL Chatbot Button */
body.ar .chatbot-button {
    left: 30px;
    right: auto;
}

/* Chatbot Modal */
.chatbot-modal {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-dark);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px) saturate(1.8);
    -webkit-backdrop-filter: blur(15px) saturate(1.8);
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 1000;
    opacity: 0;
    visibility: visible;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.chatbot-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

body.ar .chatbot-modal {
    left: 30px;
    right: auto;
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
    border-radius: 15px 15px 0 0;
}

body.ar .chatbot-header {
    flex-direction: row-reverse;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Button styles moved to unified button rules above */

.chatbot-messages {
    flex: 1;
    min-height: 0;
    padding: 1.2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background-color: rgba(0, 0, 0, 0.1);
}

.message {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message {
    background-color: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background-color: var(--primary-color);
    color: var(--primary-text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

body.ar .user-message {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 12px;
}

body.ar .ai-message {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 12px;
}

.chatbot-input-area {
    display: flex;
    padding: 1rem;
    gap: 0.8rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--card-border);
    flex-shrink: 0;
    min-height: 70px;
    border-radius: 0 0 15px 15px;
}

body.ar .chatbot-input-area {
    flex-direction: row-reverse;
}

.chatbot-input-area input {
    flex: 1;
    min-width: 0;
    padding: 0.8rem 1rem;
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    animation: inputGlow 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.chatbot-input-area input::placeholder {
    color: var(--accent-color);
    opacity: 0.7;
    font-weight: 500;
}

body.light-mode .chatbot-input-area input {
    border: 2px solid var(--accent-color);
    animation: inputGlowLight 3s ease-in-out infinite;
}

body.light-mode .chatbot-input-area input::placeholder {
    color: var(--accent-color);
    opacity: 0.8;
    font-weight: 500;
}

body.ar .chatbot-input-area input {
    text-align: right;
}

.chatbot-input-area input:focus {
    outline: none;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(76, 134, 175, 0.8), inset 0 0 10px rgba(76, 134, 175, 0.3);
    animation: none;
}

body.light-mode .chatbot-input-area input:focus {
    box-shadow: 0 0 20px rgba(100, 134, 169, 0.6), inset 0 0 10px rgba(100, 134, 169, 0.2);
}

.send-chatbot-btn {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    min-width: 45px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-chatbot-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    background-color: transparent;
    border-radius: 12px;
    align-self: flex-start;
}

.thinking-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.thinking-spinner {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: radarGlow 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    flex-shrink: 0;
}

.thinking-text-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.thinking-text {
    color: var(--primary-text-color);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    display: inline-block;
    min-width: 80px;
    background: linear-gradient(90deg, var(--primary-text-color), var(--primary-text-color) 20%, rgba(255, 255, 255, 0.8) 50%, var(--primary-text-color) 80%, var(--primary-text-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerText 3.5s ease-in-out infinite;
}

.thinking-dots {
    display: inline-flex;
    gap: 3px;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-text-color);
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out;
    opacity: 0.7;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }
.thinking-dot:nth-child(3) { animation-delay: 0s; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmerText {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes radarGlow {
    0%, 100% {
        box-shadow: 0 0 8px var(--accent-color), inset 0 0 8px rgba(76, 134, 175, 0.3);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 16px var(--accent-color), inset 0 0 12px rgba(76, 134, 175, 0.6);
        opacity: 0.8;
    }
}

@keyframes dotBounce {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

/* ========================================
   CHAT OVERLAY (FOR EXPANDED MODE)
======================================== */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.chat-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ========================================
   EXPANDED CHAT MODE ICONS & BUTTONS with UNIFIED STYLES in .expand-btn and .close-chatbot-btn
======================================== */
.chatbot-header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.expand-btn,
.close-chatbot-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    position: relative;
}

.expand-icon {
    width: 22px;
    height: 22px;
    filter: brightness(0) saturate(100%);
}

body.dark-mode .expand-icon {
    filter: brightness(0) saturate(100%) invert(1);
}

.expand-btn svg,
.close-chatbot-btn svg {
    width: 24px;
    height: 24px;
    color: var(--text-color);
    stroke: var(--text-color);
}

.expand-btn:hover,
.close-chatbot-btn:hover {
    color: var(--accent-color);
    background-color: rgba(76, 134, 175, 0.25);
    transform: scale(1.15);
}

.expand-btn:active,
.close-chatbot-btn:active {
    transform: scale(0.98);
}

/* Expanded chat modal state is this in here*/
.chatbot-modal.expanded {
    position: fixed;
    top: 50%;
    left: 50% !important;
    right: auto !important;
    bottom: auto;
    transform: translate(-50%, -50%) !important;
    width: 650px;
    height: 550px;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

/* Ensure Arabic doesn't change expanded position */
body.ar .chatbot-modal.expanded {
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
}

@keyframes expandChat {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes shrinkChat {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

/* ========================================
   IMAGE MODAL
======================================== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.image-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.modal-image {
    width: 100%;
    height: 100%;
    max-width: 800px;
    max-height: 600px;
    object-fit: contain;
    border-radius: 10px;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #333;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #333;
    transition: all 0.3s ease;
}

.modal-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.modal-prev { left: -60px; }
.modal-next { right: -60px; }

.image-counter {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 14px;
    color: #333;
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

/* Large Screens */
@media (max-width: 1200px) {
    header h1 { font-size: 2.2rem; }
    main h1 { font-size: 3.5rem; }
    .section-title { font-size: 3rem; }
}

/* Medium Screens */
@media (max-width: 1024px) {
    header { 
        padding: 1rem 2vw;
    }
    header h1 { font-size: 1.9rem; }
    nav { gap: 0.8rem; }
    main h1 { font-size: 2.8rem; }
    .description { 
        font-size: 1.05rem;
        margin-bottom: 2rem;
    }
    .section-title { font-size: 2.5rem; }
    
    .features-grid,
    .resources-grid,
    .docs-grid,
    .contact-info-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .resources-grid .resource-item:nth-child(1),
    .resources-grid .resource-item:nth-child(2),
    .resources-grid .resource-item:nth-child(3),
    .resources-grid .resource-item:nth-child(4),
    .resources-grid .resource-item:nth-child(5) {
        grid-column: span 1;
    }
    
    .project-images-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablets */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        padding: 1rem 2vw;
        gap: 0.8rem;
        position: static;
    }
    
    body.ar header {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 0.4rem;
        padding: 0 !important;
    }
    
    nav {
        flex-wrap: wrap;
        margin: 0.4rem 0;
        gap: 0.6rem;
    }
    
    nav a {
        font-size: 0.9rem;
    }
    
    .header-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }
    
    .content {
        padding: 0 1.5rem;
        max-width: 100%;
    }
    
    main h1 {
        font-size: 2.3rem;
        margin-bottom: 1rem;
    }
    
    .tag-box {
        margin-top: 2.5rem;
        margin-bottom: 1.5rem;
    }
    
    .description {
        font-size: 1.02rem;
        margin-bottom: 1.8rem;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
    
    .btn-signing,
    .btn-get-started {
        width: 85%;
        max-width: 320px;
    }
    
    .section-title {
        font-size: 2.2rem;
        margin-top: 3.5rem;
        margin-bottom: 1.5rem;
    }
    
    .features-grid,
    .resources-grid,
    .docs-grid,
    .contact-info-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    #languages .docs-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .project-images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .card,
    .feature-item,
    .resource-item,
    .doc-item,
    .contact-item,
    .welcome-message {
        padding: 1.3rem;
        max-width: 100%;
    }
    
    .contact-form {
        padding: 1.3rem;
        margin-top: 1.8rem;
    }
    
    .chatbot-modal {
        width: 80vw;
        height: 65vh;
        bottom: 90px;
        right: 10vw;
        left: auto;
    }
    
    body.ar .chatbot-modal {
        left: 10vw;
        right: auto;
    }
    
    .modal-prev { left: 10px; }
    .modal-next { right: 10px; }
    
    /* Responsive expanded chat for tablets */
    .chatbot-modal.expanded {
        width: 90vw;
        height: 85vh;
        max-width: 550px;
        bottom: auto;
        right: auto;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) !important;
    }
    
    body.ar .chatbot-modal.expanded {
        left: 50% !important;
        right: auto !important;
    }
}

/* Mobile */
@media (max-width: 480px) {
    header {
        padding: 0.8rem 3vw;
        gap: 0.6rem;
    }
    
    header h1 { 
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }
    
    nav {
        gap: 0.4rem;
        margin: 0.2rem 0;
    }
    
    nav a {
        font-size: 0.75rem;
        padding: 0.2rem 0.3rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .lang-select {
        padding: 0.4rem 1.6rem 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 90px;
    }
    
    body.ar .lang-select {
        padding: 0.4rem 0.6rem 0.4rem 1.6rem;
        background-position: left 0.5rem center;
    }
    
    .btn-icon {
        padding: 0.3rem;
        font-size: 1.3rem;
    }
    
    .btn-signing {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
    
    main h1 { 
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }
    
    .tag-box {
        margin-top: 1.5rem;
        margin-bottom: 1rem;
        padding: 0.4rem 1rem;
        font-size: 0.82rem;
    }
    
    .description {
        font-size: 0.92rem;
        margin-bottom: 1.2rem;
    }
    
    .buttons {
        gap: 0.6rem;
        margin-top: 1.2rem;
    }
    
    .btn-get-started {
        font-size: 0.88rem;
        padding: 0.6rem 1.3rem;
    }
    
    .content {
        padding: 0 1rem;
    }
    
    .section-title { 
        font-size: 1.6rem;
        margin-top: 2rem;
        margin-bottom: 0.8rem;
    }
    
    .section-subtitle {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .card,
    .feature-item,
    .resource-item,
    .doc-item,
    .contact-item,
    .welcome-message {
        padding: 1rem;
    }
    
    .feature-item h3,
    .resource-item h3,
    .doc-item h3,
    .contact-item h3,
    .welcome-message h2 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .feature-item p,
    .resource-item p,
    .doc-item p,
    .contact-item p,
    .welcome-message p {
        font-size: 0.92rem;
        line-height: 1.5;
    }
    
    .project-images-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0.6rem;
    }
    
    #languages .docs-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-form {
        padding: 1rem;
        margin-top: 1.2rem;
        max-width: 100%;
    }
    
    .contact-form input,
    .contact-form textarea {
        padding: 0.7rem;
        font-size: 0.92rem;
    }
    
    .chatbot-button {
        width: 50px;
        height: 50px;
        font-size: 22px;
        bottom: 20px;
        right: 20px;
    }
    
    body.ar .chatbot-button {
        left: 20px;
        right: auto;
    }
    
    .chatbot-modal {
        width: 85vw;
        height: 55vh;
        bottom: 70px;
        right: 7.5vw;
        left: auto;
        border-radius: 12px;
    }
    
    body.ar .chatbot-modal {
        left: 7.5vw;
        right: auto;
    }

    /* Responsive expanded chat */
    .chatbot-modal.expanded {
        width: 92vw;
        height: 80vh;
        bottom: auto;
        right: auto;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) !important;
    }
    
    body.ar .chatbot-modal.expanded {
        left: 50% !important;
        right: auto !important;
    }
}