/*
 * Hydroplante Catalog 4.0
 * Scoped under .hp-catalog. No !important needed.
 */

/* ---------------------------------------------------------------
   Container & tokens
--------------------------------------------------------------- */
.hp-catalog {
    --hp-color-primary:   var(--e-global-color-primary,   #2787C9);
    --hp-color-text:      var(--e-global-color-text,      #1F2626);
    --hp-color-secondary: var(--e-global-color-secondary, #767676);
    --hp-color-muted:     #b8c5d0;
    --hp-color-border:    #d6e6f0;
    --hp-color-border-soft: #e3e8ec;
    --hp-color-bg-soft:   #f5f9fc;
    --hp-color-white:     #ffffff;
    --hp-radius:          8px;

    font-family: "Raleway", sans-serif;
    color: var(--hp-color-text);
    width: 100%;
    box-sizing: border-box;
}

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

.hp-catalog__empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--hp-color-secondary);
    font-size: 1rem;
}

/* ---------------------------------------------------------------
   Results bar (filters btn / count / orderby)
--------------------------------------------------------------- */
.hp-catalog .hpf-results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 0 0 18px;
    margin: 0 0 4px;
    width: 100%;
    flex-wrap: wrap;
}

.hp-catalog .hpf-result-count {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--hp-color-text);
    line-height: 1.3;
}

.hp-catalog .hpf-results-bar__filters-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--hp-color-border);
    border-radius: 999px;
    cursor: pointer;
    font: 600 0.95rem/1.2 "Raleway", sans-serif;
    color: var(--hp-color-text);
    transition: background 0.15s, border-color 0.15s;
}
.hp-catalog .hpf-results-bar__filters-btn:hover,
.hp-catalog .hpf-results-bar__filters-btn:focus {
    background: var(--hp-color-bg-soft);
    border-color: var(--hp-color-primary);
    outline: none;
}
.hp-catalog .hpf-results-bar__filters-btn svg {
    flex-shrink: 0;
    color: var(--hp-color-primary);
}
.hp-catalog .hpf-results-bar__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    background: var(--hp-color-primary);
    color: var(--hp-color-white);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
.hp-catalog .hpf-results-bar__badge[hidden] { display: none; }

/* ---------------------------------------------------------------
   Orderby dropdown
--------------------------------------------------------------- */
.hp-catalog .hpf-orderby { position: relative; display: inline-block; }

.hp-catalog .hpf-orderby__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font: 600 0.95rem/1.3 "Raleway", sans-serif;
    color: var(--hp-color-text);
    transition: background 0.15s, border-color 0.15s;
}
.hp-catalog .hpf-orderby__trigger:hover,
.hp-catalog .hpf-orderby__trigger:focus,
.hp-catalog .hpf-orderby[aria-expanded="true"] .hpf-orderby__trigger {
    background: var(--hp-color-bg-soft);
    border-color: var(--hp-color-border);
    outline: none;
}
.hp-catalog .hpf-orderby__caret {
    width: 14px; height: 14px;
    flex-shrink: 0;
    color: var(--hp-color-secondary);
    transition: transform 0.2s;
}
.hp-catalog .hpf-orderby[aria-expanded="true"] .hpf-orderby__caret { transform: rotate(180deg); }
.hp-catalog .hpf-orderby__current { white-space: nowrap; }

.hp-catalog .hpf-orderby__panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 180px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: var(--hp-color-white);
    border: 1px solid var(--hp-color-border);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(31, 38, 38, 0.10);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0s linear 0.15s;
}
.hp-catalog .hpf-orderby[aria-expanded="true"] .hpf-orderby__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s, transform 0.15s;
}
.hp-catalog .hpf-orderby__option {
    display: block;
    padding: 9px 16px;
    font: 500 0.92rem/1.3 "Raleway", sans-serif;
    color: var(--hp-color-text);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.hp-catalog .hpf-orderby__option:hover {
    background: var(--hp-color-bg-soft);
    color: var(--hp-color-primary);
}
.hp-catalog .hpf-orderby__option--active {
    color: var(--hp-color-primary);
    font-weight: 700;
}
.hp-catalog .hpf-orderby .orderby { display: none; }

/* ---------------------------------------------------------------
   Grid
--------------------------------------------------------------- */
.hp-catalog__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

/* ---------------------------------------------------------------
   Card
--------------------------------------------------------------- */
.hp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--hp-color-bg-soft);
    border: 1px solid var(--hp-color-border);
    border-radius: var(--hp-radius);
    overflow: visible;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.hp-card:hover {
    box-shadow: 0 4px 20px rgba(39, 135, 201, 0.13);
    border-color: #b3d4ed;
}
.hp-card--new { border-color: var(--hp-color-primary); }

/* Badge */
.hp-card__badge {
    position: absolute;
    top: -13px;
    left: 18px;
    z-index: 5;
    background: var(--hp-color-primary);
    color: var(--hp-color-white);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 7px 14px;
    border-radius: 4px;
    line-height: 1;
}

