/*
 * Hydroplante Product Page 3.3
 *
 * Summary layout (desktop, top to bottom) :
 *   Subtitle
 *   Specs
 *   Stock
 *   Unit price
 *   --- form.cart (flex column with 'order' on children) ---
 *     order 1 : label "Quantité"   (injected, .hp-summary-qty-label)
 *     order 1 : .quantity pill                    (native + decorated)
 *     order 2 : total HT                          (injected, .hp-summary-total)
 *     order 3 : add-to-cart button                (native)
 *   --------------------------------------------------------
 */

/* =================================================================
   1. SUMMARY (shortcode [hp_summary])
   ================================================================= */

.hp-summary {
    --hp-color-text:      var(--e-global-color-text,      #1F2626);
    --hp-color-primary:   var(--e-global-color-primary,   #2787C9);
    --hp-color-accent:    var(--e-global-color-accent,    #0E9EDE);
    --hp-color-secondary: var(--e-global-color-secondary, #767676);
    --hp-color-border:    #E2E8E2;
    --hp-font:            var(--e-global-typography-text-font-family, "Raleway"), sans-serif;

    font-family: var(--hp-font);
    color: var(--hp-color-text);
}

/* ---------- Subtitle (variety) --------------------------------------- */

.hp-summary .hp-summary-subtitle {
    margin: 0 0 1.5rem 0;
    font-family: var(--hp-font);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--hp-color-secondary);
}

/* ---------- Characteristics ----------------------------------------- */

.hp-summary .hp-summary-specs {
    margin: 0 0 1.5rem 0;
    padding: 0;
}

.hp-summary .hp-summary-specs__row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.35rem 0;
    font-size: 1rem;
}

.hp-summary .hp-summary-specs__row dt {
    flex: 0 0 90px;
    margin: 0;
    font-weight: 500;
    color: var(--hp-color-text);
}

.hp-summary .hp-summary-specs__row dd {
    margin: 0;
    color: var(--hp-color-text);
    font-weight: 500;
}

/* ---------- Stock --------------------------------------------------- */

.hp-summary .hp-summary-stock {
    border: 1px solid var(--hp-color-border);
    border-radius: 8px;
    padding: 0.85rem 1.1rem;
    margin: 0 0 1.25rem 0;
    background: #fff;
    font-size: 1rem;
}

.hp-summary .hp-summary-stock__label {
    color: var(--hp-color-text);
}

.hp-summary .hp-summary-stock__value {
    color: var(--hp-color-primary);
    font-weight: 700;
}

.hp-summary .hp-summary-stock__label--out {
    color: #c0392b;
    font-weight: 600;
}

/* ---------- Unit price --------------------------------------------- */

.hp-summary .hp-summary-price {
    margin: 0 0 1.25rem 0;
    font-size: 1.05rem;
    color: var(--hp-color-text);
}

.hp-summary .hp-summary-price__label {
    color: var(--hp-color-secondary);
}

.hp-summary .hp-summary-price__value,
.hp-summary .hp-summary-price__value .woocommerce-Price-amount {
    color: var(--hp-color-primary);
    font-weight: 800;
    font-size: 1.2rem;
}

.hp-summary .hp-summary-price__suffix {
    margin-left: 0.25rem;
    color: var(--hp-color-secondary);
    font-size: 0.9rem;
}

/* ---------- Cart wrapper ------------------------------------------ */

/* The native "En stock" line rendered above the form is hidden,
   we already display stock ourselves above.                      */
.hp-summary .hp-summary-cart .stock {
    display: none;
}

/* The form becomes a flex column with explicit visual ordering
   via 'order' on each child. Native + injected elements coexist. */
.hp-summary .hp-summary-cart form.cart {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

/* ---------- Quantity row : label + pill --------------------------- */

/* Label and pill are placed first, on the same visual row, via a
   small wrapper trick : the label has order 1 and is float-style,
   the pill has order 1 too and aligns to the right. We use a
   pseudo grid at the form level instead.                         */
.hp-summary .hp-summary-cart form.cart {
    /* Use grid for precise placement of label + pill. */
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.75rem 1rem;
}

.hp-summary .hp-summary-cart form.cart .hp-summary-qty-label {
    order: 1;
    grid-column: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--hp-color-text);
}

.hp-summary .hp-summary-cart form.cart .quantity.hp-summary-qty-pill {
    order: 2;
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--hp-color-border);
    border-radius: 999px;
    padding: 0.2rem 0.4rem;
    margin: 0;
    background: #fff;
}

.hp-summary .hp-summary-cart form.cart .quantity.hp-summary-qty-pill input.qty {
    width: 2.5rem;
    border: none;
    background: transparent;
    text-align: center;
    font-family: var(--hp-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--hp-color-text);
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
}

.hp-summary .hp-summary-cart form.cart .quantity.hp-summary-qty-pill input.qty::-webkit-outer-spin-button,
.hp-summary .hp-summary-cart form.cart .quantity.hp-summary-qty-pill input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hp-summary .hp-summary-cart .hp-summary-qty-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--hp-color-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.hp-summary .hp-summary-cart .hp-summary-qty-btn:hover,
.hp-summary .hp-summary-cart .hp-summary-qty-btn:focus {
    background: #f4f7f4;
    color: var(--hp-color-primary);
}

.hp-summary .hp-summary-cart .hp-summary-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Hide native quantity label (screen-reader copy) */
.hp-summary .hp-summary-cart form.cart .quantity .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- HT total ----------------------------------------------- */

.hp-summary .hp-summary-cart form.cart .hp-summary-total {
    order: 3;
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1.25rem 0 1.25rem 0;
    margin: 0.5rem 0 0 0;
    border-top: 1px solid var(--hp-color-border);
}

.hp-summary .hp-summary-cart form.cart .hp-summary-total__label {
    font-family: var(--e-global-typography-primary-font-family, var(--hp-font));
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--hp-color-text);
}

