/*
 * ShipShackStock PWA + mobile polish
 * Patch version: 2026-04-24
 */

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

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

#instant_search {
    max-width: calc(100vw - 30px);
}

/* Better image-card behavior without changing the old PHP templates */
.image-box .overlay-container {
    overflow: hidden;
}

.image-box .overlay-container img.home_img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sss-mobile-tabbar {
    display: none;
}

.sss-pwa-install {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 78px;
    z-index: 100000;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(43, 33, 31, 0.97);
    color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.26);
    font-family: Roboto, Arial, sans-serif;
}

.sss-pwa-install.is-visible {
    display: flex;
}

.sss-pwa-install__text {
    flex: 1;
    line-height: 1.35;
    font-size: 13px;
}

.sss-pwa-install__text strong {
    display: block;
    font-size: 14px;
}

.sss-pwa-install__button,
.sss-pwa-install__close {
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.sss-pwa-install__button {
    padding: 8px 13px;
    background: #e41e26;
    color: #ffffff;
    font-weight: 600;
}

.sss-pwa-install__close {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
}

/* Tablet/mobile */
@media (max-width: 991px) {
    .header .container,
    .header-top .container {
        width: 100%;
    }

    .header .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    .header-left {
        text-align: center;
    }

    .header-left .logo,
    .footer .logo {
        max-width: 100%;
    }

    .header-left .logo img,
    .footer .logo img {
        max-width: min(300px, calc(100vw - 36px));
        width: auto !important;
        height: auto !important;
    }

    .main-navigation .navbar {
        margin-bottom: 0;
    }

    .main-navigation .navbar .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }

    .navbar-header {
        min-height: 44px;
    }

    .navbar-toggle {
        margin: 6px 8px 6px auto;
        float: right;
    }

    .header-dropdown-buttons {
        float: none !important;
        width: 100%;
        padding: 8px 10px 12px;
    }

    .header-dropdown-buttons .btn-group {
        width: 100%;
        padding-left: 0 !important;
    }

    .header-dropdown-buttons .search-box,
    .header-dropdown-buttons .search-box .form-group,
    .header-dropdown-buttons .search-box input {
        width: 100%;
    }

    #instant_search {
        width: 100% !important;
    }
}

/* Phone app-like layout */
@media (max-width: 767px) {
    body {
        padding-bottom: 74px;
    }

    .page-wrapper {
        padding-bottom: 10px;
    }

    .header-top.dark {
        min-height: 34px;
    }

    .header-top .row {
        display: flex;
        align-items: center;
    }

    .header-top .col-xs-3,
    .header-top .col-xs-9 {
        padding-left: 8px;
        padding-right: 8px;
    }

    .header-top .btn,
    .header-top-dropdown .btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .header.fixed {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        box-shadow: none;
    }

    .header-left {
        padding: 8px 0 6px;
    }

    .header-left .logo img {
        max-width: min(280px, calc(100vw - 32px));
    }

    .navbar-default {
        background: #ffffff;
        border-left: 0;
        border-right: 0;
    }

    .navbar-collapse {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }

    .mega-menu .dropdown-menu,
    .dropdown-menu {
        max-width: 100%;
    }

    #page-start {
        margin-top: 0 !important;
    }

    .page-title {
        font-size: 20px;
        line-height: 1.25;
        margin-top: 22px;
    }

    .lead {
        font-size: 13px;
        line-height: 1.45;
        padding: 0 10px;
    }

    .filters {
        margin-left: -5px;
        margin-right: -5px;
    }

    .filters > .col-sm-3,
    .filters > .col-md-3 {
        width: 50%;
        float: left;
        padding-left: 5px;
        padding-right: 5px;
    }

    .filters .image-box {
        margin-bottom: 10px;
        border-radius: 10px;
        overflow: hidden;
    }

    .filters .image-box .overlay-container {
        height: 118px !important;
    }

    .label-new .new {
        font-size: 9px;
    }

    .cms-banner-left,
    .cms-banner-middle,
    .cms-banner-right {
        margin-bottom: 12px;
    }

    .footer {
        padding-bottom: 74px;
    }

    .subfooter p {
        text-align: center;
    }

    .subfooter p a[style*="float"] {
        float: none !important;
        display: block;
        margin-top: 12px;
    }

    .sss-mobile-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 99999;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        height: 66px;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,0.98);
        border-top: 1px solid rgba(0,0,0,0.12);
        box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .sss-mobile-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        color: #5b5b5b;
        text-decoration: none !important;
        font: 11px/1.1 Roboto, Arial, sans-serif;
        border-radius: 12px;
    }

    .sss-mobile-tabbar a i {
        font-size: 18px;
        line-height: 1;
    }

    .sss-mobile-tabbar a span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .sss-mobile-tabbar a.is-active {
        color: #e41e26;
        background: rgba(228,30,38,0.08);
        font-weight: 600;
    }
}

@media (max-width: 374px) {
    .header-left .logo img {
        max-width: 248px;
    }

    .filters .image-box .overlay-container {
        height: 105px !important;
    }

    .sss-mobile-tabbar a {
        font-size: 10px;
    }
}

@media (display-mode: standalone) {
    .sss-pwa-install {
        display: none !important;
    }
}
