/* ==========================================================================
   Teknolite Responsive Overrides CSS
   Handles responsiveness adjustments for mobile, tablet, and desktop viewports.
   ========================================================================== */

/* --- Slideshow / Swiper Heights & Typography --- */

/* Tablet (≤ 991px) */
@media (max-width: 991px) {
    .tf-slideshow.style-3 .swiper {
        height: 520px !important;
    }
    .tf-slideshow.style-3 .box-content {
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        gap: 24px !important;
        width: 88% !important;
        padding: 24px !important;
    }
    .tf-slideshow.style-3 .box-content .text-display {
        font-size: 30px !important;
        line-height: 38px !important;
    }
    .tf-slideshow.style-3 .box-content .text-body-1 {
        font-size: 15px !important;
        line-height: 22px !important;
    }
}

/* Mobile (≤ 767px) */
@media (max-width: 767px) {
    .tf-slideshow.style-3 .swiper {
        height: 420px !important;
    }
    .tf-slideshow.style-3 .box-content {
        top: 50% !important;
        transform: translate(-50%, -100%) !important;
        gap: 16px !important;
        width: 90% !important;
        padding: 20px !important;
    }
    .tf-slideshow.style-3 .box-content .text-display {
        font-size: 24px !important;
        line-height: 32px !important;
    }
    .tf-slideshow.style-3 .box-content .text-body-1 {
        font-size: 14px !important;
        line-height: 20px !important;
    }
    .tf-slideshow.style-3 .tf-btn {
        height: 44px !important;
        padding: 0 20px !important;
        font-size: 14px !important;
        line-height: 44px !important;
    }
    .tf-slideshow.style-3 .sw-button {
        display: none !important;
    }
    .tf-slideshow.style-3 .wrap-pagination {
        bottom: 16px !important;
    }
    /* Banner image: cover on mobile so no distortion */
    .tf-slideshow .wrap-slider .img-style img {
        object-fit: cover !important;
        height: 100% !important;
    }
}

/* Small mobile (≤ 480px) */
@media (max-width: 480px) {
    .tf-slideshow.style-3 .swiper {
        height: 360px !important;
    }
    .tf-slideshow.style-3 .box-content {
        width: 92% !important;
        padding: 16px !important;
        gap: 12px !important;
    }
    .tf-slideshow.style-3 .box-content .text-display {
        font-size: 20px !important;
        line-height: 26px !important;
    }
    .tf-slideshow.style-3 .box-content .text-body-1 {
        font-size: 13px !important;
        line-height: 18px !important;
    }
}

/* Extra small mobile (≤ 380px) */
@media (max-width: 380px) {
    .tf-slideshow.style-3 .swiper {
        height: 300px !important;
    }
    .tf-slideshow.style-3 .box-content .text-display {
        font-size: 17px !important;
        line-height: 22px !important;
    }
    .tf-slideshow.style-3 .box-content .text-body-1 {
        font-size: 12px !important;
        line-height: 16px !important;
    }
}

/* --- Category Section CSS Grid Fix --- */
@media (max-width: 991px) {
    .category-grid {
        grid-template-columns: 1fr !important;
    }
    .right-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: auto !important;
    }
    .category-grid .top-card {
        grid-column: 1 / 3 !important; /* Span across both columns on tablet */
    }
}

@media (max-width: 768px) {
    .right-grid {
        grid-template-columns: 1fr !important;
    }
    .category-grid .top-card {
        grid-column: 1 / -1 !important; /* Span single column on mobile */
    }
}

/* --- About Section Statistics & Description --- */
@media (max-width: 767px) {
    .about-stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 24px !important;
        text-align: center !important;
    }
    .about-stat {
        width: 100% !important;
        border-right: none !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }
    /* Add borders between columns */
    .about-stat:nth-child(odd) {
        border-right: 1px solid #ececec !important;
    }
    /* Let the 5th stat center and span both columns */
    .about-stat:nth-child(5) {
        grid-column: span 2 !important;
        border-right: none !important;
        margin-top: 10px !important;
    }
    /* Override justify-alignment on narrow columns for legibility */
    .about-section .about-new-desc.text-justify {
        text-align: left !important;
    }
}