.hp-summary .hp-summary-cart form.cart .hp-summary-total__value,
.hp-summary .hp-summary-cart form.cart .hp-summary-total__value .woocommerce-Price-amount {
    margin-left: auto;
    font-family: var(--e-global-typography-primary-font-family, var(--hp-font));
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--hp-color-primary);
}

.hp-summary .hp-summary-cart form.cart .hp-summary-total__suffix {
    margin-left: 0.25rem;
    color: var(--hp-color-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ---------- Add-to-cart button ----------------------------------- */

.hp-summary .hp-summary-cart form.cart button.single_add_to_cart_button {
    order: 4;
    grid-column: 1 / -1;
    width: 100%;
    padding: 1rem 1.5rem;
    margin: 0.5rem 0 0 0;
    border: none;
    border-radius: 999px;
    background: var(--hp-color-primary);
    color: #fff;
    font-family: var(--hp-font);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.hp-summary .hp-summary-cart form.cart button.single_add_to_cart_button:hover,
.hp-summary .hp-summary-cart form.cart button.single_add_to_cart_button:focus {
    background: var(--hp-color-accent);
}

.hp-summary .hp-summary-cart form.cart button.single_add_to_cart_button:active {
    transform: translateY(1px);
}

/* ---------- Summary responsive ------------------------------------ */

@media (max-width: 600px) {
    .hp-summary .hp-summary-cart form.cart .hp-summary-total__label,
    .hp-summary .hp-summary-cart form.cart .hp-summary-total__value,
    .hp-summary .hp-summary-cart form.cart .hp-summary-total__value .woocommerce-Price-amount {
        font-size: 1.4rem;
    }
}


/* =================================================================
   2. PRODUCT TABS (unchanged from v3.2)
   ================================================================= */

.hp-product-tabs {
    --hp-tabs-text:    var(--e-global-color-text,      #1F2626);
    --hp-tabs-primary: var(--e-global-color-primary,   #2787C9);
    --hp-tabs-muted:   var(--e-global-color-secondary, #767676);
    --hp-tabs-row-alt: #f5f7f9;
    --hp-tabs-border:  #e3e8ec;
    --hp-tabs-font:    var(--e-global-typography-text-font-family, "Raleway"), sans-serif;

    margin-top: 2rem;
    font-family: var(--hp-tabs-font);
    color: var(--hp-tabs-text);
}

.hp-tab-panel h2 {
    display: none;
}

.hp-tabs-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--hp-tabs-border);
}

.elementor-kit-9 .hp-tab-btn,
.hp-tab-btn {
    position: relative;
    margin-right: 1.75rem;
    padding: 0.5rem 0;
    border: none;
    background: none;
    font: 600 0.95rem/1.4 var(--hp-tabs-font);
    color: var(--hp-tabs-text);
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.elementor-kit-9 .hp-tab-btn:hover,
.hp-tab-btn:hover {
    color: var(--hp-tabs-primary);
}

.elementor-kit-9 .hp-tab-btn.is-active,
.hp-tab-btn.is-active {
    color: var(--hp-tabs-primary);
    font-weight: 700;
}

.hp-tab-btn.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--hp-tabs-primary);
}

.hp-tab-btn:focus-visible {
    outline: 2px solid var(--hp-tabs-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.hp-tab-panel {
    display: none;
}

.hp-tab-panel.is-active {
    display: block;
    animation: hpTabFadeIn 0.2s ease;
}

@keyframes hpTabFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}

.elementor-kit-9 .hp-tab-panel .woocommerce-product-attributes,
.hp-tab-panel .woocommerce-product-attributes {
    width: 100%;
    border: none;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.hp-tab-panel .woocommerce-product-attributes tr:nth-child(odd) {
    background-color: var(--hp-tabs-row-alt);
}

.hp-tab-panel .woocommerce-product-attributes tr:nth-child(even) {
    background-color: #ffffff;
}

.elementor-kit-9 .hp-tab-panel table.shop_attributes tr:nth-child(even) td,
.elementor-kit-9 .hp-tab-panel table.shop_attributes tr:nth-child(even) th {
    background: transparent;
}

.hp-tab-panel .woocommerce-product-attributes th,
.hp-tab-panel .woocommerce-product-attributes td {
    padding: 10px 14px;
    border: none;
    color: var(--hp-tabs-text);
    text-align: left;
    vertical-align: middle;
}

.elementor-kit-9 .hp-tab-panel table.shop_attributes th {
    width: 45%;
    color: var(--hp-tabs-text);
    font-weight: 400;
}

.elementor-kit-9 .hp-tab-panel table.shop_attributes td {
    font-style: normal;
    font-weight: 600;
}

.hp-tab-panel .woocommerce-product-attributes td p {
    margin: 0;
    padding: 0;
}

.hp-tab-panel .woocommerce-product-description {
    color: var(--hp-tabs-text);
    line-height: 1.7;
}

.hp-tab-panel .woocommerce-product-description p:first-child {
    margin-top: 0;
}

.hp-tab-panel .woocommerce-product-description p:last-child {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .hp-tabs-nav {
        gap: 0.5rem;
        overflow-x: auto;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .hp-tab-btn {
        margin-right: 1rem;
        white-space: nowrap;
        font-size: 0.9rem;
    }

    .hp-tab-panel .woocommerce-product-attributes th,
    .hp-tab-panel .woocommerce-product-attributes td {
        padding: 8px 10px;
        font-size: 0.88rem;
    }
}

.hp-summary .hp-summary-cart form.cart .hp-summary-pack-notice {
    order: 2;
    grid-column: 1 / -2;
    margin: 0.25rem 0 0 0;
    padding: 0;
    font-family: var(--hp-font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--hp-color-secondary);
    line-height: 1.3;
}

/* ----- Lisibilite des chiffres : police Quicksand ----- */
.hp-summary .hp-summary-specs__row,
.hp-summary .hp-summary-specs__row dt,
.hp-summary .hp-summary-specs__row dd,
.hp-summary .hp-summary-stock__value,
.hp-summary .hp-summary-price__value,
.hp-summary .hp-summary-price__value .woocommerce-Price-amount,
.hp-summary .hp-summary-cart form.cart .quantity.hp-summary-qty-pill input.qty,
.hp-summary .hp-summary-cart form.cart .hp-summary-total__value,
.hp-summary .hp-summary-cart form.cart .hp-summary-total__value .woocommerce-Price-amount,
.elementor-kit-9 .hp-tab-panel .woocommerce-product-attributes,
.hp-tab-panel .woocommerce-product-attributes,
.elementor-kit-9 .hp-tab-panel .woocommerce-product-attributes th,
.elementor-kit-9 .hp-tab-panel .woocommerce-product-attributes td,
.hp-tab-panel .woocommerce-product-attributes th,
.hp-tab-panel .woocommerce-product-attributes td {
    font-family: "Quicksand", sans-serif;
}

/* ---------------------------------------------------------------
   Tableau des specifications sous 768px

   Un tableau HTML est naturellement fluide : les colonnes se partagent
   la largeur disponible et un texte long passe a la ligne DANS sa
   colonne. C'est le rendu bureau, et il convient a toutes les tailles.

   WooCommerce le casse volontairement via woocommerce-smallscreen.css
   (chargee en "max-width: 768px"), qui empile libelle et valeur :
       table.shop_attributes tr        { display: block }
       table.shop_attributes tr td,th  { display: block; width: auto }

   On annule uniquement cette surcharge. Les largeurs et couleurs
   definies plus haut reprennent alors la main, identiques au bureau.
--------------------------------------------------------------- */
@media only screen and (max-width: 768px) {
    .woocommerce .hp-tab-panel table.shop_attributes tr,
    .hp-tab-panel .woocommerce-product-attributes tr {
        display: table-row;
    }

    .woocommerce .hp-tab-panel table.shop_attributes tr th,
    .woocommerce .hp-tab-panel table.shop_attributes tr td,
    .hp-tab-panel .woocommerce-product-attributes th,
    .hp-tab-panel .woocommerce-product-attributes td {
        display: table-cell;
        max-width: none;
        vertical-align: middle;
    }
}