/* Media */
.hp-card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--hp-color-bg-soft);
    overflow: hidden;
    text-decoration: none;
    border-radius: calc(var(--hp-radius) - 1px) calc(var(--hp-radius) - 1px) 0 0;
}
.hp-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 32px 56px 80px;
    transition: transform 0.3s;
}
.hp-card:hover .hp-card__image { transform: scale(1.04); }

/* Les feuilles globales `.elementor img` et `.woocommerce img` imposent
   `height: auto; max-width: 100%` avec une specificite (0,1,1) superieure a
   `.hp-card__image` (0,1,0) : l'image reprenait ses proportions naturelles,
   depassait du cadre carre et son bas etait rogne (29 cartes sur 30 en mobile,
   19 sur 30 au bureau, mesure du 2026-09-24). Specificite (0,2,0) : l'image
   occupe de nouveau tout le cadre et object-fit: contain la montre entiere. */
.hp-card .hp-card__image {
    width: 100%;
    height: 100%;
    max-width: none;
}

/* Body */
.hp-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 4px 22px 24px;
    gap: 16px;
}
.hp-card__title-link { text-decoration: none; color: inherit; }
.hp-card__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--hp-color-text);
    line-height: 1.3;
    transition: color 0.18s;
}
.hp-card__title-link:hover .hp-card__title { color: var(--hp-color-primary); }

/* Specs */
.hp-card__specs {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.hp-card__specs-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 50%;
    justify-content: center;
}
.hp-card__specs-col--left {
    padding-right: 16px;
    border-right: 1px solid var(--hp-color-border);
}
.hp-card__specs-col--right { padding-left: 16px; }

.hp-card__variant,
.hp-card__sku,
.hp-card__spec {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 400;
    color: var(--hp-color-text);
    line-height: 1.3;
    text-align: left;
}
.hp-card__variant,
.hp-card__sku { display: block; }
.hp-card__spec {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.hp-card__icon {
    color: var(--hp-color-text);
    flex-shrink: 0;
}

/* Price */
.hp-card__price {
    margin-top: auto;
    padding-top: 24px;
}
.hp-card__price .price,
.hp-card__price .woocommerce-Price-amount,
.hp-card__price bdi {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--hp-color-text);
    text-decoration: none;
    background: transparent;
}
.hp-card__price del {
    color: var(--hp-color-secondary);
    font-size: 1rem;
    font-weight: 500;
    margin-right: 8px;
}
.hp-card__price ins {
    background: transparent;
    text-decoration: none;
}

/* Footer */
.hp-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: var(--hp-color-white);
    border-top: 1px solid #e8eef3;
    border-radius: 0 0 calc(var(--hp-radius) - 1px) calc(var(--hp-radius) - 1px);
}

/* Quantity picker */
.hp-card__qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    min-width: 90px;
    padding: 0 4px 0 14px;
    background: var(--hp-color-white);
    border: 1px solid #e8edf1;
    border-radius: 999px;
    transition: border-color 0.15s;
}
.hp-card__qty:focus-within { border-color: var(--hp-color-primary); }
.hp-card__qty--placeholder { visibility: hidden; }

.hp-card__qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--hp-color-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.hp-card__qty-btn:hover,
.hp-card__qty-btn:focus {
    color: var(--hp-color-text);
    background: transparent;
    outline: none;
}
.hp-card__qty-btn:active { transform: scale(0.9); }
.hp-card__qty-btn[hidden] { display: none; }
.hp-card__qty-btn:focus-visible {
    outline: 2px solid var(--hp-color-primary);
    outline-offset: 1px;
}
.hp-card__qty-btn svg { width: 12px; height: 12px; }
.hp-card__qty-btn--minus { margin-right: 2px; }

.hp-card__qty-input,
.hp-catalog input[type="number"].hp-card__qty-input {
    flex: 0 1 auto;
    width: auto;
    min-width: 20px;
    max-width: 40px;
    height: 28px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    text-align: center;
    font: 700 0.95rem/1 "Raleway", sans-serif;
    color: var(--hp-color-text);
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: none;
}
.hp-card__qty-input:focus { background: transparent; outline: none; box-shadow: none; }
.hp-card__qty-input::-webkit-outer-spin-button,
.hp-card__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* OOS label */
.hp-card__oos {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 18px;
    color: var(--hp-color-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1;
}

/* Cart button */
.hp-card__cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--hp-color-white);
    border: 1px solid var(--hp-color-border-soft);
    color: var(--hp-color-primary);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.15s;
    flex-shrink: 0;
}
.hp-card__cart-btn:hover {
    background: var(--hp-color-primary);
    border-color: var(--hp-color-primary);
    color: var(--hp-color-white);
    transform: scale(1.06);
}
.hp-card__cart-btn:active { transform: scale(0.94); }
.hp-card__cart-btn.added,
.hp-card__cart-btn.loading {
    background: var(--hp-color-primary);
    border-color: var(--hp-color-primary);
    color: var(--hp-color-white);
}
.hp-card__cart-btn.loading { opacity: 0.6; pointer-events: none; }
.hp-card__cart-btn.added   { animation: hpCartPulse 0.4s ease; }
.hp-card__cart-btn.hp-error {
    background: #fff0f0;
    border-color: #f5b8b8;
    color: #c0392b;
    animation: hpCartShake 0.35s ease;
}
.hp-card__cart-btn--view { color: var(--hp-color-secondary); }
.hp-card__cart-icon { flex-shrink: 0; }

