/*
Theme Name: Able Sheet Metal - Mobile Styles
Description: Responsive overrides for mobile devices (Cleaned).
*/

/* =========================================
   LARGE SCREENS (max-width: 1440px)
   ========================================= */
@media (max-width: 1440px) {
    .hero-title {
        font-size: 70px;
    }

    .products-section,
    .about-section,
    .featured-section,
    .site-footer {
        padding-left: 100px;
        padding-right: 100px;
    }

    .contact-section {
        padding: 60px 70px;
    }

    .header-container {
        padding-left: 100px;
        padding-right: 100px;
    }

    .hero-content {
        padding-left: 100px !important;
        padding-right: 100px !important;
    }

    /* Navigation Fixes for Mid-Size Screens */
    .main-navigation a {
        font-size: 14px;
        /* Reduced from 16px */
    }
}

/* =========================================
   TABLETS / LAPTOPS (max-width: 1024px)
   ========================================= */
@media (max-width: 1024px) {

    .products-section,
    .about-section,
    .featured-section,
    .contact-section,
    .site-footer,
    .header-container {
        padding-left: 60px;
        padding-right: 60px;
    }

    .hero-content {
        padding-left: 60px !important;
        padding-right: 60px !important;
    }

    /* Navigation Fixes for Tablet */
    .main-navigation .nav-menu {
        gap: 15px;
        /* Further reduced */
    }

    .main-navigation a {
        font-size: 12px;
        /* Further reduced to fit long labels */
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-section {
        flex-direction: column;
        gap: 60px;
    }

    .about-image-wrapper {
        width: 100%;
    }

    .customers-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-content {
        gap: 100px;
    }

    .featured-image-wrapper {
        position: static;
        margin: 40px auto 0;
    }

    .featured-item {
        padding: 60px 40px;
    }
}

/* =========================================
   TABLETS / SMALL LAPTOPS (max-width: 992px)
   ========================================= */
@media (max-width: 992px) {
    .products-layout {
        flex-direction: column;
    }

    .products-sidebar {
        width: 100%;
        margin-bottom: 40px;
    }

    .products-sidebar-list {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .products-sidebar-item a {
        padding: 15px;
        /* Larger tap targets */
    }

    .single-product-main {
        flex-direction: column;
    }

    .single-product-image {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* =========================================
   MOBILE DEVICES (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    body:not(.home) {
        padding-top: 100px;
    }

    /* Hero Section - Full Viewport Height */
    .hero-section,
    .hero-section .slick-list,
    .hero-section .slick-track,
    .hero-section .hero-slide {
        height: 100svh !important; 
        min-height: 500px !important; 
        max-height: 750px !important; 
    }
    .hero-slide {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important; 
    }
    .hero-background {
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    .hero-content {
        padding-top: 120px !important;*/
        padding-bottom: 0 !important;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: center; 
    }
    .hero-title {
        font-size: 36px !important;
        text-align: center;
    }
    .hero-description {
        font-size: 16px !important;
        text-align: center;
    }
    /* Made in USA - Relative positioning at bottom */
    .made-in-usa {
        position: relative !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;
        align-self: flex-end !important;
        margin: 20px 24px 30px 0 !important;
        text-align: center;
        z-index: 5;
    }
    .made-in-usa img {
        width: 116px !important;
        height: auto;
        margin: 0 auto;
    }
    .made-in-usa p {
        font-size: 14px !important;
        margin: 8px 0 0 0 !important;
    }  
    /* Merged text-align */

    /* Navigation */
    .main-navigation .nav-menu {
        display: none;
    }

    /* Hidden by default */
    .mobile-menu-toggle {
        display: block;
        font-size: 30px;
        line-height: 1;
        padding: 5px;
        margin-left: 15px;
        border: none !important;
        color: #fff;
    }

    .search-icon {
        display: none;
    }

    /* Hidden on mobile */

    /* Ensure toggle button logic */
    .main-navigation .nav-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
        opacity: 0;
    }

    .main-navigation.active .nav-menu {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #ffffff;
        padding: 30px 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        z-index: 2000;
        gap: 20px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        max-height: 500px;
        opacity: 1;
    }

    .main-navigation.active .nav-menu li {
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateY(-10px);
        animation: slideInNav 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    }

    .main-navigation.active .nav-menu li:nth-child(1) {
        animation-delay: 0.1s;
    }

    .main-navigation.active .nav-menu li:nth-child(2) {
        animation-delay: 0.15s;
    }

    .main-navigation.active .nav-menu li:nth-child(3) {
        animation-delay: 0.2s;
    }

    .main-navigation.active .nav-menu li:nth-child(4) {
        animation-delay: 0.25s;
    }

    .main-navigation.active .nav-menu li:nth-child(5) {
        animation-delay: 0.3s;
    }

    .main-navigation.active .nav-menu li:nth-child(6) {
        animation-delay: 0.35s;
    }

    .main-navigation.active .nav-menu li a {
        display: block;
        padding: 10px;
        color: #04316A;
        font-size: 18px;
        font-weight: 600;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        position: relative;
    }

    .main-navigation.active .nav-menu li a:hover {
        transform: translateX(5px);
        opacity: 0.9;
    }

    @keyframes slideInNav {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .header-container {
        padding: 15px 24px;
        height: auto;
    }

    .header-container .logo {
        width: 50px;
    }

    .site-header.menu-open {
        background-color: #101642 !important;
    }

    /* Keep white header white when menu is open */
    body.able-white-header .site-header.menu-open {
        background-color: #ffffff !important;
    }

    .site-header {
        height: auto;
    }

    /* Header scroll effect on mobile home page */
    body.home .site-header {
        height: auto;
        background: transparent !important;
        box-shadow: none !important;
    }

    body.home .site-header.sticky {
        background: #101642 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    }

    body.home .site-header.menu-open {
        background-color: #101642 !important;
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Enforced 2 columns */
        gap: 15px !important;
        padding: 0 24px;
    }

    /* Product Cards Mobile Refined to Figma Specs */
    .product-card {
        display: block !important;
        height: 98px !important;
        position: relative !important;
        overflow: hidden !important;
        padding: 0 !important;
        min-height: auto !important;
        background: #f1f1f1;
    }

    .featured-item {
        padding: 60px 24px;
    }

    .product-card .card-title,
    .product-card .card-title-wrapper {
        position: absolute !important;
        top: 9px !important;
        left: 8.57px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        line-height: 100% !important;
        font-family: 'Inter', sans-serif !important;
        max-width: 108px !important;
        margin: 0 !important;
        z-index: 10 !important;
        color: #04316A;
        display: block !important;
        text-align: left !important;
    }

    .product-card .card-image,
    .product-card .card-image-wrapper {
        position: absolute !important;
        right: 0 !important;
        top: 17px !important;
        width: 40% !important;
        height: 100% !important;
        object-fit: contain !important;
        object-position: center right !important;
        display: block !important;
        filter: drop-shadow(0px 10px 15px rgba(0, 0, 0, 0.4)) !important;
        z-index: 5 !important;
    }

    .product-card .card-arrow {
        position: absolute !important;
        bottom: 10px !important;
        left: 10px !important;
        width: 18px !important;
        height: 18px !important;
        z-index: 20 !important;
        display: flex !important;
        margin-top: 0 !important;
    }

    .product-card .card-arrow svg {
        width: 100% !important;
        height: 100% !important;
    }

    /* About Section */
    .about-section {
        flex-direction: column !important;
        gap: 30px !important;
        padding: 40px 24px !important;
        text-align: center;
    }

    .about-content {
        width: 100%;
        max-width: 100%;
        margin-right: 0;
    }

    .about-text {
        text-align: center;
        margin-bottom: 30px;
    }

    .about-image-wrapper {
        width: 100%;
        height: 250px;
        margin-top: 20px;
    }

    .about-image-wrapper::after {
        display: none;
    }

    /* Customers */
    .customers-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .customers-section .section-title {
        padding: 0 !important;
        margin: 0;
    }

    /* Contact & Footer */
    .contact-section {
        flex-direction: column;
        text-align: center;
        gap: 40px;
        padding: 40px 24px;
    }

    .contact-info {
        order: 2;
    }

    .contact-info h2,
    .contact-info p {
        font-size: 25px;
    }

    .contact-region-block {
        text-align: left;
        /* Align text left on mobile for readability */
        padding: 0 10px;
    }

    .region-title {
        font-size: 18px;
    }

    .contact-breadcrumbs {
        text-align: center;
        margin-bottom: 20px;
        font-size: 16px;
    }

    .contact-logo {
        width: auto;
        height: auto;
    }

    .contact-logo img {
        max-width: 120px !important;
    }

    .footer-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 40px;
        /* отступ между секциями */
        align-items: flex-start;
        padding: 69px 50px;
        /* из макета */
        grid-template-columns: unset !important;
        /* полностью убираем grid */
    }

    /* Сброс grid-column для всех элементов */
    .footer-logo,
    .footer-col-1,
    .footer-col-2,
    .footer-col-3,
    .footer-contact,
    .footer-nav {
        grid-column: unset !important;
        width: 100%;
    }

    .footer-logo {
        width: 100px;
        height: auto;
        margin-bottom: 0;
        margin-right: 0 !important;
    }

    .footer-nav {
        width: 100%;
    }

    .footer-nav ul {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin: 0;
        padding: 0;
    }

    .footer-nav a {
        font-size: 14px;
    }

    .footer-contact {
        width: 100%;
        margin-top: 10px;
    }

    .footer-contact p,
    .footer-contact a {
        color: #fff !important;
        opacity: 0.8;
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 12px;
        text-decoration: underline;
    }

    .footer-contact p:last-child {
        margin-bottom: 0;
    }

    .made-in-usa {
        right: 40px;
        bottom: 40px;
    }

    /* Specs */
    .specs-grid {
        grid-template-columns: 1fr;
    }

    /* General Padding Resets */
    .products-section,
    .featured-section {
        padding: 0 0px !important;
    }

    .site-footer {
        padding: 0 !important;
        min-height: auto;
        height: auto;
    }

    /* Note: All footer padding is now handled by .footer-content above */
}

/* =========================================
   MOBILE STYLES FOR PRODUCT CATEGORY PAGE
   ========================================= */

@media (max-width: 768px) {
    /* Legacy product card image fixes removed in favor of CSS Grid layout */
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    /* Legacy product card image fixes removed in favor of CSS Grid layout */
}

@media (max-width: 1024px) {

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

    .site-header,
    .q-site-header {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }

    .site-header *,
    .q-site-header * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* КРИТИЧЕСКОЕ */
    .site-header-inner,
    .q-header-inner,
    .elementor-container,
    .elementor-section,
    .elementor-section-wrap {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ===========================
   MOBILE PRODUCT REORDER
   =========================== */
@media (max-width: 768px) {

    .products-sidebar {
        display: none;
    }

    .single-product-main {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .products-category-header .section-title {
        order: 1;

        text-align: left;
        align-self: flex-start;

        font-size: 20px;
        line-height: 38px;
        font-weight: 600;

        margin: 0 0 4px 0;
        padding-left: 12px;

        width: auto;
        opacity: 1;
        text-transform: none;
    }

    .products-breadcrumb {
        order: 2;
        padding-left: 12px;
        margin-bottom: 12px;
        text-align: left;
    }

    .single-product-image {
        order: 3;
        width: 100%;
    }

    /* Title */
    .single-product-title {
        order: 4;
        margin-top: 16px;
        padding-left: 12px;
        text-align: left;
    }

    .single-product-attributes-custom {
        order: 5;
        width: 100%;
        padding-left: 12px;
    }

    .single-product-excerpt {
        order: 6;
        padding-left: 12px;
    }

    .single-product-extra-info {
        order: 7;
        width: 100%;
        padding-left: 12px;
    }
}

/* ===========================
   MOBILE HEADER COLOR LOGIC
   =========================== */
@media (max-width: 768px) {

    /* =====================
       HOME PAGE
       ===================== */

    body.home.is-at-top .site-header {
        background: transparent !important;
        box-shadow: none !important;
    }

    body.home.is-at-top .mobile-menu-toggle {
        color: #ffffff !important;
    }

    body.home:not(.is-at-top) .site-header {
        background: #101642 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    }

    body.home:not(.is-at-top) .mobile-menu-toggle {
        color: #ffffff !important;
    }

    body.home .site-header.menu-open {
        background: #101642 !important;
    }

    body.home .site-header.menu-open .mobile-menu-toggle {
        color: #ffffff !important;
    }


    /* =====================
       OTHER PAGES
       ===================== */

    body:not(.home) .site-header {
        background: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    }

    body:not(.home) .mobile-menu-toggle {
        color: #04316A !important;
    }

    /* Открытое меню — НЕ МЕНЯЕМ */
    body:not(.home) .site-header.menu-open {
        background-color: #101642 !important;
    }

    body:not(.home) .site-header.menu-open .mobile-menu-toggle {
        color: #ffffff !important;
    }
}

/* ===========================
   MOBILE HEADER HEIGHT REDUCE (-25%)
   =========================== */
@media (max-width: 768px) {

    /* Основная высота */
    .header-container {
        padding-top: 10px;
        /* было ~15 */
        padding-bottom: 10px;
    }

    /* Логотип */
    .header-container .logo,
    .header-container img {
        max-height: 38px;
        /* было ~50 */
        width: auto;
    }

    /* Бургер */
    .mobile-menu-toggle {
        font-size: 22px;
        /* было ~30 */
        line-height: 1;
        padding: 4px;
    }
}

@media (max-width: 768px) {
    body:not(.home) {
        padding-top: 75px;
    }
}

@media (max-width: 1024px) {

    .single-product-description .single-product-section-title,
    .single-product-description .single-product-description-text,
    .product-specs-section .single-product-section-title,
    .spec-item,
    .single-product-description-text p {
        color: #5A6778 !important;
        font-family: inherit !important;
        font-weight: inherit !important;
    }

    .single-product-description .single-product-description-text,
    .product-specs-section,
    .specs-grid,
    .spec-item,
    .single-product-description .single-product-description-text p,
    .spec-item .spec-title {
        color: #5A6778 !important;
    }

    .single-product-description-text,
    .single-product-description-text * {
        color: #ffffff !important;
    }

    .single-product-description-text table,
    .single-product-description-text th,
    .single-product-description-text td {
        background: #ffffff !important;
        color: #04316A !important;
        /*border-color: #ffffff !important;*/
    }
}

@media (max-width: 768px) {
    .woocommerce-product-gallery__image {
        overflow: hidden !important;
        position: relative !important;
    }

    .woocommerce-product-gallery__image img {
        transform: none !important;
    }
}

/* ===========================
   FIX ATTRIBUTES BELOW IMAGE ON MOBILE
   =========================== */
@media (max-width: 768px) {
    .single-product-main {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .single-product-image {
        order: 1;
        width: 100%;
    }

    .single-product-summary {
        order: 2;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .single-product-attributes-custom {
        order: 2;
        width: 100%;
    }

    .single-product-title {
        order: 1;
        width: 100%;
    }

    .single-product-excerpt {
        order: 3;
        width: 100%;
    }

    .single-product-extra-info {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 1100px) and (min-width: 769px) {
    .header-container {
        padding: 20px 40px !important;
    }

    .logo {
        width: 70px !important;
        height: 70px !important;
    }
}

@media (min-width: 1101px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .main-navigation .nav-menu {
        display: flex !important;
    }
}

@media (max-width: 767px) {

    /* Target the class directly AND any paragraphs inside it for robust clamping */
    .mobile-10-lines,
    .mobile-10-lines p {
        display: -webkit-box !important;
        -webkit-line-clamp: 7 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Open state for both container and nested paragraphs */
    .mobile-10-lines.is-open,
    .mobile-10-lines.is-open p {
        display: block !important;
        -webkit-line-clamp: unset !important;
        max-height: none !important;
        overflow: visible !important;
    }
}


.able-doc-btn:hover {
    background-color: #ff2a00 !important;
    /* красный */
    color: #ffffff;
    /* оставляем текст белым */
}

/* About Us section paragraph override */
.elementor-element-9d4ebc4 p {
    color: #000000 !important;
    font-size: 20px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    font-family: 'Inter', sans-serif !important;
}

.company-row:hover h1,
.company-row:hover h2,
.company-row:hover h3,
.company-row:hover p,
.company-row:hover a {
    color: #ffffff !important;
}

/* FIX ТОЛЬКО для маленьких iPhone (X, SE, mini) */
@media screen and (max-width: 390px) {

    .ios-fix-block {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .ios-fix-block .e-con-full,
    .ios-fix-block .e-con {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* ТЕКСТ — главная проблема */
    .ios-fix-block p {
        max-width: 100%;
        box-sizing: border-box;
        word-break: break-word;
        overflow-wrap: break-word;
        text-align: left !important;
        /* для Safari */
    }

    /* кнопки */
    .ios-fix-block .elementor-button {
        max-width: 100%;
        /*width: 311px;*/
    }

    /* контейнер с текстом + кнопкой */
    .ios-text-fix {
        box-sizing: border-box;
        width: 100%;
        padding-left: 12px;
        /* внутренний отступ */
        padding-right: 12px;
        margin-left: 18px;
        margin-right: 0;
    }

    /* защита от переполнения текста */
    .ios-text-fix p,
    .ios-text-fix h1,
    .ios-text-fix h2,
    .ios-text-fix h3 {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
    }

}

/* === iOS SAFARI — FINAL HARD FIX === */
@supports (-webkit-touch-callout: none) {
    @media screen and (max-width: 430px) {

        /* верхний контейнер блок + фон */
        .ios-fix-block {
            display: flex !important;
            flex-direction: column !important;

            width: auto !important;
            max-width: 390px !important;
            /* ограничение под iPhone X/SE/Mini */

            /* центрирование + горизонтальные отступы */
            margin: 16px 16px !important;
            /* сверху/снизу 16px, слева/справа 12px */
            padding: 0 !important;
            /* внутренний padding убираем */

            overflow-x: hidden !important;
            box-sizing: border-box !important;
        }

        /* ВСЕ elementor containers внутри */
        .ios-fix-block .e-con,
        .ios-fix-block .e-con-full {
            display: flex !important;
            flex-direction: column !important;

            width: 100% !important;
            max-width: 100% !important;

            overflow-x: hidden !important;
            box-sizing: border-box !important;

            margin-bottom: 20px !important;
        }

        /* последний блок — без лишнего отступа */
        .ios-fix-block .e-con:last-child {
            margin-bottom: 0 !important;
        }

        /* текстовый блок */
        .ios-text-fix {
            width: 100% !important;
            max-width: 100% !important;

            padding-left: 12px !important;
            padding-right: 12px !important;

            margin: 0 !important;
            box-sizing: border-box !important;
        }

        /* Верхнее изображение — центрируем */
        .ios-fix-block>.elementor-widget-image img,
        .ios-fix-block .e-con>.elementor-widget-image img {
            display: block !important;
            margin-left: auto !important;
            margin-right: auto !important;
            max-width: 100% !important;
            height: auto !important;
        }

    }
}

/* Global protection against horizontal scroll and shifting */
html,
body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative !important;
}

/* =========================================
   MOBILE PRODUCT TABLE TOGGLE
   ========================================= */
@media (max-width: 768px) {
    .product-table-toggle {
        width: 100% !important;
        justify-content: center;
        padding: 14px;
        font-size: 14px;
    }

    /* Ensure table is scrollable on mobile when expanded */
    .product-table-collapse {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        display: block;
        /* Ensure it behaves as a block for scrolling */
        width: 100%;
    }

    /* Let table decide its width, but allow it to be wide */
    .product-table-collapse table {
        width: auto !important;
        min-width: 0 !important;
        /* Allow it to shrink if possible, or expand if content demands */
        max-width: none !important;
        /* Allow scroll if content is wide */
    }
}

@media (max-width: 767px) {
    .elementor-element-ca61cf4 .elementor-heading-title {
        font-family: "Gotham Pro", Arial, sans-serif !important;
    }
}