/* --- Products Section Background Overlay --- */
.container {
    position: relative;
}

.gray-bg {
    background-color: #F2F2F2 !important;
    border-radius: 10px !important;
    position: absolute !important;
    inset: -20px 0 !important; /* Stretches dynamically to cover the exact height of the products grid */
    z-index: -1 !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    top: -20px !important;
    bottom: -20px !important;
    left: 15px !important;
    margin: -30px;
    right: 15px !important;
}

/* --- Project Section Alignment Fix --- */
.explore {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important; /* Fixes align-item typo */
}

/* --- Mobile Header: Hamburger Toggle Right-Aligned --- */
/* Ensure logo col + toggle col fill the full row correctly on all sizes */
@media (max-width: 1199px) {
    header#header .wrapper-header {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    /* Logo: fixed left, takes only what it needs */
    header#header .wrapper-header > div:first-child {
        flex: 0 0 auto !important;
    }
    /* Toggle: push to right edge */
    header#header .wrapper-header > div.d-xl-none {
        flex: 1 1 auto !important;
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
    }
    header#header .mobile-menu {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding: 8px !important;
    }
    /* Make the hamburger icon clearly visible on dark/transparent header */
    header#header .mobile-menu svg {
        width: 28px !important;
        height: 28px !important;
        fill: #ffffff !important;
    }
    header#header .mobile-menu svg path {
        fill: #ffffff !important;
    }
}

/* --- Modal z-index Fix: appear above the offcanvas sidebar ---
   Bootstrap offcanvas: z-index 1045
   Bootstrap modal backdrop: z-index 1050
   Bootstrap modal: z-index 1055
   The offcanvas canvas-mb uses isolation:isolate which can trap modals.
   Fix: disable isolation on the inner content and raise modal z-index.
   ----------------------------------------------------------------- */
.canvas-mb .mb-canvas-content {
    isolation: auto !important; /* remove stacking context that traps modals */
}

/* Raise modal and its backdrop above the offcanvas */
.modal {
    z-index: 1056 !important;
}
.modal-backdrop {
    z-index: 1055 !important;
}

/* Ensure the offcanvas backdrop does NOT overlap the modal */
.offcanvas-backdrop {
    z-index: 1040 !important;
}

/* --- Experience Section Button Fixes --- */
.experience-section .tf-btn.btn-white {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 32px !important;
    /* border: 1px solid #222 !important;
    border-radius: 50px !important;
    background: #fff !important;
    color: #111 !important; */
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
    cursor: pointer !important;
}

.experience-section .tf-btn.btn-white:hover {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}

/* Centering utility for components */
.center-btn-wrap {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
}

/* --- Modal Form Dialog & Buttons Responsiveness --- */

/* Base: desktop (all screens) */
#enquiryForm .modal-dialog,
#downloadCatalogModal .modal-dialog {
    max-width: 620px !important;
    margin: 1.75rem auto !important;
    width: 100% !important;
}

#enquiryForm .modal-content,
#downloadCatalogModal .modal-content {
    padding: 32px 36px !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Header row (title + close icon) */
#enquiryForm .modal-content > .d-flex,
#downloadCatalogModal .modal-content > .d-flex {
    margin-bottom: 20px !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
}

#enquiryForm .modal-content h5,
#downloadCatalogModal .modal-content h5 {
    font-size: 20px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    flex: 1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Form fields */
#enquiryForm .form-control,
#downloadCatalogModal .form-control {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 15px !important;
    min-height: 46px !important;
}

#enquiryForm textarea.form-control,
#downloadCatalogModal textarea.form-control {
    min-height: 100px !important;
    resize: vertical !important;
}

/* Select wrapper */
#enquiryForm .tf-select,
#downloadCatalogModal .tf-select {
    width: 100% !important;
}

/* Action buttons row */
#enquiryForm form .d-flex.gap-2,
#downloadCatalogModal form .d-flex.gap-2 {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px !important;
}

#enquiryForm form .d-flex.gap-2 .tf-btn,
#downloadCatalogModal form .d-flex.gap-2 .tf-btn,
#enquiryForm form .d-flex.gap-2 a.tf-btn,
#downloadCatalogModal form .d-flex.gap-2 a.tf-btn {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    justify-content: center !important;
    white-space: nowrap !important;
    font-size: 15px !important;
    height: 48px !important;
    padding: 0 16px !important;
}

