/* ==========================================================================
   AP ENGINEERING COMPANY - COMPREHENSIVE MOBILE & RESPONSIVE FIXES
   Fit to all screen edges, adaptive behavior across Desktop, Tablet & Mobile
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL RESET & VIEWPORT EDGE FITTING
   -------------------------------------------------------------------------- */
html {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    padding: 0;
    position: relative;
    -webkit-text-size-adjust: 100%;
}

#smooth-wrapper, #smooth-content {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure images, SVG, canvas, and video never break parent container bounds */
img, svg, video, canvas, iframe, object {
    max-width: 100% !important;
    height: auto;
}

/* Fluid Containers */
.container, .container-fluid, .page-container {
    width: 100% !important;
    max-width: 1240px;
    padding-left: 20px !important;
    padding-right: 20px !important;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

@media (max-width: 575px) {
    .container, .container-fluid, .page-container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

.row {
    --bs-gutter-x: 1.5rem;
    --bs-gutter-y: 1.5rem;
    margin-left: calc(-0.5 * var(--bs-gutter-x));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
}

/* --------------------------------------------------------------------------
   2. HEADER & NAVIGATION RESPONSIVENESS (ALL SCREEN SIZES & STICKY LOGO FIX)
   -------------------------------------------------------------------------- */

/* Header Sticky Base & Solid Background */
#header-sticky {
    position: relative;
    z-index: 999;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

#header-sticky.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99999;
    background-color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    border-bottom: 1px solid #f3f4f6 !important;
    animation: fadeInDown 0.4s ease-in-out;
}

/* Fix for logo disappearing when sticky scroll activates */
.header-logo,
.sticky.header-1 .header-main .header-left .header-logo,
#header-sticky.sticky .header-logo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.sticky.header-1 .header-main .header-left .header-logo-2,
#header-sticky.sticky .header-logo-2 {
    display: none !important;
}

.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    transition: padding 0.3s ease;
}

#header-sticky.sticky .header-main {
    padding: 10px 0 !important;
}

.header-logo-img {
    width: auto !important;
    max-width: 300px !important;
    height: auto !important;
    max-height: 48px !important;
    object-fit: contain;
    display: block;
}

.offcanvas-logo-img {
    width: auto !important;
    max-width: 240px !important;
    height: auto !important;
    max-height: 42px !important;
    object-fit: contain;
    display: block;
}

.offcanvas__info {
    max-width: 380px;
    width: 100%;
}

/* Desktop Navigation Links */
.header-main .main-menu ul {
    margin: 0;
    padding: 0;
}

.header-main .main-menu ul li a {
    color: #111827 !important;
    font-weight: 600;
    font-size: 15px;
    padding: 15px 0;
    transition: color 0.2s ease;
}

.header-main .main-menu ul li a:hover,
.header-main .main-menu ul li.active > a {
    color: #f94d00 !important;
}

/* Desktop Submenu Dropdowns */
.header-main .main-menu ul li .submenu {
    background: #ffffff !important;
    border-top: 4px solid #f94d00 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
    border-radius: 8px !important;
    padding: 12px 0 !important;
}

.header-main .main-menu ul li .submenu li a {
    color: #1f2937 !important;
    font-size: 14px !important;
    padding: 8px 24px !important;
    font-weight: 500 !important;
}

.header-main .main-menu ul li .submenu li a:hover {
    color: #f94d00 !important;
    background-color: #fff7f4 !important;
}

/* Header Buttons & Phone Action */
.header-btn {
    display: flex;
    align-items: center;
    gap: 20px;
}

.phone-text .phone-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #111827;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.phone-text .phone-link i {
    color: #f94d00;
    font-size: 18px;
}

.phone-text .phone-link:hover {
    color: #f94d00;
}

.header-button .theme-btn {
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    background: #f94d00;
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: background-color 0.25s ease;
}

.header-button .theme-btn:hover {
    background: #d63d00;
}

/* Mobile & Tablet Hamburger Toggle */
.sidebar__toggle {
    background: #fff3ed;
    border: 1px solid #ffe2d5;
    color: #f94d00 !important;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    padding: 0;
}

