/**
 * Mobile-specific customizations
 */

/* Mobile Top Header - Phone and Email in one line and centered */
@media (max-width: 767px) {
    .th-contact-info {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        width: 100%;
        gap: 15px;
    }
    
    .th-social {
        justify-content: center;
        width: 100%;
        margin-top: 5px;
    }
}

/* Mobile Main Header - Logo left, cart and button right */
@media (max-width: 767px) {
    .mh-container {
        justify-content: space-between;
    }
    
    .mh-logo {
        flex: 0 0 auto;
    }
    
    .mh-nav {
        display: none; /* Hide default navigation on mobile */
    }
    
    .mh-actions {
        display: flex;
        align-items: center;
    }
    
    /* Hide all icons except cart and button on header */
    .mh-actions .mh-account,
    .mh-actions .mh-wishlist,
    .mh-actions .mh-search {
        display: none;
    }
    
    /* Make Get Started button appropriately sized */
    .mh-btn {
        padding: 6px 12px !important;
        font-size: 11px !important;
        margin-right: 10px !important;
        line-height: 1.4 !important;
        min-width: auto !important;
        max-width: 100px !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        white-space: nowrap !important;
    }
}

/* Fix horizontal scrolling issue on mobile */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative !important;
}

/* Fix container widths to prevent overflow */
.container, .row, .col, [class*="col-"], .top-header-inner, .mh-container, .mh-actions, .footer-bottom-container, .footer-widgets-container {
    max-width: 100% !important;
    overflow: hidden !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Fix any element with potential overflow */
.th-contact-info, .th-social, .th-email, .th-phone {
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Ensure all images and media are responsive */
img, video, iframe, embed, object {
    max-width: 100% !important;
    height: auto !important;
}

/* Make newsletter input box smaller and centered on mobile */
@media (max-width: 767px) {
    .newsletter-form {
        max-width: 100% !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
    }
    
    .newsletter-form input[type="email"] {
        width: 100% !important;
        max-width: 160px !important;
        padding: 6px !important;
        font-size: 12px !important;
        height: 30px !important;
    }
    
    .newsletter-form button {
        padding: 6px !important;
        height: 30px !important;
        width: 30px !important;
        min-width: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .newsletter-form button i {
        font-size: 12px !important;
    }
    
    /* Left-align footer content on mobile */
    .footer-widget {
        text-align: left !important;
    }
    
    .footer-widget-title {
        text-align: left !important;
    }
    
    /* Fix payment images size */
    .payment-icons img {
        max-width: 35px !important;
        height: auto !important;
        width: auto !important;
    }
    
    /* Left-align footer bottom content */
    .footer-bottom-container {
        justify-content: flex-start !important;
        gap: 20px !important;
    }
}

/* Mobile Footer Navigation - Force display on mobile */
.mobile-footer-nav {
    display: none;
}

@media (max-width: 767px) {
    .mobile-footer-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        background: #fff !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
        z-index: 99999 !important; /* Extremely high z-index to force it on top */
        padding: 10px 0 !important;
    }
    
    .mobile-footer-nav-inner {
        display: flex;
        justify-content: space-around;
        width: 100%;
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #666;
        font-size: 10px;
    }
    
    .mobile-nav-item i {
        font-size: 20px;
        margin-bottom: 0;
        color: #333;
    }
    
    /* Make menu icon larger */
    .mobile-nav-item.mobile-menu-toggle i {
        font-size: 24px !important;
        color: #333;
    }
    
    .mobile-nav-item.active {
        color: #ff6600 !important;
    }
    
    .mobile-nav-item.active i {
        color: #ff6600 !important;
    }
    
    /* Menu toggle specific styles */
    .mobile-nav-item.mobile-menu-toggle {
        position: relative;
    }
    
    .mobile-nav-item.mobile-menu-toggle.active i {
        color: #ff6600 !important;
    }
    
    /* Force main navigation to display when toggled */
    .mh-nav.toggled, #site-navigation.toggled {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        position: fixed !important;
        left: 0 !important;
        bottom: 61px !important; /* Just above the mobile footer nav */
        background: white !important;
        z-index: 99998 !important;
        box-shadow: 0 -5px 10px rgba(0,0,0,0.1) !important;
        padding: 15px !important;
    }
    
    #site-navigation.toggled #primary-menu,
    .mh-nav.toggled .menu,
    .main-navigation.toggled .menu {
        display: block !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        background: white !important;
        padding: 10px !important;
    }
    
    #site-navigation.toggled #primary-menu > li,
    .mh-nav.toggled .menu > li {
        border-bottom: 1px solid #eee !important;
        padding: 10px 0 !important;
    }
    
    /* Hide text for menu icon */
    .mobile-nav-item.mobile-menu-toggle span {
        display: none;
    }
    
    /* Mobile Menu Container Styles */
    .mobile-menu-container {
        display: none;
        position: fixed;
        bottom: 61px;
        left: 0;
        width: 100%;
        background: white;
        box-shadow: 0 -5px 10px rgba(0,0,0,0.1);
        z-index: 99998;
        padding: 20px 0;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .mobile-menu-container.active {
        display: block;
    }
    
    .mobile-menu-inner {
        padding: 0 20px;
    }
    
    .mobile-menu-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .mobile-menu-list li {
        border-bottom: 1px solid #eee;
        padding: 0;
        margin: 0;
    }
    
    .mobile-menu-list li:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-list li a {
        display: block;
        padding: 12px 0;
        color: #333;
        text-decoration: none;
        font-weight: 500;
        font-size: 16px;
    }
    
    /* Add padding to body to account for fixed footer nav */
    body {
        padding-bottom: 60px;
    }
    
    /* Reposition Back to Top button on mobile */
    .back-to-top {
        bottom: 70px !important; /* Position it above the mobile footer nav */
        right: 20px !important;
        z-index: 99999 !important; /* Ensure it's above everything */
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }
}
