/**
 * Global responsive utilities — MultiEcom
 * Preserves branding; fixes overflow, touch targets, and mobile layouts.
 */

/* Prevent horizontal scroll sitewide */
html {
    overflow-x: clip;
}

body {
    overflow-x: clip;
}

img,
video {
    max-width: 100%;
    height: auto;
}

/* Responsive images in content */
.img-fluid-cover {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.img-thumb-sm {
    width: 88px;
    height: 88px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

/* Multi custom-upload collage (cart / checkout) */
.custom-images-collage-btn {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    line-height: 0;
}
.custom-images-collage {
    display: grid;
    grid-template-columns: repeat(var(--collage-cols, 2), 1fr);
    gap: 2px;
    background: #ddd;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.custom-images-collage--sm {
    width: 64px;
    height: 64px;
}
.custom-images-collage-btn.custom-images-collage--sm .custom-images-collage,
.custom-images-collage-btn .custom-images-collage--sm {
    width: 64px;
    height: 64px;
}
.custom-images-collage--md,
.custom-images-collage-btn.custom-images-collage--md .custom-images-collage,
.img-thumb-sm.custom-images-collage,
.custom-images-collage.img-thumb-sm {
    width: 88px;
    height: 88px;
}
.custom-images-collage__cell {
    display: block;
    overflow: hidden;
    background: #111;
    min-width: 0;
    min-height: 0;
    position: relative;
}
.custom-images-collage__cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #111;
}
.custom-images-collage--shape-circle .custom-images-collage__cell {
    border-radius: 50%;
}
.custom-images-collage--shape-heart .custom-images-collage__cell {
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
}

/* Custom product border color on cart / checkout / order thumbs */
.custom-images-collage.has-custom-border {
    --frame-border-width: 5px;
    background: #fff;
    border-color: transparent;
}
.custom-images-collage--sm.has-custom-border {
    --frame-border-width: 4px;
}
.custom-images-collage--md.has-custom-border {
    --frame-border-width: 6px;
}
.custom-images-collage--lg.has-custom-border {
    --frame-border-width: 12px;
}
.custom-images-collage.has-custom-border .custom-images-collage__cell::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 0 var(--frame-border-width, 6px) var(--frame-border-color, #111);
    z-index: 1;
}
.custom-images-collage.has-custom-border[data-border-slug="white"] .custom-images-collage__cell::after {
    box-shadow:
        inset 0 0 0 var(--frame-border-width, 6px) #ffffff,
        inset 0 0 0 calc(var(--frame-border-width, 6px) + 1px) rgba(0, 0, 0, 0.28);
}

/* Zoom / large collage: keep natural crop, do not force square cover */
.custom-images-collage--lg {
    width: min(92vw, 520px);
    height: auto;
    aspect-ratio: auto;
    max-height: 78vh;
    overflow: auto;
    gap: 6px;
    border-radius: 12px;
    background: #111;
}
.custom-images-collage--lg .custom-images-collage__cell {
    background: #1a1a1a;
    min-height: 0;
    aspect-ratio: auto;
}
.custom-images-collage--lg .custom-images-collage__cell img {
    width: 100%;
    height: auto;
    max-height: min(42vh, 360px);
    object-fit: contain;
}

.custom-upload-framed {
    display: inline-block;
    position: relative;
    line-height: 0;
    --frame-border-width: 8px;
    --frame-border-color: #111;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
}
.custom-upload-framed img {
    display: block;
    max-width: 160px;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
}
.custom-upload-framed::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 var(--frame-border-width) var(--frame-border-color);
    z-index: 1;
}
.custom-upload-framed[data-border-slug="white"]::after {
    box-shadow:
        inset 0 0 0 var(--frame-border-width) #ffffff,
        inset 0 0 0 calc(var(--frame-border-width) + 1px) rgba(0, 0, 0, 0.28);
}

.checkout-lightbox__img.has-custom-border {
    box-shadow: inset 0 0 0 14px var(--frame-border-color, #111);
}
.checkout-lightbox__img.has-custom-border[data-border-slug="white"] {
    box-shadow:
        inset 0 0 0 14px #ffffff,
        inset 0 0 0 15px rgba(0, 0, 0, 0.28);
}

@media (min-width: 768px) {
    .img-thumb-sm {
        width: 104px;
        height: 104px;
    }
    .custom-images-collage--md,
    .custom-images-collage-btn.custom-images-collage--md .custom-images-collage,
    .img-thumb-sm.custom-images-collage,
    .custom-images-collage.img-thumb-sm {
        width: 104px;
        height: 104px;
    }
}

.checkout-item-thumb {
    width: 88px;
    height: 88px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
}

@media (min-width: 768px) {
    .checkout-item-thumb {
        width: 110px;
        height: 110px;
    }
}

/* Touch-friendly buttons */
.btn,
.form-control,
.form-select,
.nav-link,
.page-link {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

/* Forms — full width on mobile */
@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px; /* prevents iOS zoom */
    }

    .btn-lg {
        width: 100%;
    }

    .stack-buttons-sm .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .stack-buttons-sm .btn:last-child {
        margin-bottom: 0;
    }
}

/* Typography scaling */
@media (max-width: 575.98px) {
    h1, .h1 { font-size: clamp(1.35rem, 5vw, 1.75rem); }
    h2, .h2 { font-size: clamp(1.2rem, 4.5vw, 1.5rem); }
    h3, .h3 { font-size: clamp(1.05rem, 4vw, 1.25rem); }
}

/* Account / cart page containers */
.store-page {
    max-width: 1140px;
    margin: 0 auto;
}

