/* Responsive overrides — stage 1: foundation */

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

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

/* Prevent horizontal overflow from fixed-width children */
body {
    overflow-x: hidden;
}

/* Fluid media and embeds */
iframe,
video,
embed,
object {
    max-width: 100%;
}

table {
    max-width: 100%;
}

/*!* Wide form fields from template.css *!*/
/*form.simpleForm input.inputtext,*/
/*form.simpleForm textarea.inputtext {*/
/*    min-width: 0;*/
/*}*/

.input-xlarge,
#jform_guestbook_content {
    max-width: 100%;
    box-sizing: border-box;
}

.bigmap {
    width: 100%;
    max-width: 700px;
    height: auto;
    min-height: 300px;
}

/* Logo inline width in index.php */
.logo img {
    width: auto;
    max-width: 275px;
}

/* Mobile drawer UI is hidden on desktop */
.mobile_contacts_toggle,
.mobile_menu_toggle,
.mobile_catalog_toggle,
.mobile_contacts_sidebar,
.mobile_menu_sidebar,
.mobile_catalog_sidebar {
    display: none;
}

/* --- Footer --- */

/* Tablet: 2 columns */
@media (max-width: 991px) {
    .sidebar, .header_desktop, .header_search, .sliderbg {
        display: none;
    }

    .maintext h3 {
        font-size: 18px;
    }

    .moduletable.maintext {
        padding-top: 30px;
    }

    .productdetails-view .product-description {
        max-width: 100%;
        overflow: auto;
    }

    .vm-product-container > div {
        width: 100%;
        float: none;
        margin-bottom: 15px;
    }

    .productdetails-view .spacer-buy-area {
        padding-left: 0;
    }

    .moduletablenew h3, .moduletablegal h3, .srezult, .featured-view h4, .latest-view h4, .recent-view h4, .topten-view h4 {
        font-size: 18px;
    }

    .breadcrumb, .icones {
        margin-top: 0;
    }

    .header_mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 0 0 15px;
        border-bottom: 1px solid #F0F3F9;
        position: sticky;
        top: 0;
        z-index: 11000;
        background: #fff;
    }

    .logo_mobile img {
        height: 30px;
        width: auto;
        max-width: 100%;
        object-fit: contain;
    }

    .header_mobile_actions {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .header_mobile_actions button {
        border-left: 1px solid #F0F3F9;
        padding: 6px 16px;

    }

    .mobile_contacts_toggle,
    .mobile_menu_toggle,
    .mobile_catalog_toggle {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border: 0;
        padding: 4px 6px;
        color: #000;
        background: transparent;
        font-size: 12px;
        font-weight: 400;
        line-height: 1.2;
        text-transform: none;
        cursor: pointer;
    }

    .mobile_contacts_toggle:hover,
    .mobile_menu_toggle:hover,
    .mobile_catalog_toggle:hover,
    .mobile_contacts_toggle:focus,
    .mobile_menu_toggle:focus,
    .mobile_catalog_toggle:focus {
        color: #000;
        background: transparent;
        outline: none;
    }

    .mobile_contacts_sidebar,
    .mobile_menu_sidebar,
    .mobile_catalog_sidebar {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 12000;
        pointer-events: none;
    }

    .mobile_menu_sidebar {
        z-index: 12001;
    }

    .mobile_catalog_sidebar {
        z-index: 12002;
    }

    .mobile_contacts_toggle_icon,
    .mobile_menu_toggle_icon,
    .mobile_catalog_toggle_icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        line-height: 1;
        color: #000;
    }

    .mobile_contacts_sidebar_overlay,
    .mobile_menu_sidebar_overlay,
    .mobile_catalog_sidebar_overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        opacity: 0;
        transition: opacity .2s ease;
    }

    .mobile_contacts_sidebar_panel,
    .mobile_menu_sidebar_panel,
    .mobile_catalog_sidebar_panel {
        position: absolute;
        right: 0;
        top: 0;
        width: min(360px, 92vw);
        height: 100%;
        background: #fff;
        transform: translateX(100%);
        transition: transform .25s ease;
        overflow-y: auto;
    }

    .mobile_contacts_sidebar.is-open,
    .mobile_menu_sidebar.is-open,
    .mobile_catalog_sidebar.is-open {
        pointer-events: auto;
    }

    .mobile_contacts_sidebar.is-open .mobile_contacts_sidebar_overlay,
    .mobile_menu_sidebar.is-open .mobile_menu_sidebar_overlay,
    .mobile_catalog_sidebar.is-open .mobile_catalog_sidebar_overlay {
        opacity: 1;
    }

    .mobile_contacts_sidebar.is-open .mobile_contacts_sidebar_panel,
    .mobile_menu_sidebar.is-open .mobile_menu_sidebar_panel,
    .mobile_catalog_sidebar.is-open .mobile_catalog_sidebar_panel {
        transform: translateX(0);
    }

    body.mobile-drawer-open {
        overflow: hidden;
    }

    .mobile_contacts_close,
    .mobile_menu_close,
    .mobile_catalog_close {
        position: absolute;
        right: 10px;
        top: 10px;
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 50%;
        background: #f0f3f9;
        color: #333;
        font-size: 24px;
        line-height: 1;
        padding: 0;
    }

    .mobile_contacts_header,
    .mobile_menu_header,
    .mobile_catalog_header {
        padding: 16px;
        font-size: 14px;
        font-weight: 800;
        letter-spacing: .6px;
        text-transform: uppercase;
        border-bottom: 1px solid #e4e8ef;
    }

    .mobile_contacts_content,
    .mobile_menu_content,
    .mobile_catalog_content {
        padding: 14px 16px 24px;
    }

    .mobile_catalog_content .catwrap {
        box-shadow: none;
        padding-top: 0;
        margin-top: 0;
    }

    .mobile_catalog_content .catwrap ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile_catalog_content .catwrap .menu > li {
        margin-bottom: 0;
        border-top: 1px solid #eef2f7;
    }

    .mobile_catalog_content .catwrap .menu > li:first-child {
        border-top: 0;
    }

    .mobile_catalog_content .catwrap .menu ul {
        display: block !important;
        position: static !important;
        width: auto !important;
        border: 0 !important;
        padding: 0 0 4px !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .mobile_catalog_content .catwrap .menu > li > div > a {
        display: block;
        padding: 11px 0;
        color: #33353b;
        font-size: 14px;
        font-weight: 600;
        text-transform: none;
        letter-spacing: 0;
        background: transparent !important;
        text-decoration: none;
    }

    .mobile_catalog_content .catwrap .menu li li a {
        display: block;
        padding: 8px 0 8px 12px;
        font-weight: 400;
        text-transform: none;
        letter-spacing: 0;
        line-height: 1.4;
        text-decoration: none;
    }

    .mobile_catalog_content .catwrap .menu li a:hover,
    .mobile_catalog_content .catwrap .menu li a:active {
        background: transparent;
        color: #d30000;
    }

    .mobile_catalog_content li.catparent_40:before,
    .mobile_catalog_content li.catparent_16:before {
        display: none;
    }

    .mobile_catalog_content .catwrap .menu li.catparent_40 > div > a {
        margin-top: 0;
        padding: 11px 0;
        color: #33353b !important;
        background: transparent !important;
    }

    .mobile_catalog_content .catwrap .menu li.catparent_40 > div > a:hover {
        color: #d30000 !important;
    }

    .mobile_menu_nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile_menu_nav li {
        border-top: 1px solid #eef2f7;
    }

    .mobile_menu_nav li:first-child {
        border-top: 0;
    }

    .mobile_menu_nav a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 11px 0;
        color: #33353b;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: color .2s ease;
    }

    .mobile_menu_nav .menu_item_icon {
        width: 18px;
        font-size: 16px;
        color: #99a4b5;
        text-align: center;
    }

    .mobile_menu_nav a:hover {
        color: #d30000;
    }

    .mobile_menu_nav a.red {
        color: #d30000;
    }

    .mobile_menu_nav a.red .menu_item_icon {
        color: #d30000;
    }

    .mobile_contacts_section_title {
        display: block;
        margin: 14px 0 10px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .8px;
        text-transform: uppercase;
        color: #99a4b5;
    }

    .mobile_contacts_content .mobile_contacts_section_title:first-child {
        margin-top: 4px;
    }

    .mobile_contacts_separator {
        height: 1px;
        margin: 14px 0;
        background: #e6ebf2;
    }

    .mobile_contacts_phones .phone {
        margin-bottom: 10px;
    }

    .mobile_contacts_phones .phone p {
        margin: 0;
    }

    .mobile_contacts_phones .phone p span {
        font-size: 20px;
    }

    .mobile_contacts_worktime p {
        margin: 0;
        color: #33353b;
        font-size: 13px;
        line-height: 1.5;
    }

    .mobile_contacts_actions {
        margin-top: 18px;
        display: grid;
        gap: 0;
        border-top: 1px solid #e6ebf2;
        border-bottom: 1px solid #e6ebf2;
    }

    .mobile_contacts_actions a {
        display: block;
        text-align: left;
        padding: 11px 0;
        border-radius: 0;
        color: #33353b;
        text-decoration: none;
        font-weight: 500;
        letter-spacing: 0;
        background: transparent;
        text-transform: none;
        font-size: 14px;
        border-top: 1px solid #eef2f7;
        transition: color .2s ease, background-color .2s ease;
    }

    .mobile_contacts_actions > div:first-child a {
        border-top: 0;
    }

    .mobile_contacts_actions a:hover {
        color: #d30000;
        background: #f7f9fc;
    }

    .mobile_contacts_social {
        margin-top: 18px;
        display: flex;
        gap: 10px;
    }

    .mobile_contacts_social a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }

    .mobile_contacts_social img {
        width: 26px;
        height: 26px;
    }

    .mobile_contacts_sidebar a,
    .mobile_menu_sidebar a,
    .mobile_catalog_sidebar a {
        text-decoration: none;
    }

    .mainarea {
        width: 100%;
        float: none;
    }

    #footer > .container {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 30px;
    }

    #footer .fcell {
        float: none;
        width: calc(50% - 15px);
        margin-bottom: 15px;
        box-sizing: border-box;
    }

    .iconcell p {
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 2px;
    }

    .iconcell span {
        font-size: 10px;
    }

    .customicon {
        margin: 36px -15px 0 -15px;
        padding: 0 32px;
        background-color: #D30000;
        justify-content: space-around;
    }

    .page-header h2, .browse-view h1, #phocaguestbook h1, h1 {
        font-size: 18px;
        letter-spacing: revert;
    }

    .product_heading {
        padding: 16px 0;
    }

    .vm-product-container .vm-product-media-container {
        float: none;
        width: auto;
    }
}

