/* ===================================
   مجموعة الصافي - ElSafy Group
   Premium Auto Parts Website
   =================================== */

/* CSS Variables */
:root {
    --primary: #e92c2d;
    --primary-dark: #c41e1f;
    --secondary: #0d1926;
    --secondary-light: #1a2d42;
    --accent-gold: #d4a84b;
    --white: #ffffff;
    --light-gray: #f5f7fa;
    --text-dark: #1a1a1a;
    --text-muted: #6c757d;
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 40px rgba(233, 44, 45, 0.3);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 16px;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: var(--white);
    color: var(--text-dark);
    line-height: 1.7;
    direction: rtl;
    width: 100%;
    overflow-x: hidden !important;
    position: relative;
    padding-top: 80px;
    /* Space for fixed navbar */
}

/* Force Reset Layout */
html {
    overflow-x: hidden;
    width: 100%;
}

/* Container */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

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

img {
    max-width: 100%;
    height: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border: 2px solid var(--white);
}

.btn-secondary:hover {
    background: var(--white);
    color: var(--secondary);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

/* ===================================
   NAVBAR - ULTRA STABLE FIXED LAYOUT
   =================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: auto;
    min-height: 90px;
    z-index: 99999;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar-brand {
    display: block;
    flex-shrink: 0;
    padding: 5px 0;
}

.navbar-brand img {
    height: 90px;
    width: auto;
    display: block;
    transition: height 0.3s ease;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 35px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: #0d1926;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #e92c2d;
}

/* Mobile Toggle - Hidden on Desktop */
.mobile-toggle {
    display: none;
    width: 45px;
    height: 45px;
    background: #e92c2d;
    border: none;
    border-radius: 10px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-toggle span {
    display: block;
    width: 22px;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ===================================
   MOBILE RESPONSIVE - NAVBAR
   =================================== */
@media screen and (max-width: 992px) {
    .navbar {
        padding: 10px 0;
        min-height: 100px;
        /* Increased to fit larger logo */
    }

    .navbar-brand img {
        height: 80px;
        /* Increased from 50px */
    }

    /* Hide desktop menu */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(180deg, #0d1926 0%, #1a2d42 100%);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 80px 20px 30px;
        margin: 0;
        transition: right 0.35s ease-in-out;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
        z-index: 9998;
        overflow-y: auto;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link {
        display: block;
        color: #ffffff;
        padding: 18px 15px;
        font-size: 1.1rem;
    }

    .nav-link:hover {
        color: #e92c2d;
        background: rgba(255, 255, 255, 0.05);
    }

    /* Show mobile toggle */
    .mobile-toggle {
        display: flex;
    }

    .mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
    min-height: 100vh;
    background: linear-gradient(rgba(13, 25, 38, 0.85), rgba(13, 25, 38, 0.9)), url('../images/hero-bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to top, var(--white), transparent);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    padding-top: 100px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(233, 44, 45, 0.15);
    border: 1px solid rgba(233, 44, 45, 0.3);
    padding: 10px 24px;
    border-radius: 50px;
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 30px;
    animation: fadeInUp 0.8s ease;
}

.hero h1 {
    color: var(--white);
    margin-bottom: 25px;
    animation: fadeInUp 0.8s ease 0.2s backwards;
}

.hero h1 span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.3rem;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease 0.4s backwards;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease 0.6s backwards;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 80px;
    animation: fadeInUp 0.8s ease 0.8s backwards;
}

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

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* ===================================
   SECTION STYLES
   =================================== */
.section {
    padding: 100px 0;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(233, 44, 45, 0.1);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.section-header h2 {
    color: var(--secondary);
    margin-bottom: 15px;
}

.section-header p {
    font-size: 1.15rem;
}

.bg-light {
    background: var(--light-gray);
}

.bg-dark {
    background: var(--secondary);
}

/* ===================================
   ABOUT SECTION
   =================================== */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.about-image {
    position: relative;
}

.about-image img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.about-image::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100%;
    height: 100%;
    border: 3px solid var(--primary);
    border-radius: var(--border-radius);
    z-index: -1;
}

.experience-badge {
    position: absolute;
    bottom: -30px;
    left: -30px;
    background: var(--gradient-primary);
    color: var(--white);
    padding: 25px 35px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.experience-badge .number {
    font-size: 3rem;
    font-weight: 800;
    display: block;
}

.experience-badge .text {
    font-size: 1rem;
}

.about-content h2 {
    color: var(--secondary);
    margin-bottom: 25px;
}

.about-content p {
    margin-bottom: 30px;
}

.about-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 35px;
}

.about-feature {
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-feature i {
    width: 40px;
    height: 40px;
    background: rgba(233, 44, 45, 0.1);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.about-feature span {
    font-weight: 600;
    color: var(--secondary);
}

/* ===================================
   COMPANIES SECTION
   =================================== */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.company-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
}

.company-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.company-card-image {
    overflow: hidden;
    position: relative;
}

.company-card-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: var(--transition);
}

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

.company-card-overlay {
    display: none;
}

.company-card-content {
    padding: 30px;
}

.company-card-content h3 {
    color: var(--secondary);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.company-card-content p {
    margin-bottom: 20px;
    font-size: 1rem;
}

.company-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
}

.company-card-footer a {
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.company-card-footer a:hover {
    gap: 12px;
}

/* ===================================
   SERVICES SECTION
   =================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid transparent;
}

.service-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
}

.service-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 25px;
    background: rgba(233, 44, 45, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.service-icon i {
    font-size: 2.5rem;
    color: var(--primary);
}

.service-card:hover .service-icon {
    background: var(--gradient-primary);
}

.service-card:hover .service-icon i {
    color: var(--white);
}

.service-card h3 {
    color: var(--secondary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.service-card p {
    font-size: 1rem;
}

/* ===================================
   BRANCHES SECTION
   =================================== */
.branches-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.branch-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.branch-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.branch-image {
    overflow: hidden;
}

.branch-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: var(--transition);
}

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

.branch-content {
    padding: 30px;
}

.branch-content h3 {
    color: var(--secondary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.branch-content h3 i {
    color: var(--primary);
}

.branch-content p {
    margin-bottom: 20px;
}

.branch-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 600;
}

.branch-link:hover {
    gap: 15px;
}

/* ===================================
   STATS SECTION
   =================================== */
.stats-section {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    padding: 80px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.stats-item {
    text-align: center;
    padding: 30px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-item:last-child {
    border-right: none;
}

.stats-item i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.stats-item .number {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--white);
    display: block;
    margin-bottom: 10px;
}

.stats-item .label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

/* ===================================
   CONTACT SECTION
   =================================== */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-info h2 {
    color: var(--secondary);
    margin-bottom: 20px;
}

.contact-info>p {
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 25px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.contact-item:hover {
    background: var(--white);
    box-shadow: var(--shadow-md);
}

.contact-item i {
    width: 55px;
    height: 55px;
    background: var(--gradient-primary);
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.contact-item-content h4 {
    color: var(--secondary);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.contact-item-content p {
    font-size: 1rem;
    margin: 0;
}

.contact-item-content a {
    color: var(--primary);
    font-weight: 600;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 40px;
}

.social-link {
    width: 50px;
    height: 50px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary);
    transform: translateY(-5px);
}

.contact-map {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    height: 100%;
    min-height: 450px;
}

.contact-map iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    background: var(--secondary);
    color: var(--white);
    padding-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 50px;
    padding-bottom: 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand img {
    height: 80px;
    margin-bottom: 25px;
    filter: brightness(0) invert(1);
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
}

.footer-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--white);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
    padding-right: 10px;
}

.footer-contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.7);
}

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

.footer-bottom {
    padding: 25px 0;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
}

.footer-bottom a {
    color: var(--primary);
}

/* ===================================
   WHATSAPP BUTTON - COMPLETELY ISOLATED FIXED ELEMENT
   =================================== */
/* ===================================
   WHATSAPP BUTTON - COMPLETELY ISOLATED FIXED ELEMENT
   =================================== */
.whatsapp-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 70px;
    height: 70px;
    background-color: #25D366;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 99999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse 2s infinite;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.6);
}

@media screen and (max-width: 768px) {
    .whatsapp-btn {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
        font-size: 1.6rem;
    }
}

/* ===================================
   SCROLL TOP BUTTON - ISOLATED FIXED ELEMENT
   =================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 50px;
    height: 50px;
    background-color: var(--secondary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.scroll-top-btn.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(233, 44, 45, 0.4);
    color: #ffffff;
}

@media screen and (max-width: 768px) {
    .scroll-top-btn {
        width: 45px;
        height: 45px;
        bottom: 20px;
        left: 20px;
        font-size: 1.1rem;
    }
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-item {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@media screen and (max-width: 992px) {

    .about-grid,
    .branches-grid,
    .contact-wrapper {
        grid-template-columns: 1fr;
    }

    .about-image {
        order: -1;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .hero-stats {
        flex-direction: column;
        gap: 30px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    .companies-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

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

    .section {
        padding: 70px 0;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .btn {
        padding: 14px 28px;
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0 20px;
    }

    .hero-buttons .btn {
        width: 100%;
    }
}