.hp-card--oos .hp-card__cart-btn {
    color: var(--hp-color-muted);
    pointer-events: none;
    opacity: 0.6;
}

/* WC compatibility: hide "view cart" link injected after AJAX add */
.hp-catalog .added_to_cart.wc-forward { display: none; }

@keyframes hpCartPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
@keyframes hpCartShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

/* ---------------------------------------------------------------
   Load more
--------------------------------------------------------------- */
.hp-catalog__more {
    display: flex;
    justify-content: center;
    padding: 32px 0 16px;
    width: 100%;
}
.hp-catalog__load-btn {
    font: 600 0.95rem/1.4 "Raleway", sans-serif;
    color: var(--hp-color-primary);
    background: transparent;
    border: 2px solid var(--hp-color-primary);
    border-radius: 6px;
    padding: 12px 36px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.hp-catalog__load-btn:hover,
.hp-catalog__load-btn:focus {
    background: var(--hp-color-primary);
    color: var(--hp-color-white);
    outline: none;
}
.hp-catalog__load-btn[disabled],
.hp-catalog__load-btn.is-loading {
    opacity: 0.55;
    cursor: wait;
}

/* ---------------------------------------------------------------
   Responsive
--------------------------------------------------------------- */
@media (max-width: 1024px) {
    .hp-catalog__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hp-catalog .hpf-results-bar {
        flex-wrap: nowrap;
        gap: 10px;
        padding-bottom: 14px;
    }
    .hp-catalog .hpf-results-bar__filters-btn {
        display: inline-flex;
        flex-shrink: 0;
        order: 1;
    }
    .hp-catalog .hpf-result-count {
        flex: 1;
        text-align: center;
        order: 2;
        font-size: 0.92rem;
    }
    .hp-catalog .hpf-orderby {
        flex-shrink: 0;
        order: 3;
    }
    .hp-catalog .hpf-orderby__trigger {
        padding: 7px 12px;
        font-size: 0.9rem;
    }
    .hp-catalog .hpf-orderby__panel { min-width: 160px; }
}

@media (max-width: 768px) {
    .hp-card__image { padding: 22px 32px 50px; }
    .hp-card__body  { padding: 2px 16px 18px; gap: 12px; }
    .hp-card__price { padding-top: 18px; }
    .hp-card__footer { padding: 12px 16px; gap: 10px; }
    .hp-card__badge {
        top: -11px;
        left: 14px;
        font-size: 0.65rem;
        padding: 6px 11px;
    }
    .hp-card__qty {
        height: 34px;
        min-width: 80px;
        padding: 0 4px 0 12px;
    }
    .hp-card__qty-btn {
        width: 22px;
        height: 22px;
    }
    .hp-card__qty-input { height: 24px; font-size: 0.9rem; }
    .hp-card__cart-btn { width: 36px; height: 36px; }
    .hp-card__oos { height: 34px; padding: 0 14px; font-size: 0.82rem; }
}

@media (max-width: 540px) {
    .hp-catalog__grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .hp-catalog .hpf-results-bar__filters-btn {
        padding: 7px 12px;
        font-size: 0.88rem;
        gap: 6px;
    }
    .hp-catalog .hpf-results-bar__filters-btn svg { width: 14px; height: 11px; }
    .hp-catalog .hpf-result-count { font-size: 0.85rem; }
    .hp-catalog .hpf-orderby__trigger {
        padding: 7px 10px;
        font-size: 0.85rem;
        gap: 6px;
    }
    .hp-catalog .hpf-orderby__current {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ----- Lisibilite des chiffres : police Quicksand ----- */
.hp-card__sku,
.hp-card__spec,
.hp-card__price,
.hp-card__price .price,
.hp-card__price .woocommerce-Price-amount,
.hp-card__price bdi,
.hp-catalog .hpf-result-count,
.hpf-result-count {
    font-family: "Quicksand", sans-serif;
}

/* ----- Delai de livraison (produits sur commande) ----- */
.hp-card__delay {
    font-family: "Quicksand", sans-serif;
    font-size: 12px;
    color: var(--hp-color-secondary);
    margin: 2px 0 0;
}
