/* Mozzo Scroll Menu - frontend styles */

/* ── Sticky header ──────────────────────────────────────────── */
/* Menu layout replaces the loop: its tools row (count/sorting) is empty, so drop its spacing. */
body.mozzo-sm-menu-layout .archive-loop-tools .row {
    display: none;
}

.mozzo-sm-sticky {
    background: #fff;
    padding: 0.25rem 0;
    z-index: 100;
    /* position: sticky and top come from Bootstrap's sticky-top class.
       The theme's .logged-in.admin-bar .sticky-top rule handles admin-bar offset. */
}

.mozzo-sm-jump-select,
.mozzo-sm-search-wrap {
    max-width: 600px;
    margin: 0 auto;
}

/* ── Search wrap & clear button ─────────────────────────────── */
.mozzo-sm-search-wrap {
    position: relative;
}

/* No jump dropdown above it (single-category pages): no extra top gap. */
.mozzo-sm-sticky > .mozzo-sm-search-wrap:first-child {
    margin-top: 0 !important;
}

.mozzo-sm-search-wrap .mozzo-sm-search-input {
    padding-right: 2.5rem;
}

/* Hide the browser's native clear (x); the custom button replaces it. */
.mozzo-sm-search-input::-webkit-search-cancel-button,
.mozzo-sm-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.mozzo-sm-search-clear {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    font-size: 1.25rem;
    color: #999;
    cursor: pointer;
}

.mozzo-sm-search-clear:hover {
    color: #333;
}

/* ── Category sections ──────────────────────────────────────── */
.mozzo-sm-section {
    margin-top: 0.75rem;
    margin-bottom: 2rem;
    /* scroll-margin-top is set dynamically by JS to match sticky header height */
}

