/* =========================================
   RESPONSIVE HORIZONTAL SCROLL FIX
   ========================================= */

/* html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
} */




/* Bootstrap rows sometimes create overflow */


/* =========================================
   MOBILE + TABLET
   ========================================= */

@media (max-width: 991.98px) {

    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    section,
    header,
    footer,
    main {
        max-width: 100%;
        overflow-x: clip;
    }

    .container,
    .container-fluid {
        width: 100%;
        max-width: 100%;
    }

    .row {
        width: 100%;
        max-width: 100%;
    }

    [class*="col-"] {
        max-width: 100%;
    }

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

    iframe {
        max-width: 100%;
    }
}


/* =========================================
   SMALL MOBILE
   ========================================= */

@media (max-width: 575.98px) {

    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    .row {
        margin-left: 0;
        margin-right: 0;
    }

    /* Prevent fixed-width elements */
    [style*="width"],
    [style*="min-width"] {
        max-width: 100%;
    }

    /* Text won't force page wider */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p,
    a,
    span {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

/* =========================================================
   AVENSIS CROPSCIENCE - GLOBAL RESPONSIVE OVERRIDES
   Added as a final layer so existing desktop design remains
   unchanged while mobile/tablet layouts become fluid.
========================================================= */

/* Prevent media and long UI elements from creating overflow */


/* =========================================================
   LARGE TABLETS / SMALL LAPTOPS
========================================================= */
@media (max-width: 1199.98px) {
    .nav-inner { padding-left: 3%; padding-right: 3%; }
    .nav-content { gap: 24px; }
    .main-menu { gap: 16px; }
    .main-menu > li > a { font-size: 13px; }

    .hero-content h1 { font-size: clamp(42px, 5.2vw, 60px); }
}

/* =========================================================
   TABLET + MOBILE NAVIGATION
========================================================= */
@media (max-width: 991.98px) {
    .top-inner {
        padding-left: 20px;
        padding-right: 20px;
    }

    .nav-inner {
        position: relative;
        padding-left: 20px;
        padding-right: 20px;
    }

    #mainNavbar,
    #mainNavbar.sticky {
        height: 76px;
    }

    .nav-content {
        position: absolute;
        top: 100%;
        left: 15px;
        right: 15px;
        width: auto;
        margin: 0;
        padding: 12px 15px 18px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        background: #fff;
        border: 1px solid #e8e8e8;
        border-top: 3px solid var(--green);
        box-shadow: 0 12px 28px rgba(0,0,0,.12);
        z-index: 100000;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }

    .nav-content.show { display: flex; }

    .mobile-toggle {
        display: flex;
        flex-shrink: 0;
        margin-left: auto;
    }

    .main-menu {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .main-menu > li {
        width: 100%;
        border-bottom: 1px solid #eeeeee;
    }

    .main-menu > li:last-child { border-bottom: 0; }

    .main-menu > li > a {
        width: 100%;
        min-height: 46px;
        padding: 12px 5px;
        font-size: 14px;
        white-space: normal;
        justify-content: space-between;
    }

    /* Touch-friendly dropdown */
    .dropdown-menu-custom {
        position: static;
        width: 100%;
        padding: 0;
        margin: 0 0 8px;
        border-top: 0;
        border-left: 3px solid var(--green);
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }

    .dropdown.open .dropdown-menu-custom { display: block; }

    .dropdown-menu-custom li a {
        padding: 11px 18px;
        font-size: 13px;
        background: #fafcf7;
    }

    .dropdown:hover .dropdown-menu-custom {
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .call-now {
        width: 100%;
        min-height: 44px;
        margin-top: 3px;
    }

    /* Hero */
    .hero-slider {
        height: auto;
        min-height: 520px;
    }

    .hero-slide {
        height: 520px;
        min-height: 520px;
    }

    .hero-content h1 {
        font-size: clamp(34px, 6vw, 52px);
        line-height: 1.15;
        padding: 0 45px;
        letter-spacing: -.5px;
    }

    .carousel-control-prev { padding-left: 15px; }
    .carousel-control-next { padding-right: 15px; }
    .hero-arrow { width: 55px; }

    /* Common section spacing */
    section { overflow: hidden; }

    /* Product grids */
    .product-image { height: 260px; }
    .product-card h3 { font-size: 17px; }
}

/* =========================================================
   MOBILE
========================================================= */
@media (max-width: 767.98px) {
    .top-bar { height: auto; min-height: 48px; }

    .top-inner {
        min-height: 48px;
        padding: 7px 15px;
        gap: 8px;
    }

    .email-link {
        min-width: 0;
        max-width: calc(100% - 100px);
        font-size: 11px;
        gap: 6px;
    }

    .email-link span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .social-links {
        gap: 12px;
        flex-shrink: 0;
    }

    .social-links a { font-size: 16px; }

    .nav-inner { padding: 0 15px; }

    .logo img,
    #mainNavbar.sticky .logo img {
        width: 72px;
    }

    .nav-content {
        left: 10px;
        right: 10px;
    }

    /* Hero */
    .hero-slide {
        height: 440px;
        min-height: 440px;
    }

    .hero-slider {
        min-height: 440px;
    }

    .hero-content h1 {
        font-size: clamp(28px, 8vw, 40px);
        line-height: 1.18;
        padding: 0 38px;
    }

    .hero-arrow { width: 42px; }
    .hero-prev-icon, .hero-next-icon { font-size: 21px; }

    /* Prevent headings/paragraphs from overflowing */
    h1 { font-size: clamp(28px, 8vw, 40px); }
    h2 { font-size: clamp(24px, 7vw, 34px); }
    h3 { font-size: clamp(19px, 5vw, 26px); }

    /* Product listing */
    .product-image {
        height: 220px;
        margin-bottom: 12px;
    }

    .product-category { font-size: 13px; }
    .product-card h3 {
        font-size: 15px;
        line-height: 1.35;
        margin-bottom: 12px;
    }

    .product-btn {
        min-width: 0;
        width: auto;
        min-height: 44px;
        height: auto;
        padding: 9px 16px;
        font-size: 14px;
    }

    /* Detail/product media */
    .vc-detail-media,
    .data-detail-main {
        width: 100%;
        max-width: 100%;
    }

    /* Tables remain usable without breaking page width */
    table { min-width: 0; }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Footer */
    .footer-brand p {
        max-width: 100%;
        font-size: 14px;
        line-height: 1.7;
    }

    .footer-widget {
        margin-bottom: 28px;
    }

    .footer-bottom {
        text-align: center;
    }

    .copyright-text {
        font-size: 12px;
        line-height: 1.6;
        padding: 12px 5px;
    }

    /* Buttons and cards should never exceed viewport */
    .btn, button, .product-btn, .call-now {
        max-width: 100%;
                margin-bottom: 11px;
    }
}

/* =========================================================
   VERY SMALL PHONES
========================================================= */
@media (max-width: 399.98px) {
    .top-inner {
        padding-left: 10px;
        padding-right: 10px;
    }

    .email-link { font-size: 10px; max-width: calc(100% - 85px); }
    .social-links { gap: 9px; }
    .social-links a { font-size: 14px; }

    .logo img,
    #mainNavbar.sticky .logo img {
        width: 65px;
    }

    .mobile-toggle {
        width: 40px;
        height: 40px;
    }

    .hero-slide {
        height: 270px;
        min-height: 270px;
    }

    .hero-slider { min-height: 250px; }

    .hero-content h1 {
        font-size: 22px;
        padding: 0 0px;
    }

    .product-image { height: 240px; }

    
}

/* =========================================================
   FULL-WIDTH MOBILE MENU
   The mobile navigation should span the complete viewport,
   with no side inset from the nav-inner padding.
========================================================= */
@media (max-width: 767.98px) {
    #mainNavbar .nav-content,
    #mainNavbar.sticky .nav-content {
        left: -15px !important;
        right: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    .row>* {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * .1);
    padding-left: calc(var(--bs-gutter-x) * 0.1);
    margin-top: var(--bs-gutter-y);
    /* text-align: justify; */
}
}

@media (min-width: 768px) and (max-width: 991.98px) {
    #mainNavbar .nav-content,
    #mainNavbar.sticky .nav-content {
        left: -20px !important;
        right: auto !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }
}

/* =========================================================
   MOBILE PRODUCT CATEGORIES DROPDOWN - FINAL FIX
========================================================= */
@media (max-width: 991.98px) {
    .nav-content .dropdown-menu-custom {
        position: static !important;
        display: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .nav-content .dropdown.open > .dropdown-menu-custom {
        display: block !important;
    }

    .nav-content .dropdown > a {
        cursor: pointer;
    }

    .nav-content .dropdown.open > a i {
        transform: rotate(180deg);
    }
}