/* Mobile: 1 column */
@media (max-width: 575px) {
    .logo_mobile img {
        height: 28px;
    }

    .mobile_contacts_toggle,
    .mobile_menu_toggle,
    .mobile_catalog_toggle {
        padding: 2px 4px;
    }

    .mobile_contacts_toggle_icon,
    .mobile_menu_toggle_icon,
    .mobile_catalog_toggle_icon {
        font-size: 22px;
    }

    .mobile_contacts_phones .phone p span {
        font-size: 18px;
    }

    #footer .payments_images {
        gap: 8px 12px;
        padding-bottom: 20px;
        justify-content: center;
    }

    #footer .payments_images img {
        height: 24px;
    }

    footer {
        padding-top: 10px;
    }

    #footer > .container {
        gap: 0;
    }

    .iconcell img {
        width: 40px;
        height: 40px;
    }

    #footer .fcell {
        width: 100%;
        margin-bottom: 18px;
        padding-bottom: 18px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    #footer .fcell:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    #footer .fcell h3 {
        margin-bottom: 12px;
    }

    .footer_line {
        padding: 20px 0;
        text-align: center;
    }

    .footer_line span {
        font-size: 11px;
        line-height: 1.6;
    }
}

/* --- Cities / delivery block (.actii) --- */

@media (max-width: 767px) {
    .actii {
        padding: 20px 0;
        margin-top: 25px;
    }

    .actii .container > p {
        margin-bottom: 18px;
        font-size: 13px;
        line-height: 1.4;
    }

    .actii ul {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px 16px;
    }

    .vmproductnew {
        overflow: auto;
        margin-left: -15px !important;
        margin-right: -15px !important;
        padding: 0 15px !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .vmproductnew::-webkit-scrollbar {
        display: none;
    }

    .vmproductnew li {
        width: 180px;
        min-width: 180px;
    }

    .vmproductnew li img {
        height: auto;
        max-height: 200px;
    }

    .moduletablenew {
        margin-top: 20px;
    }
}

@media (max-width: 575px) {
    .actii ul {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px 12px;
    }

    .actii li {
        font-size: 13px;
    }

    .galsec {
        margin: 0 0 24px 0;
        width: 100%;
    }
}

/* --- VirtueMart catalog home (/katalog/) --- */

.featured-view,
.recent-view,
.latest-view,
.topten-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.categories_list a {
    display: block;
}

.featured-view .product,
.recent-view .product,
.latest-view .product,
.topten-view .product {
    width: auto !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
    min-width: 0;
}

.featured-view > h4,
.latest-view > h4,
.recent-view > h4,
.topten-view > h4 {
    grid-column: 1 / -1;
    margin: 0 0 4px;
}

@media (max-width: 991px) {
    .featured-view,
    .recent-view,
    .latest-view,
    .topten-view {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.browse-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.browse-view > .row {
    display: contents;
}

.browse-view > .horizontal-separator,
.browse-view .clear {
    display: none;
}

.browse-view > h3,
.browse-view > form,
.browse-view > .virtuemart_search,
.browse-view > .vm-pagination,
.browse-view > .orderby-displaynumber {
    grid-column: 1 / -1;
}

.browse-view .product.vm-col {
    width: auto !important;
    max-width: none !important;
    float: none !important;
    margin: 0 !important;
    min-width: 0;
    overflow: hidden;
}

.browse-view .product .spacer {
    position: relative;
    height: 100%;
}

.browse-view .vm-product-media-container {
    margin-bottom: 10px;
}

.browse-view .vm-product-media-container a.imglinko {
    display: block;
}

.browse-view .vm-product-descr-container-1 h2,
.browse-view .vm-product-descr-container-0 h2 {
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
}

.browse-view .vm-product-descr-container-1 h2 a,
.browse-view .vm-product-descr-container-0 h2 a {
    color: #22252b;
}

@media (max-width: 991px) {
    .filter_manufacturers, .custom_params {
        width: 50%;
    }

    .browse-view {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px;
    }

    .browse-view.vhod-cat .imglinko > img {
        height: auto !important;
        width: 100% !important;
        max-height: 200px;
        object-fit: contain;
    }

    .browse-view .vm-product-descr-container-1 h2,
    .browse-view .vm-product-descr-container-0 h2 {
        font-size: 13px;
    }

    .browse-view .spacer .product-price {
        margin: 8px 0;
        font-size: 13px;
    }
}

@media (max-width: 575px) {
    .browse-view.vhod-cat .imglinko > img {
        max-height: 160px;
    }

    .pod_zak {
        top: 30px;
        right: 0;
        left: initial;
    }
}

/* VirtueMart Facebox — center in viewport (JS top/left is unreliable after image load) */
#facebox {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    max-height: 95vh;
    overflow: auto;
    box-sizing: border-box;
}

#facebox .popup {
    max-width: 90vw;
}

#facebox .content {
    max-width: 90vw;
    box-sizing: border-box;
}

#facebox img {
    display: block;
    max-width: 80vw;
    max-height: 80vh;
    width: auto !important;
    height: auto !important;
}

#facebox > span {
    display: block;
    margin: 8px 0 0;
    position: static;
    text-align: center;
}
