/* --- Global Variables & Styles --- */
:root {
    --primary-blue: #003366;
    --secondary-red: #E63946;
    --whatsapp-green: #25D366;
    --accent-gray: #f4f4f4;
    --dark-gray: #333;
    --light-text: #f0f0f0;
    --main-font: 'Tajawal', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--main-font);
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: #fff;
    overflow-x: hidden;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary-blue);
}

.bg-light {
    background-color: var(--accent-gray);
}

/* --- Loader --- */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-text);
    border-top-color: var(--secondary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Scroll Animations --- */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.fade-in { transform: translateY(30px); }
.animate-on-scroll.slide-in-left { transform: translateX(-50px); }
.animate-on-scroll.slide-in-right { transform: translateX(50px); }
.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); }
.btn-primary { background: linear-gradient(45deg, var(--secondary-red), #ff6b6b); color: #fff; }
.btn-secondary { background-color: var(--primary-blue); color: #fff; }
.btn-secondary:hover { background-color: #002244; }
.btn-whatsapp { background: linear-gradient(45deg, var(--whatsapp-green), #128C7E); color: #fff; font-size: 1.1rem; padding: 16px 40px; }
.btn-whatsapp i { margin-left: 10px; }

/* --- Header & Navigation (Desktop Default) --- */
header { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1); position: fixed; width: 100%; top: 0; z-index: 1000; }
header .container { display: flex; justify-content: center; align-items: center; padding: 15px 20px; }
.logo img { height: 60px; width: auto; transition: transform 0.3s ease; }
.logo:hover img { transform: scale(1.05); }

.main-nav { position: absolute; top: 100%; left: 0; width: 100%; background: var(--primary-blue); transform: translateY(-100vh); transition: transform 0.4s ease-in-out; }
.main-nav.nav-open { transform: translateY(0); }
.nav-links { list-style: none; text-align: center; padding: 20px 0; }
.nav-links li { margin: 15px 0; }
.nav-links a { color: var(--light-text); text-decoration: none; font-size: 1.2rem; font-weight: 500; transition: color 0.3s ease; position: relative; }
.nav-links a::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 0; height: 2px; background: var(--secondary-red); transition: all 0.3s ease; transform: translateX(-50%); }
.nav-links a:hover::after { width: 80%; }

.nav-toggle { display: block; position: absolute; top: 50%; left: 20px; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: 5px; z-index: 1001; }
.hamburger { display: block; position: relative; width: 25px; height: 3px; background: var(--primary-blue); transition: all 0.3s ease-in-out; }
.hamburger::before, .hamburger::after { content: ''; position: absolute; width: 25px; height: 3px; background: var(--primary-blue); transition: all 0.3s ease-in-out; }
.hamburger::before { transform: translateY(-8px); }
.hamburger::after { transform: translateY(8px); }

/* --- Hero Section (Desktop Default) --- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; color: var(--light-text); padding-top: 80px; overflow: hidden; }
.hero-bg { position: absolute; top: -20px; left: 0; width: 100%; height: 120%; background: url('https://mansourcars.com/banner.jpeg') no-repeat center center/cover; z-index: -2; }
.hero::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(rgba(0, 51, 102, 0.8), rgba(0, 51, 102, 0.8)); z-index: -1; }
.hero-content { display: flex; justify-content: space-between; align-items: center; gap: 40px; position: relative; z-index: 1; }
.hero-text { flex: 1; }
.hero-text h1 { font-size: 3.5rem; font-weight: 700; margin-bottom: 20px; line-height: 1.2; }
.hero-text p { font-size: 1.2rem; max-width: 600px; margin-bottom: 30px; }
.hero-buttons { display: flex; justify-content: flex-start; gap: 20px; flex-wrap: wrap; }
.hero-image { flex: 1; max-width: 450px; }
.hero-image img { width: 100%; border-radius: 15px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); }

/* --- About Us Section (Desktop Default) --- */
.about-content { display: flex; align-items: center; gap: 40px; }
.about-text { flex: 1; }
.about-text h2 { font-size: 2.2rem; color: var(--primary-blue); margin-bottom: 20px; }
.about-image { flex: 1; }
.about-image img { width: 100%; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }

/* --- Main Services Section (Desktop Default) --- */
.main-services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 40px; }
.main-service-card { background: #fff; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.08); transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; }
.main-service-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.12); }
.main-service-card img { width: 100%; height: 250px; object-fit: cover; }
.main-service-card .card-content { padding: 30px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.main-service-card h3 { font-size: 1.8rem; color: var(--primary-blue); margin-bottom: 15px; }
.main-service-card p { font-size: 1rem; color: #555; margin-bottom: 25px; }

/* --- Other Services Overview Section (Desktop Default) --- */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
.service-card { background: #fff; padding: 30px; text-align: center; border-radius: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); transition: all 0.4s ease; }
.service-card:hover { transform: translateY(-15px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); }
.service-img { height: 150px; width: 100%; object-fit: cover; border-radius: 10px; margin-bottom: 25px; }
.service-card h3 { font-size: 1.5rem; margin-bottom: 15px; color: var(--dark-gray); }

/* --- Buy & Sell CTA Section (Desktop Default) --- */
#buy-sell-cta {
    background: url('https://mansourcars.com/buy-sell-cars1.jpeg') no-repeat center center/cover;
    background-attachment: fixed;
    position: relative;
    color: var(--light-text);
}
#buy-sell-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 0;
}
.buy-sell-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    position: relative;
    z-index: 1;
}
.buy-sell-text { flex: 1; }
.buy-sell-text h2 { font-size: 2.5rem; margin-bottom: 20px; }
.buy-sell-text p { font-size: 1.1rem; line-height: 1.8; margin-bottom: 30px; }
.buy-sell-image { flex: 1; max-width: 450px; }
.buy-sell-image img { width: 100%; border-radius: 15px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); }

/* --- CTA Section --- */
#cta { background: linear-gradient(45deg, var(--primary-blue), #004080); color: var(--light-text); text-align: center; }
#cta h2 { font-size: 2.5rem; margin-bottom: 15px; }
#cta p { font-size: 1.2rem; max-width: 600px; margin: 0 auto 30px auto; }

/* --- Contact Section (Desktop Default) --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.contact-info h3 { font-size: 1.8rem; color: var(--primary-blue); margin-bottom: 25px; }
.info-item { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; font-size: 1.1rem; }
.info-item i { font-size: 1.5rem; color: var(--secondary-red); width: 30px; text-align: center; }
.info-item a { color: var(--primary-blue); text-decoration: none; transition: color 0.3s ease; }
.info-item a:hover { color: var(--secondary-red); }
.social-link { display: inline-flex; align-items: center; gap: 10px; background-color: #1877f2; color: #fff !important; padding: 12px 25px; border-radius: 50px; margin-top: 15px; transition: all 0.3s ease; }
.social-link:hover { background-color: #166fe5; transform: translateY(-3px); }

/* --- Professional Contact Form --- */
.contact-form-wrapper h3 { font-size: 1.8rem; color: var(--primary-blue); margin-bottom: 25px; }
.contact-form { display: flex; flex-direction: column; gap: 25px; }
.form-group { position: relative; }
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: var(--main-font);
    font-size: 1rem;
    background: #fff;
    transition: all 0.3s ease;
}
.form-group label {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}
.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
    top: -10px;
    right: 10px;
    background: var(--accent-gray);
    padding: 0 5px;
    font-size: 0.8rem;
    color: var(--primary-blue);
}
.contact-map { height: 450px; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }

/* --- Floating WhatsApp Button --- */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    left: 40px;
    background-color: var(--whatsapp-green);
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}
.whatsapp-float:hover {
    background-color: #128C7E;
    transform: scale(1.1);
}

/* --- Footer --- */
footer { background: var(--primary-blue); color: var(--light-text); text-align: center; padding: 25px 0; }

/* --- Active Navigation Link --- */
.nav-links a.active { color: var(--secondary-red) !important; font-weight: 700; }

/* =================================================================== */
/* =================== TABLET & DESKTOP RESPONSIVE DESIGN =================== */
/* =================================================================== */

@media (max-width: 992px) {
    .hero-content { flex-direction: column; text-align: center; }
    .hero-text { order: 2; }
    .hero-image { order: 1; max-width: 100%; }
    .hero-text h1 { font-size: 2.8rem; }
    .hero-buttons { justify-content: center; }
    .about-content { flex-direction: column; }
    .main-services-grid { grid-template-columns: 1fr; }
    .buy-sell-content { flex-direction: column; }
    .contact-grid { grid-template-columns: 1fr; }
    .whatsapp-float { bottom: 20px; left: 20px; width: 50px; height: 50px; font-size: 24px;}
}

/* --- DESKTOP NAVIGATION --- */
@media (min-width: 1024px) {
    .nav-toggle { display: none; }
    header .container { justify-content: space-between; }
    .main-nav {
        position: static;
        transform: none;
        background: none;
        width: auto;
    }
    .nav-links {
        display: flex;
        padding: 0;
        gap: 30px;
    }
    .nav-links a {
        color: var(--primary-blue);
    }
}