.sidebar__toggle:hover {
    background: #f94d00;
    color: #ffffff !important;
}

/* Responsive Media Queries */
@media (max-width: 1399px) {
    .header-main .main-menu ul li {
        margin-inline-end: 22px;
    }
    .header-logo-img {
        max-width: 250px !important;
        max-height: 42px !important;
    }
}

@media (max-width: 1199px) {
    .header-main {
        padding: 12px 0;
    }
    .mean__menu-wrapper {
        display: none !important;
    }
    .header-button {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .header-logo-img {
        max-width: 210px !important;
        max-height: 38px !important;
    }
    
    .phone-text .phone-number {
        display: none;
    }
    
    .phone-text .phone-link {
        width: 40px;
        height: 40px;
        background: #fff3ed;
        border-radius: 50%;
        justify-content: center;
        border: 1px solid #ffe2d5;
    }

    .phone-text .phone-link i {
        margin: 0;
        font-size: 16px;
    }

    .header-btn {
        gap: 10px;
    }
}

@media (max-width: 575px) {
    .header-main {
        padding: 10px 0 !important;
    }

    .header-logo-img {
        max-width: 175px !important;
        max-height: 34px !important;
    }

    .offcanvas-logo-img {
        max-width: 170px !important;
        max-height: 34px !important;
    }

    .offcanvas__info {
        width: 100% !important;
        max-width: 320px !important;
    }

    .offcanvas__wrapper {
        padding: 20px 16px !important;
    }

    .offcanvas__contact {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-top: 25px !important;
        border-top: 1px solid #e5e7eb;
        padding-top: 20px;
    }

    .offcanvas__contact p,
    .offcanvas__contact ul {
        display: block !important;
    }

    .offcanvas__contact-text a {
        font-size: 13px !important;
        color: #374151 !important;
        word-break: break-word;
    }
}

@media (max-width: 360px) {
    .header-logo-img {
        max-width: 150px !important;
        max-height: 30px !important;
    }
}

/* Offcanvas Mobile Navigation Menu Styling */
.mobile-menu .mean-bar {
    background: transparent !important;
    padding: 0 !important;
}

.mobile-menu .mean-nav {
    background: transparent !important;
    margin-top: 0 !important;
}

.mobile-menu .mean-nav ul {
    border: none !important;
}

.mobile-menu .mean-nav ul li {
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

.mobile-menu .mean-nav ul li a {
    color: #111827 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    padding: 12px 10px !important;
    width: 85% !important;
    border: none !important;
    text-transform: capitalize !important;
}

.mobile-menu .mean-nav ul li a.mean-expand {
    width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    background: #f9fafb !important;
    border-radius: 6px !important;
    color: #f94d00 !important;
    top: 4px !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mobile-menu .mean-nav ul li ul li a {
    padding-left: 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
}

.mobile-menu .mean-nav ul li ul li ul li a {
    padding-left: 36px !important;
    font-size: 13px !important;
    color: #6b7280 !important;
}

/* --------------------------------------------------------------------------
   3. HERO BANNER ADAPTIVE STYLING
   -------------------------------------------------------------------------- */
.hero-3 {
    position: relative;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    overflow: hidden;
    padding: 140px 0 100px 0;
}

.hero-content h2 {
    font-size: clamp(24px, 4.5vw, 48px) !important;
    line-height: 1.2 !important;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    word-wrap: break-word;
}

.hero-content p {
    font-size: clamp(14px, 1.8vw, 18px);
    line-height: 1.6;
    margin-bottom: 30px;
}

.hero-btn {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 767px) {
    .hero-3 {
        padding: 100px 0 60px 0 !important;
    }
    
    .hero-btn {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .hero-btn .theme-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 14px 20px;
    }
}

/* --------------------------------------------------------------------------
   4. PRODUCT CARDS & GRID SYSTEM
   -------------------------------------------------------------------------- */
.page-container {
    padding-top: 40px;
    padding-bottom: 60px;
}

.product-card-wrapper {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.product-card {
    width: calc(50% - 12px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.product-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.product-card h3 a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-card h3 a:hover {
    color: #f94d00;
}

.product-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.product-image {
    flex-shrink: 0;
}

.product-image img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #f3f4f6;
    padding: 8px;
    background: #fafafa;
}

.product-details {
    flex-grow: 1;
}

.product-details p {
    margin: 4px 0;
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
}

.product-details p strong {
    color: #111827;
    font-weight: 600;
}

.inquiry-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 12px 24px;
    background: #f94d00;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.25s ease;
}

.inquiry-btn:hover {
    background: #d63d00;
    color: #ffffff;
}

/* Product Card Responsiveness */
@media (max-width: 991px) {
    .product-card {
        width: 100%;
    }
}

@media (max-width: 575px) {
    .product-card {
        width: 100%;
        padding: 16px;
    }

    .product-content {
        flex-direction: column;
        align-items: center;
        text-align: left;
        gap: 15px;
    }

    .product-image {
        width: 100%;
        text-align: center;
    }

    .product-image img {
        width: 100%;
        max-width: 220px;
        height: auto;
        max-height: 220px;
        margin: 0 auto;
    }

    .product-details {
        width: 100%;
    }

    .inquiry-btn {
        width: 100%;
        text-align: center;
    }
}

/* --------------------------------------------------------------------------
   5. SINGLE PRODUCT DETAIL PAGES (.team-details-section)
   -------------------------------------------------------------------------- */
.team-details-image {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.team-details-image img,
.product-detail-img {
    width: 100% !important;
    max-width: 450px !important;
    height: auto !important;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin: 0 auto;
    display: block;
}

@media (max-width: 767px) {
    .team-details-image img,
    .product-detail-img {
        max-width: 100% !important;
    }

    .team-details-content {
        margin-top: 20px;
    }

    .team-infrom li {
        font-size: 14px;
        padding: 8px 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }
}

/* --------------------------------------------------------------------------
   6. SERVICE BOX ITEMS & CATEGORIES (products.php & index.php)
   -------------------------------------------------------------------------- */
.service-box-item {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.service-box-item:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.service-box-item img,
.product-cat-img {
    width: 100% !important;
    max-width: 100% !important;
    height: 240px !important;
    object-fit: cover !important;
    border-radius: 8px;
    margin-bottom: 18px;
}

@media (max-width: 575px) {
    .service-box-item img,
    .product-cat-img {
        height: 190px !important;
    }
}

/* --------------------------------------------------------------------------
   7. ABOUT SECTION & PROGRESS BARS
   -------------------------------------------------------------------------- */
.about-image img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    border-radius: 16px;
    object-fit: cover;
}

@media (max-width: 767px) {
    .about-section-3 {
        padding: 50px 0 !important;
    }

    .about-content .section-title h2 {
        font-size: clamp(22px, 5vw, 32px) !important;
        line-height: 1.25 !important;
    }
}

/* --------------------------------------------------------------------------
   8. FOOTER & FLOATING CTA BUTTONS
   -------------------------------------------------------------------------- */
.footer-logo img {
    width: auto !important;
    max-width: 320px !important;
    height: auto !important;
    max-height: 48px !important;
    object-fit: contain;
}

@media (max-width: 575px) {
    .footer-logo img {
        max-width: 230px !important;
    }

    .footer-section-3 {
        padding-top: 50px;
    }

    .footer-bottom-wrapper {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* Floating WhatsApp Button Fixes */
a[href*="wa.me"] {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

a[href*="wa.me"]:hover {
    transform: scale(1.08) !important;
}

@media (max-width: 767px) {
    a[href*="wa.me"] {
        width: 48px !important;
        height: 48px !important;
        bottom: 80px !important;
        right: 16px !important;
        font-size: 24px !important;
    }

    .back-to-top {
        bottom: 20px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
    }
}

/* --------------------------------------------------------------------------
   9. TABLES & SPECIFICATIONS HORIZONTAL RESPONSIVENESS
   -------------------------------------------------------------------------- */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    max-width: 100%;
}