.store-page .container-fluid {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
}

.min-width-0 {
    min-width: 0;
}

/* Mobile order/cart cards (hide table on xs) */
.mobile-data-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
}

.mobile-data-card__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.mobile-data-card__row:last-child {
    margin-bottom: 0;
}

.mobile-data-card__label {
    color: #6c757d;
    flex-shrink: 0;
}

/* Panel layouts (admin / vendor) */
.panel-topbar {
    background: #343a40;
    color: #fff;
    padding: 0.65rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.panel-topbar--vendor {
    background: #1e3a5f;
}

.panel-topbar .btn-menu {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.35rem 0.55rem;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
}

.panel-topbar .btn-menu:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.offcanvas-panel {
    background: #343a40;
    color: #fff;
}

.offcanvas-panel--vendor {
    background: #1e3a5f;
}

.offcanvas-panel .nav-link {
    color: #adb5bd;
    padding: 0.75rem 1rem;
    min-height: 44px;
}

.offcanvas-panel--vendor .nav-link {
    color: #b8c9de;
}

.offcanvas-panel .nav-link:hover,
.offcanvas-panel .nav-link.active {
    color: #fff;
    background: #495057;
}

.offcanvas-panel--vendor .nav-link:hover,
.offcanvas-panel--vendor .nav-link.active {
    background: #2d5a87;
}

.offcanvas-panel .btn-close {
    filter: invert(1);
}

.panel-sidebar {
    min-height: 100vh;
}

.panel-main {
    padding: 1rem;
    min-width: 0;
}

@media (min-width: 768px) {
    .panel-main {
        padding: 1.5rem 2rem;
    }
}

/* Tables — ensure wrapper doesn't break layout */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-desktop-only {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .cards-mobile-only {
        display: none !important;
    }
}

/* Account nav pills on user pages */
.account-nav-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding-bottom: 0.25rem;
    margin-bottom: 1rem;
}

.account-nav-mobile .nav-link {
    white-space: nowrap;
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    color: #333;
    font-size: 0.85rem;
}

.account-nav-mobile .nav-link.active {
    background: #212529;
    color: #fff;
    border-color: #212529;
}

/* Product page column stacking */
@media (max-width: 991.98px) {
    .omgs-page .row.g-4,
    .product-page .row.g-4 {
        --bs-gutter-y: 1.25rem;
    }
}

/* Lazy loading hint */
img[loading="lazy"] {
    background: #f5f5f5;
}

/* ---------- Sitewide button press feel ---------- */
button:not(:disabled),
.btn:not(:disabled),
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
input[type="reset"]:not(:disabled),
[role="button"],
.btn-change-photo,
.btn-crop-photo,
.shape-tool,
.size-pill,
.thick-pill,
.bw-product-card__btn,
.shop-product-card__btn,
.home-product-card__btn,
.related-product-card__btn,
.custom-editor__thumb-select,
.custom-editor__thumb,
.product-sticky-cta__cart,
.product-sticky-cta__buy,
.store-whatsapp-fab,
.checkout-help-fab,
.btn-store-cart,
.btn-store-buy,
.color-swatch {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}

button:not(:disabled):active,
.btn:not(:disabled):active,
input[type="submit"]:not(:disabled):active,
input[type="button"]:not(:disabled):active,
input[type="reset"]:not(:disabled):active,
[role="button"]:active,
.btn-change-photo:active,
.btn-crop-photo:active,
.shape-tool:active,
.size-pill:active,
.thick-pill:active,
.bw-product-card__btn:active,
.shop-product-card__btn:active,
.home-product-card__btn:active,
.related-product-card__btn:active,
.custom-editor__thumb-select:active,
.custom-editor__thumb:active,
.product-sticky-cta__cart:active,
.product-sticky-cta__buy:active,
.store-whatsapp-fab:active,
.checkout-help-fab:active,
.btn-store-cart:active,
.btn-store-buy:active,
.color-swatch:active,
button:not(:disabled).is-pressing,
.btn:not(:disabled).is-pressing,
input[type="submit"]:not(:disabled).is-pressing,
input[type="button"]:not(:disabled).is-pressing,
[role="button"].is-pressing,
.btn-change-photo.is-pressing,
.btn-crop-photo.is-pressing,
.shape-tool.is-pressing,
.size-pill.is-pressing,
.thick-pill.is-pressing,
.bw-product-card__btn.is-pressing,
.shop-product-card__btn.is-pressing,
.home-product-card__btn.is-pressing,
.related-product-card__btn.is-pressing,
.custom-editor__thumb-select.is-pressing,
.custom-editor__thumb.is-pressing,
.product-sticky-cta__cart.is-pressing,
.product-sticky-cta__buy.is-pressing,
.store-whatsapp-fab.is-pressing,
.checkout-help-fab.is-pressing,
.btn-store-cart.is-pressing,
.btn-store-buy.is-pressing,
.color-swatch.is-pressing {
    transform: scale(0.96);
    filter: brightness(0.93);
}

@media (prefers-reduced-motion: reduce) {
    button:not(:disabled),
    .btn:not(:disabled),
    .btn-change-photo,
    .bw-product-card__btn,
    .shop-product-card__btn,
    .size-pill,
    .thick-pill {
        transition: none;
    }

    button:not(:disabled):active,
    .btn:not(:disabled):active,
    button:not(:disabled).is-pressing,
    .btn:not(:disabled).is-pressing,
    .is-pressing {
        transform: none;
        filter: brightness(0.9);
        opacity: 0.88;
    }
}