/* =================================================================== */
/* =================== APP-LIKE MOBILE DESIGN (max-width: 768px) =================== */
/* =================================================================== */

@media (max-width: 768px) {
    
    /* --- General Layout & Spacing --- */
    .section-padding { padding: 50px 0; }
    .container { padding: 0 25px; }

    /* --- Full-Screen Sections --- */
    #home, #about, #main-services, #buy-sell-cta, #cta {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        scroll-snap-align: start; /* For smooth scrolling effect */
    }
    
    /* --- Typography --- */
    .section-title { font-size: 2.2rem; margin-bottom: 30px; }
    .hero-text h1 { font-size: 2.5rem; }
    .hero-text p { font-size: 1.1rem; }
    .about-text h2, .buy-sell-text h2 { font-size: 2rem; }
    .about-text p, .buy-sell-text p { font-size: 1rem; }

    /* --- Navigation (App-like Slide-in Menu) --- */
    header { padding: 10px 0; }
    .logo img { height: 50px; }
    .main-nav {
        position: fixed; /* Override desktop */
        top: 0;
        right: -100%; /* Start off-screen */
        width: 85%;
        height: 100vh;
        background: var(--primary-blue);
        transition: right 0.4s ease-in-out;
        z-index: 1001;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2);
        transform: none; /* Override desktop */
    }
    .main-nav.nav-open { right: 0; }
    .nav-links {
        padding-top: 100px; /* Account for header height */
        height: 100%;
        overflow-y: auto;
    }
    .nav-links li { margin: 25px 0; }
    .nav-links a { font-size: 1.2rem; padding: 15px; display: block; }

    .nav-toggle {
        position: fixed; /* Override desktop */
        top: 20px;
        right: 20px;
        z-index: 1002;
    }
    
    /* --- Hero Section --- */
    .hero-content {
        flex-direction: column-reverse; /* Image first */
        text-align: center;
        gap: 30px;
    }
    .hero-image { max-width: 90%; }
    .hero-text { width: 100%; }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .btn {
        width: 80%;
        max-width: 300px;
        padding: 16px 20px;
        font-size: 1.1rem;
        display: block; /* Make buttons stack */
    }

    /* --- Content Sections --- */
    .about-content, .buy-sell-content {
        text-align: center;
        flex-direction: column;
    }
    .about-image, .buy-sell-image {
        max-width: 100%;
        margin-top: 30px;
    }
    
    /* --- Cards (Full-width and Spacious) --- */
    .main-services-grid, .services-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .main-service-card, .service-card {
        width: 100%;
        padding: 25px;
    }
    .main-service-card img { height: 200px; }
    .service-img { height: 180px; }
    
    /* --- Contact Section --- */
    .contact-info, .contact-form-wrapper {
        background: #fff;
        padding: 30px;
        border-radius: 15px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.05);
        margin-bottom: 30px;
    }
    .contact-map { height: 300px; }

    /* --- CTA Section --- */
    #cta h2 { font-size: 2rem; }
    #cta p { font-size: 1rem; }
}