/* ==========================================================================
   TABLE OF CONTENTS
   --------------------------------------------------------------------------
   1. Root Variables & Global Base
   2. Utility Classes & Custom Buttons
   3. Header Hero & Static Banners
   4. Hero Slideshow Section
   5. Timeline Component (Includes RTL Support)
   6. Accordions, Cards & Icons
   7. Retro Grid Layout
   8. Client Logo Infinite Carousel (Bootstrap Brain Style)
   9. Service Cards Section (Clean & No Overlays)
   10. Latest News Component
   11. Site Footer Area (Renamed & Refactored)
   ========================================================================== */

/* ==========================================
   1. Root Variables & Global Base
   ========================================== */

   :root {
    --brand-blue: #0B589C;
    --brand-blue-hover: #084378;
    --brand-green: #0F7A4A;
    --brand-green-hover: #0a5a37;
    --brand-gold: #FFC107;
    --brand-light: #EBF3FA;
    --brand-dark: #0b1d33;
}

html {
    scroll-behavior: smooth;
    
}

html[dir="rtl"] body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

html[dir="ltr"] body {
    font-family: 'Roboto', system-ui, -apple-system, sans-serif;
}


/* Loader */
.global-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Logo Animation */
.loader-logo {
    max-width: 240px;
    height: auto;
    animation: logoPulse 2s infinite ease-in-out;
}

/* Spinner matching El Serafy Brand Colors (#0D233A Deep Blue & #107238 Green) */
.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #0d233a; /* Deep Blue from logo */
    border-right: 4px solid #107238; /* Green from logo */
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loader-text {
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: #0d233a !important;
}

/* Hidden State */
.global-loader-overlay.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); opacity: 0.95; }
    50% { transform: scale(1.03); opacity: 1; }
}

/* ==========================================
   2. Utility Classes & Custom Buttons
   ========================================== */
.text-brand-blue {
    color: var(--brand-blue) !important; /* Resolves to #0B589C */
}
.border-brand-blue {
    border-color: var(--brand-blue) !important;
}
.text-brand-green {
    color: var(--brand-green) !important;
}

.bg-brand-blue {
    background-color: var(--brand-blue) !important;
}

.bg-brand-green {
    background-color: var(--brand-green) !important;
}

.bg-brand-light {
    background-color: var(--brand-light) !important;
}

.tracking-wider {
    letter-spacing: 1.5px;
}

.fs-7 {
    font-size: 0.825rem;
}

