/*
 * Hammerite Responsive
 * Responsive layer for OpenCart 1.5 default theme.
 * Desktop layout stays close to the original; phone/tablet rules are below.
 */

/* Safe responsive defaults */
*, *:before, *:after {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

#mobile-menu-toggle {
    display: none;
}

/* Prevent long content from forcing the whole page wider than the viewport. */
#content,
.box,
.box-content,
.tab-content,
.category-info,
.product-info,
.checkout-content,
.contact-info,
.sitemap-info {
    max-width: 100%;
}

/* Tablets and narrow desktop windows */
@media only screen and (max-width: 1000px) {
    #container {
        width: auto;
        max-width: 980px;
        margin-left: 10px;
        margin-right: 10px;
    }

    #menu > ul > li > a {
        padding-left: 7px;
        padding-right: 7px;
        font-size: 12px;
    }

    .slideshow,
    .slideshow .nivoSlider {
        max-width: 100% !important;
    }

    .banner img,
    .category-info img,
    #content img {
        max-width: 100%;
        height: auto;
    }
}

/* Phones */
@media only screen and (max-width: 767px) {
    html {
        overflow-x: hidden;
    }

    body {
        min-width: 0;
        overflow-x: hidden;
    }

    body, td, th, input, textarea, select, a {
        font-size: 14px;
    }

    h1, .welcome {
        font-size: 24px;
        line-height: 1.25;
        margin-bottom: 14px;
    }

    h2 {
        font-size: 18px;
        line-height: 1.3;
    }

    #container {
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0 10px;
    }

    /* Header */
    #header {
        height: auto;
        min-height: 0;
        margin-bottom: 10px;
        padding: 10px 0 0 0;
        position: relative;
        z-index: 99;
    }

    #header #logo {
        position: static;
        text-align: center;
        margin: 0 auto 10px auto;
    }

    #header #logo img {
        display: inline-block;
        max-width: 92%;
        max-height: 75px;
        width: auto;
        height: auto;
    }

    #language,
    #currency {
        position: static;
        display: inline-block;
        vertical-align: top;
        width: auto;
        min-width: 0;
        margin: 0 12px 10px 0;
        line-height: 26px;
    }

    #header #search {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin: 0 0 10px 0;
        z-index: 15;
    }

    #header .button-search {
        left: 0;
        top: 0;
        height: 38px;
        width: 40px;
    }

    #header #search input {
        width: 100%;
        height: 40px;
        padding: 6px 8px 6px 48px;
        font-size: 16px;
    }

    #header #cart {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        min-width: 0;
        margin: 0 0 10px 0;
        z-index: 30;
    }

    #header #cart .heading,
    #header #cart.active .heading {
        float: none;
        margin: 0;
        padding: 9px 12px;
        border: 1px solid #EEEEEE;
        border-radius: 4px;
        background: #FFFFFF;
    }

    #header #cart .heading h4 {
        display: inline-block;
        margin: 0 8px 0 0;
        font-size: 15px;
    }

    #header #cart .heading a {
        display: inline-block;
    }

    #header #cart .content {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        width: auto;
        min-width: 0;
        max-height: 70vh;
        overflow: auto;
        border-radius: 0 0 7px 7px;
        box-shadow: 0 2px 5px #CCCCCC;
    }

    #header #welcome {
        display: none;
    }

    #header .links {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        width: 100%;
        padding: 0;
        margin: 0 0 10px 0;
        font-size: 13px;
    }

    #header .links a {
        float: none;
        display: inline-block;
        padding: 4px 0;
        font-size: 13px;
        border: 0 !important;
        margin: 0 !important;
    }

    /* Mobile category menu */
    #menu {
        height: auto;
        min-height: 44px;
        padding: 0;
        margin-bottom: 14px;
        border-radius: 5px;
        overflow: visible;
    }

    #mobile-menu-toggle {
        display: block;
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        border: 0;
        background: transparent;
        color: #FFFFFF;
        text-align: left;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
    }

    .mobile-menu-icon {
        display: inline-block;
        margin-right: 8px;
        font-size: 20px;
        line-height: 1;
        vertical-align: -1px;
    }

    #menu > ul {
        display: none;
        width: 100%;
        padding: 0 5px 7px 5px;
    }

    #menu.mobile-open > ul {
        display: block;
    }

    #menu > ul > li {
        float: none;
        width: 100%;
        padding: 0;
        border-top: 1px solid rgba(255,255,255,.16);
    }

    #menu > ul > li > a {
        padding: 11px 10px;
        margin: 0;
        font-size: 15px;
        line-height: 20px;
        border-radius: 0;
    }

    #menu > ul > li:hover > a {
        border-radius: 0;
    }

    #menu > ul > li > div,
    #menu > ul > li:hover > div {
        display: block;
        position: static;
        width: 100%;
        padding: 0 0 7px 14px;
        border: 0;
        border-radius: 0;
        background: rgba(0,0,0,.16);
    }

    #menu > ul > li > div > ul {
        display: block;
        width: 100%;
        padding: 0 !important;
    }

    #menu > ul > li ul + ul {
        padding-left: 0;
    }

    #menu > ul > li ul > li > a {
        min-width: 0;
        white-space: normal;
        padding: 8px 10px;
        line-height: 18px;
    }

    /* Main layout: side columns are hidden on phones; all categories remain in the top menu. */
    #column-left,
    #column-right {
        display: none;
    }

    #column-left + #column-right + #content,
    #column-left + #content,
    #column-right + #content,
    #content {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        min-height: 0;
    }

    .breadcrumb {
        line-height: 20px;
        overflow-wrap: anywhere;
    }

    /* Hide the large desktop slideshow on phones. */
    .slideshow {
        display: none !important;
    }

    /* General content */
    #content .content .left,
    #content .content .right,
    .contact-info .left,
    .contact-info .right,
    .sitemap-info .left,
    .sitemap-info .right,
    .login-content .left,
    .login-content .right,
    .checkout-content .left,
    .checkout-content .right {
        float: none;
        width: 100%;
        margin: 0 0 12px 0;
    }

    /* Forms */
    input[type='text'],
    input[type='password'],
    input[type='email'],
    input[type='tel'],
    textarea,
    select,
    input.large-field,
    select.large-field {
        max-width: 100%;
    }

    table.form,
    table.form tbody,
    table.form tr,
    table.form td {
        display: block;
        width: 100%;
    }

    table.form tr {
        margin-bottom: 10px;
    }

    table.form tr td:first-child {
        width: 100%;
        padding-bottom: 2px;
        font-weight: bold;
    }

    table.form td {
        padding-left: 0;
        padding-right: 0;
    }

    table.form input[type='text'],
    table.form input[type='password'],
    table.form textarea,
    table.form select,
    .checkout-content input[type='text'],
    .checkout-content input[type='password'],
    .checkout-content textarea,
    .checkout-content select {
        width: 100%;
        min-height: 38px;
        font-size: 16px;
    }

    textarea {
        min-height: 90px;
    }

    /* Category */
    /* On phones hide the category thumbnail and all images inserted into the category description. */
    .category-info .image,
    .category-info img {
        display: none !important;
    }

    .category-list ul,
    .manufacturer-list ul {
        float: none;
        width: 100%;
        margin: 0 0 8px 0;
        padding-left: 18px;
    }

    .product-filter {
        padding-bottom: 10px;
    }

    .product-filter .display {
        display: none;
    }

    .product-filter .sort,
    .product-filter .limit {
        float: none;
        width: 100%;
        margin: 0 0 8px 0;
    }

    .product-filter .sort select,
    .product-filter .limit select {
        width: 100%;
        min-height: 38px;
    }

    .product-compare {
        margin-bottom: 14px;
    }

    /* Two-column product grid on phones */
    .product-grid,
    .box-product {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        width: calc(100% + 10px);
        margin-left: -5px;
        margin-right: -5px;
        overflow: visible;
    }

    .product-grid > div,
    #column-left + #column-right + #content .product-grid > div,
    .box-product > div,
    #column-left + #column-right + #content .box-product > div {
        width: 50%;
        margin: 0 0 16px 0;
        padding: 0 5px;
    }

    .product-grid .image,
    .box-product .image {
        text-align: center;
        min-height: 0;
    }

    .product-grid .image img,
    .box-product .image img {
        width: auto;
        max-width: 100%;
        height: auto;
    }

    .product-grid .name a,
    .box-product .name a {
        font-size: 14px;
        line-height: 18px;
    }

    .product-grid .cart input.button,
    .product-grid .cart a.button,
    .box-product a.button {
        max-width: 100%;
    }

    .product-grid .wishlist a,
    .product-grid .compare a {
        font-size: 12px;
        line-height: 16px;
    }

    /* If list view is selected manually, keep it readable. */
    .product-list > div {
        padding-bottom: 12px;
    }

    .product-list .right {
        float: none;
        margin: 8px 0 0 0;
    }

    .product-list .image {
        max-width: 38%;
        margin-right: 10px;
    }

    .product-list .price {
        float: none;
        height: auto;
        margin: 6px 0;
        text-align: left;
    }

    /* Product page */
    .product-info {
        overflow: visible;
    }

    .product-info > .left {
        float: none;
        width: 100%;
        margin: 0 0 12px 0;
    }

    .product-info > .left + .right {
        margin-left: 0;
        width: 100%;
    }

    .product-info .image {
        float: none;
        width: 100%;
        padding: 8px;
        margin-bottom: 12px;
    }

    .product-info .image img {
        max-width: 100%;
        height: auto;
    }

    .product-info .image-additional {
        width: 100%;
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .product-info .image-additional a {
        float: none;
        margin: 0 0 8px 0;
    }

    .product-info .description,
    .product-info .price,
    .product-info .options,
    .product-info .cart {
        padding-left: 0;
        padding-right: 0;
    }

    .product-info .option select,
    .product-info .option input[type='text'],
    .product-info .option textarea {
        width: 100%;
        min-height: 38px;
        font-size: 16px;
    }

    .product-info .cart input[name='quantity'] {
        min-height: 38px;
        font-size: 16px;
    }

    .product-info .cart .links {
        display: block;
        margin-top: 10px;
        line-height: 24px;
    }

    .htabs {
        height: auto;
        min-height: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        border-bottom: 1px solid #DDDDDD;
    }

    .htabs a {
        float: none;
        display: block;
        margin: 0;
        padding: 8px 10px;
        font-size: 13px;
    }

    .tab-content {
        padding: 10px 0;
        overflow-x: auto;
    }

    .attribute,
    .compare-info {
        min-width: 620px;
    }

    /* Carts and checkout tables remain fully usable by horizontal scrolling. */
    .cart-info,
    .wishlist-info,
    .checkout-product,
    .compare-info {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cart-info table,
    .wishlist-info table,
    .checkout-product table {
        min-width: 650px;
    }

    .cart-total table {
        float: none;
        width: 100%;
    }

    .checkout-heading {
        padding: 11px 9px;
        font-size: 14px;
    }

    .checkout-content {
        overflow: visible;
    }

    /* Account/return pages */
    .return-name,
    .return-model,
    .return-quantity,
    .return-reason,
    .return-opened,
    .return-captcha {
        float: none;
        width: 100%;
        margin: 0 0 12px 0;
    }

    .order-list .order-content div,
    .return-list .return-content div,
    .download-list .download-content div {
        float: none;
        width: 100%;
        margin-bottom: 5px;
    }

    /* Buttons */
    .buttons {
        overflow: visible;
    }

    .buttons .left,
    .buttons .right,
    .buttons .center {
        float: none;
        text-align: center;
        width: 100%;
        margin: 6px 0;
    }

    .buttons a.button,
    .buttons input.button {
        display: inline-block;
        min-width: 150px;
        text-align: center;
    }

    /* Footer */
    #footer {
        padding: 15px 10px;
    }

    #footer .column {
        width: 50%;
        min-height: 0;
        padding-right: 10px;
        margin-bottom: 16px;
    }

    #footer .column:nth-child(odd) {
        clear: left;
    }

    #powered {
        text-align: center;
        line-height: 20px;
    }
}

/* Very narrow phones */
@media only screen and (max-width: 420px) {
    #container {
        padding-left: 8px;
        padding-right: 8px;
    }

    .product-grid .name a,
    .box-product .name a {
        font-size: 13px;
        line-height: 17px;
    }

    #footer .column {
        float: none;
        width: 100%;
        padding-right: 0;
    }
}