/* ==========================================================================
   AFPE SARL - PREMIUM & FLUID RESPONSIVE SYSTEM
   ========================================================================== */

/* --- TABLET BREAKPOINT (max-width: 1200px) --- */
@media only screen and (max-width: 1200px) {
    html {
        font-size: 60%; /* Slightly smaller scale base */
    }

    .expertise {
        padding: 8rem 2rem;
    }

    .expertise-layout {
        gap: 4rem;
    }

    .localisation {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }

    .grid1 {
        grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr));
        gap: 2.5rem;
    }
}

/* --- BOOTSTRAP LARGE / TABLET PORTRAIT BREAKPOINT (max-width: 991px) --- */
@media only screen and (max-width: 991px) {
    html {
        font-size: 58.5%;
    }

    /* Floating Island Navbar Mobile Optimizations */
    .nav1 {
        height: 75px;
        width: 92%;
        margin: 15px auto 0 auto !important;
        border-radius: 30px;
    }

    .nav1.scrolled {
        height: 65px;
        margin: 8px auto 0 auto !important;
    }

    .nav1 .navbar-brand img {
        height: 38px;
    }

    .nav1.scrolled .navbar-brand img {
        height: 35px;
    }

    /* Offcanvas burger adjustments & Premium Styling */
    .navbar-toggler {
        background-color: var(--primary, #1A3E2F) !important;
        border: 1px solid var(--accent, #E29E30) !important;
        border-radius: 10px;
        padding: 0.6rem 1rem !important;
        transition: var(--transition-smooth, all 0.4s ease);
    }
    .navbar-toggler:focus {
        box-shadow: 0 0 10px rgba(226, 158, 48, 0.4);
    }
    .navbar-toggler-icon {
        filter: invert(72%) sepia(50%) saturate(600%) hue-rotate(350deg) brightness(95%) contrast(90%);
        width: 1.3em;
        height: 1.3em;
    }
    
    .offcanvas {
        background-color: #121614 !important;
        border-left: 2px solid var(--accent, #E29E30) !important;
        width: 320px !important;
    }

    .offcanvas-header {
        background-color: var(--primary, #1A3E2F) !important;
        border-bottom: 1px solid rgba(226, 158, 48, 0.2) !important;
        padding: 2.2rem 2rem !important;
    }

    .offcanvas-title {
        color: var(--accent, #E29E30) !important;
        font-family: var(--font-title, 'Plus Jakarta Sans', sans-serif);
        font-size: 1.8rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.1rem;
        text-transform: uppercase;
    }

    .offcanvas-body {
        background-color: #121614 !important;
        padding: 3rem 2rem !important;
    }

    .offcanvas-body .navbar-nav {
        display: flex;
        flex-direction: column;
        gap: 1.6rem !important;
    }

    .offcanvas-body .nav-link {
        font-family: var(--font-title, 'Plus Jakarta Sans', sans-serif);
        font-size: 1.45rem !important;
        font-weight: 700 !important;
        color: var(--white, #ffffff) !important;
        text-transform: uppercase;
        letter-spacing: 0.08rem;
        padding: 1.3rem 2rem !important;
        background-color: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-radius: 12px !important;
        display: flex;
        align-items: center;
        gap: 1.2rem;
        transition: var(--transition-smooth, all 0.4s ease);
    }

    .offcanvas-body .nav-link i {
        color: var(--accent, #E29E30) !important;
        font-size: 1.5rem;
        transition: var(--transition-smooth, all 0.4s ease);
    }

    .offcanvas-body .nav-link:hover {
        background-color: var(--primary-light, #2D6A4F) !important;
        border-color: var(--primary-light, #2D6A4F) !important;
        color: var(--white, #ffffff) !important;
        transform: translateX(6px);
    }

    .offcanvas-body .nav-link:hover i {
        transform: scale(1.2) rotate(5deg);
        color: var(--white, #ffffff) !important;
    }

    /* Expertise Section Reflow */
    .expertise-layout {
        grid-template-columns: 1fr;
        gap: 5rem;
    }

    .expertise-img-wrapper {
        max-width: 550px;
        margin: 0 auto;
        aspect-ratio: 4 / 3;
    }

    .expertise-text {
        text-align: center;
    }

    .expertise-text h2 {
        font-size: 2.8rem;
    }

    .expertise-text p {
        text-align: center;
    }

    /* Statistics Grid - 3 columns then wrap */
    .statistic-section {
        border-radius: 20px;
        padding: 5rem 3rem;
    }

    .statistic-section .row {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    /* Localisation Section Reflow */
    .localisation {
        grid-template-columns: 1fr;
        padding: 2.5rem;
        gap: 3.5rem;
    }

    #info-qauche iframe {
        height: 380px;
        border-radius: 12px;
        width: 100% !important; /* Force 100% to avoid horizontal overflow */
    }

    #info-droit {
        padding: 0;
        text-align: center;
    }

    #info-droit h3 {
        font-size: 2.4rem;
        text-align: center;
    }

    #info-droit p {
        text-align: center;
        margin-bottom: 2.5rem;
    }

    /* Team Members & Grids */
    .enligne {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 2.5rem;
    }

    /* Services Alternating Rows */
    .service-row, .service-row.reverse {
        grid-template-columns: 1fr;
        gap: 4rem;
        margin-bottom: 7rem;
        direction: ltr !important; /* Force left to right on tablet */
    }

    .service-row.reverse .service-text-box {
        direction: ltr !important;
    }

    .service-image-box {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    .service-text-box {
        text-align: center;
    }

    .service-text-box h2::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .service-text-box p {
        text-align: center;
    }

    /* Contact Page Grid */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    /* Activity Details */
    .activity-grid {
        grid-template-columns: 1fr;
        gap: 4rem;
    }

    .activity-image-wrapper {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    .activity-content-wrapper {
        text-align: center;
    }

    .activity-content-wrapper h2::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .activity-description {
        text-align: center;
    }

    .activity-list {
        display: inline-block;
        text-align: left;
        margin: 2rem auto;
    }

    .cta-container {
        justify-content: center;
    }
}

/* --- BOOTSTRAP MEDIUM / SMARTPHONE BREAKPOINT (max-width: 768px) --- */
@media only screen and (max-width: 768px) {
    html {
        font-size: 56.25%;
    }

    /* Section Titles Sizing */
    .section-title-container {
        margin-bottom: 4.5rem;
    }

    .section-title-container h1 {
        font-size: 2.6rem !important;
    }

    .section-title-container p {
        font-size: 1.5rem;
    }

    /* Hero Slider Responsive scaling */
    .caption {
        left: 6%;
        right: 6%;
        top: 50%;
    }

    .caption .caption-heading h1 {
        font-size: clamp(3.2rem, 5vw, 4.5rem) !important;
        margin-bottom: 1.5rem;
    }

    .caption .caption-subhead {
        font-size: 1.6rem !important;
        margin-bottom: 3rem;
    }

    .caption .hero-actions {
        flex-direction: column;
        gap: 1.5rem;
    }

    .caption .hero-btn {
        width: 100%;
        text-align: center;
        padding: 1.4rem 2rem;
    }

    .nav {
        display: none !important; /* Hide slider arrows on mobile */
    }

    /* Statistics - 2 columns */
    .statistic-section {
        padding: 4rem 2rem;
        margin: 2rem auto;
    }

    .statistic-section .row {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .counter .count-title {
        font-size: 2.8rem;
    }

    .counter .stats-text {
        font-size: 0.95rem;
    }

    /* Marquees (Certifications & Partners) */
    .marquee-item {
        font-size: 1.8rem;
        padding: 1.2rem 3rem;
    }

    .partner-logo-wrapper img {
        height: 50px;
    }

    .partner-marquee-track {
        gap: 4rem;
    }

    /* Page Banners Header */
    .page-header {
        height: 28vh;
        margin-bottom: 5rem;
    }

    .page-header-content h1 {
        font-size: 3.2rem !important;
    }

    /* Grid cards */
    .grid1 {
        grid-template-columns: 1fr;
    }

    .enligne {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    /* Footer Responsive Columns */
    .modern-footer {
        padding: 5rem 2rem 2rem 2rem;
        margin-top: 4rem;
    }

    .modern-footer .footer-container {
        grid-template-columns: 1fr;
        gap: 4rem;
        text-align: center;
    }

    .modern-footer .footer-logo {
        margin: 0 auto 2rem auto;
    }

    .modern-footer .footer-slogan {
        margin: 0 auto 2.5rem auto;
    }

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

    .modern-footer .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .modern-footer .footer-contact ul li {
        justify-content: center;
    }

    .modern-footer .footer-bottom {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        margin-top: 3rem;
    }
}

/* --- SMALL MOBILE BREAKPOINT (max-width: 576px) --- */
@media only screen and (max-width: 576px) {
    /* Statistics - Stacked */
    .statistic-section .row {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .counter {
        padding: 2rem 1rem;
    }

    /* Glassmorphic Cards Form spacing */
    .glass-contact-card-premium {
        padding: 30px 20px;
    }

    .glass-contact-card-premium h2 {
        font-size: 2.4rem;
    }

    /* Tab switcher for maps on very small screens */
    .tab-switcher {
        flex-direction: column;
        gap: 5px;
        padding: 5px;
    }

    .tab-btn {
        width: 100%;
        padding: 8px;
    }

    .map-viewport {
        height: 200px;
    }

    #info-qauche iframe {
        height: 280px;
    }
}