/* --- Tablet (≤ 768px) --- */
@media (max-width: 768px) {
    #enquiryForm .modal-dialog,
    #downloadCatalogModal .modal-dialog {
        max-width: calc(100% - 2rem) !important;
        margin: 1.25rem auto !important;
    }

    #enquiryForm .modal-content,
    #downloadCatalogModal .modal-content {
        padding: 28px 28px !important;
    }

    /* Switch two-column fields to single column on tablet */
    #enquiryForm .col-md-6,
    #downloadCatalogModal .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* --- Mobile (≤ 576px) --- */
@media (max-width: 576px) {
    #enquiryForm .modal-dialog,
    #downloadCatalogModal .modal-dialog {
        margin: 0.75rem !important;
        max-width: calc(100% - 1.5rem) !important;
        align-self: flex-end !important; /* Slide up from bottom on small screens */
    }

    /* Allow modal to scroll if content is taller than viewport */
    #enquiryForm,
    #downloadCatalogModal {
        align-items: flex-end !important;
    }

    #enquiryForm .modal-content,
    #downloadCatalogModal .modal-content {
        padding: 24px 20px !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 92dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #enquiryForm .modal-content h5,
    #downloadCatalogModal .modal-content h5 {
        font-size: 17px !important;
    }

    #enquiryForm .form-control,
    #downloadCatalogModal .form-control {
        font-size: 16px !important; /* Prevents iOS auto-zoom on focus */
        min-height: 48px !important;
        padding: 10px 14px !important;
    }

    #enquiryForm textarea.form-control,
    #downloadCatalogModal textarea.form-control {
        min-height: 90px !important;
        padding: 12px 14px !important;
    }

    /* Stack buttons vertically on mobile */
    #enquiryForm form .d-flex.gap-2,
    #downloadCatalogModal form .d-flex.gap-2 {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #enquiryForm form .d-flex.gap-2 .tf-btn,
    #downloadCatalogModal form .d-flex.gap-2 .tf-btn,
    #enquiryForm form .d-flex.gap-2 a.tf-btn,
    #downloadCatalogModal form .d-flex.gap-2 a.tf-btn {
        width: 100% !important;
        flex: none !important;
        height: 50px !important;
        font-size: 15px !important;
    }

    /* Col overrides */
    #enquiryForm .col-md-6,
    #downloadCatalogModal .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Tighten label spacing */
    #enquiryForm .mb-3,
    #downloadCatalogModal .mb-3 {
        margin-bottom: 14px !important;
    }

    #enquiryForm .form-label,
    #downloadCatalogModal .form-label {
        font-size: 13px !important;
        margin-bottom: 5px !important;
    }
}

/* --- Extra small (≤ 380px) --- */
@media (max-width: 380px) {
    #enquiryForm .modal-content,
    #downloadCatalogModal .modal-content {
        padding: 20px 16px !important;
    }

    #enquiryForm .modal-content h5,
    #downloadCatalogModal .modal-content h5 {
        font-size: 15px !important;
    }

    #enquiryForm form .d-flex.gap-2 .tf-btn,
    #downloadCatalogModal form .d-flex.gap-2 .tf-btn,
    #enquiryForm form .d-flex.gap-2 a.tf-btn,
    #downloadCatalogModal form .d-flex.gap-2 a.tf-btn {
        height: 46px !important;
        font-size: 14px !important;
    }
}
/* --- Sticky Header Overrides (Active on Scroll) --- */
header#header.is-sticky {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background-color: #0c0c0c !important; /* Elegant solid dark background */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Ensure link items inside the sticky header are readable and white */
header#header.is-sticky .box-nav-ul .item-link {
    color: #ffffff !important;
}
header#header.is-sticky .box-nav-ul .item-link:hover {
    color: #0d6efd !important;
}

/* mobile hamburger menu icon inherits white fill */
header#header.is-sticky .mobile-menu svg {
    fill: #ffffff !important;
}
header#header.is-sticky .mobile-menu svg path {
    fill: #ffffff !important;
}

