#module-ajaxcatalogfun-catalog .container,
#module-ajaxcatalogfun-catalog #wrapper .container,
#module-ajaxcatalogfun-catalog #main .container {
    width: 100% !important;
    max-width: 100% !important;
}

#module-ajaxcatalogfun-catalog #content-wrapper,
#module-ajaxcatalogfun-catalog .page-content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
}

.ajax-catalog-fun {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.catalog-header {
    margin-bottom: 24px;
}

.catalog-header h1 {
    margin: 0 0 8px;
}

.catalog-header p {
    margin: 0;
    color: #606c76;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.catalog-categories {
    background: #f7f9fc;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e4e8ef;
}

.catalog-categories h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.category-list {
    display: grid;
    gap: 10px;
}

.category-btn {
    text-align: left;
    border: 1px solid #d5deea;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
    display: grid;
    gap: 6px;
}

.category-thumb-wrap {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f6fb;
    border-radius: 8px;
    overflow: hidden;
}

.category-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.category-btn.active {
    border-color: #1a5fb4;
    box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.15);
}

.category-name {
    font-weight: 600;
}

.category-description {
    font-size: 12px;
    color: #64748b;
}

.catalog-products {
    background: #fff;
    border: 1px solid #e4e8ef;
    border-radius: 12px;
    padding: 16px;
}

.catalog-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.catalog-search-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.catalog-search-input {
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    border: 1px solid #d5deea;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    background: #f8fafc;
    color: #1e293b;
}

.catalog-search-input:focus {
    outline: none;
    border-color: #1a5fb4;
    box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.12);
    background: #fff;
}

.catalog-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-width: 480px;
    margin-top: 6px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e4e8ef;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    z-index: 30;
}

.catalog-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #f1f4f8;
    background: #fff;
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    box-sizing: border-box;
}

.catalog-search-item:last-child {
    border-bottom: 0;
}

.catalog-search-item:hover,
.catalog-search-item:focus-visible {
    background: #f0f6ff;
    outline: none;
}

.catalog-search-item-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f3f6fb;
    flex-shrink: 0;
}

.catalog-search-item-body {
    flex: 1;
    min-width: 0;
}

.catalog-search-item-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-search-item-price {
    font-size: 13px;
    color: #1a5fb4;
    font-weight: 600;
}

.catalog-search-empty,
.catalog-search-loading {
    padding: 10px 12px;
    font-size: 13px;
    color: #64748b;
}

.catalog-search-error {
    padding: 10px 12px;
    font-size: 13px;
    color: #b91c1c;
}

.products-header h2 {
    margin: 0 0 12px;
}

.products-loading {
    padding: 12px 0;
    color: #64748b;
}

.products-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.catalog-filter-btn {
    border: 1px solid #d5deea;
    background: #fff;
    color: #223046;
    border-radius: 18px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}

.catalog-filter-btn.active {
    background: #1a5fb4;
    border-color: #1a5fb4;
    color: #fff;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(var(--products-per-line, 3), minmax(0, 1fr));
    gap: 14px;
}

.product-card {
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
}

/* Hover seulement souris (évite effet "collant" au doigt) */
@media (hover: hover) and (pointer: fine) {
    .product-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
    }
}