.mozzo-sm-section-title {
    position: sticky;
    top: 0; /* overridden by JS to match sticky header height */
    z-index: 10;
    background: #fff;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* ── Product item — horizontal layout ───────────────────────── */
.mozzo-sm-product-item {
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    height: 100%; /* fills column so items in the same row share equal height */
    cursor: pointer;
}

.mozzo-sm-product-thumb {
    flex-shrink: 0;
    display: block;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: 0.375rem;
    /* reset <button> defaults */
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* Images are backgrounds: cover the wrapper's box and inherit its rounded corners. */
.mozzo-sm-bg {
    display: block;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    border-radius: inherit;
    transition: opacity .25s ease;
}

/* Text renders immediately; the thumbnail shimmers until its image has loaded, then fades in. */
.mozzo-sm-product-thumb.is-loading,
.mozzo-sm-modal-main-img.is-loading,
.mozzo-sm-thumb-btn.is-loading {
    background: linear-gradient(90deg, #eceff1 25%, #f6f7f8 50%, #eceff1 75%);
    background-size: 200% 100%;
    animation: mozzo-sm-shimmer 1.2s ease-in-out infinite;
}

.mozzo-sm-product-thumb.is-loading .mozzo-sm-bg,
.mozzo-sm-modal-main-img.is-loading .mozzo-sm-bg,
.mozzo-sm-thumb-btn.is-loading .mozzo-sm-bg { opacity: 0; }

@keyframes mozzo-sm-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mozzo-sm-product-thumb.is-loading,
    .mozzo-sm-modal-main-img.is-loading,
    .mozzo-sm-thumb-btn.is-loading { animation: none; }
    .mozzo-sm-bg { transition: none; }
}

.mozzo-sm-product-info {
    flex: 1 1 0;
    min-width: 0; /* prevent text overflow breaking layout */
}

.mozzo-sm-product-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.mozzo-sm-product-name a {
    color: inherit;
    text-decoration: none;
}

.mozzo-sm-product-name a:hover {
    color: var(--bs-primary);
}

.mozzo-sm-product-desc {
    margin: 0 0 0.2rem;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mozzo-sm-product-price {
    font-size: 0.9rem;
}

/* ── Add-to-cart "+" circle button ──────────────────────────── */
.mozzo-sm-add-to-cart {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background-color: var(--bs-primary, #0d6efd);
    color: #fff !important;
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.mozzo-sm-add-to-cart:hover,
.mozzo-sm-add-to-cart:focus {
    opacity: 0.85;
    color: #fff !important;
}

/* ── Product modal ──────────────────────────────────────────── */
.mozzo-sm-product-modal .modal-content {
    overflow: hidden; /* keeps inner content inside rounded corners */
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    max-height: 90dvh;
}

/* Nothing scrolls except the description: header, title, image, price and footer stay put. */
.mozzo-sm-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mozzo-sm-modal-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.mozzo-sm-modal-inner > .row {
    flex: 1 1 auto;
    min-height: 0;
    flex-wrap: nowrap;
}

.mozzo-sm-modal-images { flex-shrink: 0; }

.mozzo-sm-modal-close {
    z-index: 2;
}

/* Header: pager | section title | close. Side cells share a width so the title stays centred. */
.mozzo-sm-modal-header {
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

/* Same fixed width on both sides (fits "999/999") so the title/dropdown between them stays centred. */
.mozzo-sm-modal-counter,
.mozzo-sm-modal-close {
    flex: 0 0 4.5rem;
    width: 4.5rem;
    min-width: 0;
}

.mozzo-sm-modal-counter {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Beat Bootstrap's .modal-header .btn-close (auto left margin, negative right margin), which pushed the
   centre column off-centre; border-box keeps its padding inside the shared 4.5rem cell. */
.modal-header.mozzo-sm-modal-header .mozzo-sm-modal-close {
    margin: 0;
    box-sizing: border-box;
}

.mozzo-sm-modal-close {
    margin: 0;
    background-position: right center; /* 'X' hugs the right edge of its 3rem cell */
}

.mozzo-sm-modal-section {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

.mozzo-sm-modal-section-select {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: 22rem;
    margin: 0 auto;
    font-weight: 600;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
}

.mozzo-sm-modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
}

.mozzo-sm-modal-inner {
    /* inner wrapper returned by AJAX */
}


.mozzo-sm-modal-images {
    padding: 1.5rem 1rem 1rem 1.5rem;
}

.mozzo-sm-modal-main-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    /* On short viewports the image is cropped (object-fit: cover) rather than overflowing. */
    max-height: max(10rem, calc(90vh - 19rem));
    max-height: max(10rem, calc(90dvh - 19rem));
    overflow: hidden;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
}

.mozzo-sm-modal-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mozzo-sm-thumb-btn {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border: 2px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    padding: 0;
    background: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.mozzo-sm-thumb-btn:hover,
.mozzo-sm-thumb-btn.is-active {
    border-color: var(--bs-primary, #0d6efd);
}

.mozzo-sm-modal-details {
    padding: 1.5rem 1.5rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Full-width bar above the image + details columns: title left, price right. It sits outside
   the scrolling area, so it stays put. */
.mozzo-sm-modal-head {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.mozzo-sm-modal-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
}

.mozzo-sm-modal-price {
    flex: 0 0 auto;
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
}

.mozzo-sm-modal-desc-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 4rem;
    display: flex;
    flex-direction: column;
}

/* Fade hint that more text is below; hidden once the end is reached. */
.mozzo-sm-modal-desc-wrap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.5rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--bs-modal-bg, #fff));
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
}

.mozzo-sm-modal-desc-wrap.has-more::after { opacity: 1; }

.mozzo-sm-modal-short-desc {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.mozzo-sm-modal-short-desc > :last-child { margin-bottom: 0; }
.mozzo-sm-modal-short-desc ul,
.mozzo-sm-modal-short-desc ol { padding-left: 1.25rem; }

.mozzo-sm-modal-cart {
    margin-top: auto;
}

/* Quantity + add to cart stay pinned below the scrolling body. */
.mozzo-sm-modal-footer {
    justify-content: center;
}

.mozzo-sm-modal-footer .mozzo-sm-modal-cart {
    margin: 0;
    width: 100%;
}

/* Keep WC quantity input and button in a tidy row */
.mozzo-sm-modal-cart .quantity {
    display: inline-block;
    margin: 0;
}

.mozzo-sm-modal-cart .single_add_to_cart_button {
    vertical-align: middle;
}

@media (max-width: 767.98px) {
    .mozzo-sm-modal-images {
        padding: 1.5rem 1.5rem 0.5rem;
    }

    .mozzo-sm-modal-main-img {
        aspect-ratio: 4 / 3;
    }

    .mozzo-sm-modal-details {
        padding: 1rem 1.5rem 1.5rem;
    }

    /* Stacked: the title/price bar and footer stay put; image and details scroll together
       inside the row (the image is no longer sticky). */
    .mozzo-sm-modal-inner > .row {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* Higher specificity: beats Bootstrap's .row > * and .col-12 flex rules. */
    .mozzo-sm-modal-inner > .row > .mozzo-sm-modal-details,
    .mozzo-sm-modal-inner > .row > .mozzo-sm-modal-images {
        flex: 0 0 auto;
    }

    .mozzo-sm-modal-details { min-height: auto; }

    /* The description no longer scrolls on its own, so no fade hint. */
    .mozzo-sm-modal-desc-wrap { flex: 0 0 auto; }
    .mozzo-sm-modal-short-desc { overflow: visible; flex: 0 0 auto; }
    .mozzo-sm-modal-desc-wrap::after { display: none; }

    .mozzo-sm-modal-main-img {
        aspect-ratio: 16 / 9;
    }
}

/* Prev/next chevrons, vertically centred on the dialog's left and right edges. */
.mozzo-sm-product-modal .modal-dialog {
    position: relative;
}

.mozzo-sm-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    pointer-events: auto; /* .modal-dialog is pointer-events:none; only .modal-content re-enables it */
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #212529;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.mozzo-sm-modal-nav:hover,
.mozzo-sm-modal-nav:focus-visible {
    background: #fff;
}

.mozzo-sm-modal-prev { left: 0; transform: translate(-50%, -50%); }
.mozzo-sm-modal-next { right: 0; transform: translate(50%, -50%); }

/* Narrow viewports: widen the dialog's side margins so the half-outside buttons stay on screen. */
@media (max-width: 575.98px) {
    .mozzo-sm-product-modal .modal-dialog {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }
}


.mozzo-sm-modal--single .mozzo-sm-modal-nav {
    display: none;
}

/* ── Customizer sortable list ───────────────────────────────── */
.mozzo-sm-sortable {
    margin: 0;
}

.mozzo-sm-sortable .mozzo-sm-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
}

.mozzo-sm-sortable .mozzo-sm-handle {
    cursor: move;
    margin-right: 8px;
    color: #999;
}

.mozzo-sm-sortable .mozzo-sm-item label {
    margin: 0;
    cursor: pointer;
}

/* Shop page: sidebar hidden via Customizer → content column spans the full width */
body.mozzo-sm-shop-full-width .site-main > .row > .col-lg-9 {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
}

/* Menu cards without the toolbar (related products): section title scrolls with the page. */
.mozzo-sm-wrapper--plain .mozzo-sm-section {
    margin-top: 0;
}

.mozzo-sm-wrapper--plain .mozzo-sm-section-title {
    position: static;
}

/* Filtered results: breathing room between the filter input and the first card. */
.mozzo-sm-search-results {
    padding-top: 1.25rem;
}

/* Modal text skeleton: shown in the details column until the description arrives. */
.mozzo-sm-skeleton { display: flex; flex-direction: column; gap: .6rem; padding-top: .25rem; }
.mozzo-sm-skeleton span {
    display: block;
    height: .85rem;
    border-radius: .25rem;
    background: linear-gradient(90deg, #eceff1 25%, #f6f7f8 50%, #eceff1 75%);
    background-size: 200% 100%;
    animation: mozzo-sm-shimmer 1.2s ease-in-out infinite;
}
.mozzo-sm-skeleton span.is-short { width: 60%; }
@media (prefers-reduced-motion: reduce) {
    .mozzo-sm-skeleton span { animation: none; }
}