/* Custom Buttons */
.btn-brand-blue {
    background-color: var(--brand-blue);
    color: #ffffff;
    border: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-brand-blue:hover {
    background-color: var(--brand-blue-hover);
    color: #ffffff;
}

.btn-brand-green {
    background-color: var(--brand-green);
    color: #ffffff;
    border: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-brand-green:hover {
    background-color: var(--brand-green-hover);
    color: #ffffff;
}

/* Auto-flip icons in RTL mode */
html[dir="rtl"] .icon-dir {
    transform: scaleX(-1);
    display: inline-block;
    margin-right: 0 !important;
    margin-left: 0.5rem !important; /* Replaces me-2 in RTL */
}
/* ==========================================
   3. Header Hero & Static Banners
   ========================================== */
   .header-hero {
    min-height: 20rem;
    background-image:
        linear-gradient(rgba(11, 88, 156, 0.75), rgba(11, 88, 156, 0.75)),
        url('../assets/1.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* ==========================================
   4. Hero Slideshow Section (Full Screen 100vh)
   ========================================== */
   .hero-slideshow-section {
    width: 100vw;
    height: 100vh;
    min-height: 600px; /* Ensures items don't overflow on small height devices */
    position: relative;
    overflow: hidden;
    background-color: var(--brand-dark);
}

/* Slide item full-cover background styling */
.hero-slideshow-section .carousel-item {
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.8s ease-in-out !important; /* Smooth fade transitions */
}

/* Content vertical layout positioning */
.hero-slideshow-section .hero-slide-content {
    padding-top: 2rem;
    padding-bottom: 5rem; /* Offsets space for bottom stats overlay */
}

@media (max-width: 991.98px) {
    .hero-slideshow-section .hero-slide-content {
        padding-bottom: 2rem;
    }
}

.hero-slideshow-section .hero-slide-content h1 {
    font-size: 2rem;
    line-height: 1.25;
}

@media (min-width: 768px) {
    .hero-slideshow-section .hero-slide-content h1 {
        font-size: 3rem;
        line-height: 1.2;
    }
}

@media (min-width: 1200px) {
    .hero-slideshow-section .hero-slide-content h1 {
        font-size: 3.5rem;
    }
}

/* Indicators */
.hero-slideshow-section .carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffffff;
    opacity: 0.5;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.hero-slideshow-section .carousel-indicators .active {
    opacity: 1;
    background-color: var(--brand-gold);
}
/* ==========================================
   5. Timeline Component
   ========================================== */
   .tl-container {
    max-width: 1200px;
    margin: 0 auto;
}

.tl-card {
    scale: 0;
    opacity: 0;
    border: none;
    border-radius: 0;
    box-shadow: none !important;
    overflow: hidden;
    animation: fade-in linear forwards;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
}

.left::before,
.right::before {
    scale: 0;
    opacity: 0;
    animation: fade-in linear forwards;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
}

.origin-left {
    transform-origin: 0% 50%;
}

.origin-right {
    transform-origin: 100% 50%;
}

@keyframes fade-in {
    to {
        scale: 1;
        opacity: 1;
    }
}

.tl-img-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    transition: all 0.4s ease;
}

.tl-card:hover .scale {
    transform: scale(1.05);
}

.image-1 {
    background: url('../assets/timeline/foundation.png') 50% 50% no-repeat;
    background-size: cover;
}

.image-2 {
    background: url('../assets/timeline/gcc.png') 50% 50% no-repeat;
    background-size: cover;
}

.image-3 {
    background: url('../assets/timeline/global.png') 50% 50% no-repeat;
    background-size: cover;
}

.image-4 {
    background: url('../assets/timeline/today.png') 50% 50% no-repeat;
    background-size: cover;
}

.main-timeline {
    position: relative;
}

.main-timeline::after {
    content: "";
    position: absolute;
    width: 0px;
    border: 1px dashed DarkGrey;
    top: 0;
    bottom: 0px;
    left: 50%;
    margin-left: -4px;
}

.timeline {
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border: 3px solid #f0f2f5;
    outline: 1px solid DarkGrey;
    right: -11px;
    background-color: var(--brand-blue);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.left {
    padding: 10px 40px 20px 0px;
    left: 0;
}

.right {
    padding: 10px 0px 20px 40px;
    left: 50%;
}

.left::before {
    content: " ";
    position: absolute;
    top: 18px;
    z-index: 1;
    right: 30px;
    border: medium solid white;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
}

.right::before {
    content: "";
    position: absolute;
    top: 18px;
    z-index: 1;
    left: 30px;
    border: medium solid white;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

.right::after {
    left: -11px;
}

/* Timeline RTL Mode Desktop Overrides */
html[dir="rtl"] .timeline.left {
    left: auto;
    right: 0;
    padding: 10px 0px 20px 40px;
}

html[dir="rtl"] .timeline.right {
    left: auto;
    right: 50%;
    padding: 10px 40px 20px 0px;
}

html[dir="rtl"] .timeline::after {
    right: auto;
    left: -11px;
}

html[dir="rtl"] .right::after {
    left: auto;
    right: -11px;
}

html[dir="rtl"] .left::before {
    right: auto;
    left: 30px;
    border-width: 10px 10px 10px 0;
    border-color: transparent white transparent transparent;
}

html[dir="rtl"] .right::before {
    left: auto;
    right: 30px;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent white;
}

/* Mobile Timeline Adjustments (LTR & RTL unified) */
@media screen and (max-width: 700px) {
    .main-timeline::after {
        left: 10px !important;
        right: auto !important;
    }

    .timeline {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        padding-left: 40px !important;
        padding-right: 15px !important;
    }

    .timeline::before {
        left: 30px !important;
        right: auto !important;
        border: medium solid white !important;
        border-width: 10px 10px 10px 0 !important;
        border-color: transparent white transparent transparent !important;
    }

    .timeline::after {
        left: -1px !important;
        right: auto !important;
    }

    .tl-card,
    .origin-left,
    .origin-right {
        transform-origin: center center !important;
    }

    html[dir="rtl"] .timeline {
        padding-right: 40px !important;
        padding-left: 15px !important;
    }

    html[dir="rtl"] .main-timeline::after {
        right: 10px !important;
        left: auto !important;
    }

    html[dir="rtl"] .timeline::before {
        right: 30px !important;
        left: auto !important;
        border-width: 10px 0 10px 10px !important;
        border-color: transparent transparent transparent white !important;
    }

    html[dir="rtl"] .timeline::after {
        right: -1px !important;
        left: auto !important;
    }
}
/* ==========================================
   6. Accordions, Cards & Icons
   ========================================== */
.accordion-button {
    --bs-accordion-border-width: 0;
    --bs-accordion-border-radius: 0;
    --bs-accordion-inner-border-radius: 0;
    font-size: 18px;
    background-color: #efefef;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background-color: var(--brand-blue);
    color: #ffffff;
}

.accordion-button:after {
    margin: 0;
    margin-left: 15px;
}

html[dir="rtl"] .accordion-button::after {
    margin-left: 0;
    margin-right: 15px;
}

.accordion-button:not(.collapsed):after {
    filter: invert(100%) brightness(200%);
}

.accordion-item {
    border: none;
}

/* ==========================================
   7. Retro Grid Layout
   ========================================== */
.retro-layout .v-height {
    height: 240px;
}

.retro-layout .h-entry {
    display: block;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.retro-layout .text {
    position: absolute;
    bottom: 0;
    z-index: 10;
    padding: 20px;
    max-width: 350px;
}

/* ==========================================
   8. Client Logo Carousel (Bootstrap Brain)
   ========================================== */
.client-section {
    position: relative;
}

.bb-logo-slider {
    display: flex;
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 15px 0;
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.bb-logo-track {
    display: flex;
    align-items: center;
    /* 32 total items (16 original + 16 duplicate) * 220px = 7040px */
    width: calc(220px * 32);
    animation: bbScroll 35s linear infinite;
    will-change: transform;
}

.bb-logo-slider:hover .bb-logo-track {
    animation-play-state: paused;
}

.bb-logo-item {
    width: 220px;
    padding: 0 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.client-logo {
    max-height: 48px;
    width: auto;
    object-fit: contain;
    filter: none !important;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bb-logo-item:hover .client-logo {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
}

/* Dynamic 50% shift ensures seamless reset for LTR and RTL */
@keyframes bbScroll {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@keyframes bbScrollRTL {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(50%, 0, 0);
    }
}

/* Apply RTL Slider Keyframes */
html[dir="rtl"] .bb-logo-track {
    animation-name: bbScrollRTL;
}

/* ==========================================
   10. Latest News Component
   ========================================== */
.latest-news-section .news-card {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: none !important;
    background-color: #ffffff;
}

.latest-news-section .news-img-wrapper {
    overflow: hidden;
}

.latest-news-section .news-img {
    width: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    filter: none !important;
}

.latest-news-section .news-card:hover .news-img {
    transform: scale(1.05);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================
   11. Site Footer Area (Renamed & Refactored)
   ========================================== */
.site-footer {
    position: relative;
    z-index: 1;
    color: #a3b1c2;
    font-size: 0.925rem;
    line-height: 1.6;
}

.footer-widget p {
    color: #94a3b8;
    font-size: 0.88rem;
    margin-bottom: 0;
}

/* Footer Headings */
.footer-widget h5,
.footer-widget h6 {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Social Icons */
.footer-social-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-social-links li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.footer-social-links li a:hover {
    background-color: var(--brand-green);
    color: #ffffff;
    transform: translateY(-3px);
}

/* Navigation Links */
.footer-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.footer-nav-links li a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-nav-links li a i {
    font-size: 0.75rem;
    color: var(--brand-green);
}

.footer-nav-links li a:hover {
    color: #ffffff;
}

html[dir="ltr"] .footer-nav-links li a:hover {
    transform: translateX(5px);
}

html[dir="rtl"] .footer-nav-links li a:hover {
    transform: translateX(-5px);
}

/* Input Overrides */
.site-footer .form-control {
    box-shadow: none !important;
}

.site-footer .form-control:focus {
    border-color: var(--brand-green) !important;
}

.hover-text-white:hover {
    color: #ffffff !important;
}

/* Contact Details */
.footer-contact-item p {
    color: #cbd5e1;
    font-size: 0.88rem;
}

.footer-contact-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* Bottom Bar Background Adjustments */
.footer-bottom {
    background-color: rgba(0, 0, 0, 0.25);
}


/* ===== 11. ALERTS ===== */
.alert-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.alert {
    border-radius: 12px;
}