.product-image {
    height: 190px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8fafc;
    position: relative;
    cursor: zoom-in;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.product-name {
    margin: 0;
    font-size: 15px;
}

.product-description {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.variant-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.variant-btn {
    border: 1px solid #d5deea;
    background: #fff;
    border-radius: 16px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
}

.variant-btn.selected {
    background: #1a5fb4;
    border-color: #1a5fb4;
    color: #fff;
}

/* Modal : libellé + pastilles couleur (données PrestaShop attribute.color) */
.modal-product-variants {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-variants-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

.product-modal .variant-btn--swatch {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    padding: 0;
    border: 2px solid #c5ced9;
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
    color: inherit;
}

.product-modal .variant-btn--swatch .variant-swatch-fill {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.product-modal .variant-btn--swatch:hover {
    border-color: #1a5fb4;
}

.product-modal .variant-btn--swatch.selected {
    background: #fff;
    border-color: #1a5fb4;
    box-shadow: 0 0 0 2px rgba(26, 95, 180, 0.4);
    color: inherit;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px 10px;
    flex-wrap: wrap;
}

.price-prior-wrap,
.modal-price-prior-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.price-original {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    color: #8a94a6;
    font-size: 13px;
}

.price-discount {
    background: #c01c28;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.price-final {
    font-weight: 700;
    color: #1a5fb4;
}

.product-link {
    display: inline-flex;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: #1a5fb4;
    color: #fff;
    text-decoration: none !important;
    text-align: center;
    border: none;
    cursor: pointer;
}

/* Libellé bouton = une version desktop + une version étroit (géré en CSS) */
.product-link-label--mobile {
    display: none;
}

#ajax-catalog-fun .product-body {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

#ajax-catalog-fun .product-card .product-info {
    flex: 1 1 auto;
    min-width: 0;
}

#ajax-catalog-fun .product-thumb-img {
    max-width: 100%;
    height: auto;
}

.products-empty {
    color: #64748b;
}

body.modal-open {
    overflow: hidden !important;
}

.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99990;
}

.product-modal.open {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 920px;
    max-height: 90vh;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    display: flex;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 2;
}

.modal-image-wrapper {
    width: 380px;
    min-width: 380px;
    background: #f0f3f7;
    padding: 24px;
}

.modal-product-image {
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-info-wrapper {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-product-name {
    margin: 0;
    font-size: 24px;
}

.modal-product-description {
    margin: 0;
    color: #666;
}

.modal-product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-price-original {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    color: #999;
}

.modal-price-discount {
    background: #c01c28;
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
}

.modal-price-final {
    font-size: 30px;
    font-weight: 700;
    color: #1a5fb4;
}

.modal-product-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector {
    display: flex;
    border: 1px solid #d5deea;
    border-radius: 8px;
    overflow: hidden;
}

.qty-btn {
    width: 38px;
    border: none;
    background: #f3f6fb;
    cursor: pointer;
}

.qty-input {
    width: 60px;
    border: none;
    text-align: center;
}

.modal-view-product-btn {
    display: inline-flex;
    justify-content: center;
    border-radius: 10px;
    background: #eef3fb;
    color: #1a5fb4;
    text-decoration: none !important;
    padding: 12px 16px;
    border: 1px solid #d5deea;
}

.modal-add-cart-btn {
    margin-top: auto;
    display: inline-flex;
    justify-content: center;
    border-radius: 10px;
    background: #1a5fb4;
    color: #fff;
    padding: 12px 16px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 900px) {
    .catalog-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Colonne = bandeau catégories scrollable */
    .catalog-categories {
        padding: 8px 10px;
    }

    .catalog-categories h2 {
        font-size: 14px;
        margin: 0 0 6px;
    }

    .category-list {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        padding: 0 0 4px;
        margin: 0;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        overscroll-behavior-x: contain;
    }

    .category-list::after {
        content: "";
        flex: 0 0 2px;
    }

    .category-btn {
        flex: 0 0 36%;
        min-width: 120px;
        max-width: 150px;
        min-height: 44px;
        box-sizing: border-box;
        scroll-snap-align: start;
        text-align: center;
        padding: 8px 6px;
    }

    .category-thumb-wrap {
        height: 56px;
    }

    .category-description {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .category-name {
        font-size: 12px;
        line-height: 1.25;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal-content {
        flex-direction: column;
        max-height: 95vh;
    }

    .modal-image-wrapper {
        width: 100%;
        min-width: 100%;
        padding: 16px;
    }

    .modal-product-image {
        height: 220px;
    }

    /* Titre + filtres restent visibles au scroll (mobile / tablette) */
    .products-sticky {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #fff;
        margin: -2px 0 8px;
        padding: 4px 0 8px;
        border-bottom: 1px solid #eef0f4;
    }

    .products-header h2 {
        font-size: 16px;
        margin: 0 0 6px;
    }

    .products-filters {
        margin-bottom: 0;
    }
}

/* Téléphone : vise 2 fiches / ligne, marges serrées, intro masquée */
@media (max-width: 640px) {
    .category-btn,
    .product-link,
    .catalog-filter-btn,
    .modal-close,
    .modal-add-cart-btn,
    .variant-btn,
    .qty-btn {
        touch-action: manipulation;
    }
}

/* Mise en forme mobile : voir views/css/catalog-mobile.css + classe body.ajaxcf-catalog-mobile */
