/*
 * Cart "Ma fidélité" block with loyalty expiration — Figma LPV_B2C_Loyalty, "Iteration MVP / Panier"
 * (LoyaltySection 909:9786 mobile, 909:10168 tablet, 909:11948 desktop; cartSummaryCard 909:9854).
 *
 * Loaded by ParentOrderController::addLoyaltyCartMedia() only when
 * LoyaltyFeatureFlag::expirationDisplayedForCustomer() is on, after orderOpcRecap.css whose
 * #loyalty-target / #cart_voucher / #display_cart_vouchers rules it overrides. Everything is
 * scoped to .loyalty-section / .loyalty-earning, which only exist behind that flag.
 *
 * Icons are the Lucide ones referenced by the design (clock-4, gift, chevron-up, check).
 *
 * Breakpoints follow orderOpcRecap.css: > 1024px the block sits in the 305px sidebar (always open,
 * no chevron); <= 1024px it is full width and collapsible, with the balance and the expiring
 * points side by side from 600px (tablet frames, 768 / 1024).
 */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section {
    --loyalty-text-primary: #484D52;
    --loyalty-text-secondary: #959595;
    --loyalty-primary: #2CC1B2;
    --loyalty-primary-dark: #24514C;
    --loyalty-secondary: #F28231;
    --loyalty-bg-secondary: #F2F1EC;
    --loyalty-bg-tertiary: #F8F7F4;
    --loyalty-border: #E4DECB;
    --loyalty-surface: #FFFFFF;

    display: flex;
    flex-direction: column;
    margin: 0 0 15px;
    padding: 0;
    background: none;
    border-radius: 10px;
    color: var(--loyalty-text-primary);
    font: 14px/20px var(--lpv-font-06);
    text-align: left;
}

/* ---- Header ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px 10px 16px;
    border: 0;
    border-radius: 10px 10px 0 0;
    background: var(--loyalty-bg-secondary);
    color: var(--loyalty-text-primary);
    font: bold 16px/20px var(--lpv-font-06);
    text-align: left;
    cursor: pointer;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__title {
    flex: 1 1 auto;
    min-width: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__chevron {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%232CC1B2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E") no-repeat center / 18px 18px;
    transition: transform .2s ease;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section[data-open="false"] .loyalty-section__chevron {
    transform: rotate(180deg);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section[data-open="false"] .loyalty-section__header {
    border-radius: 10px;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section[data-open="false"] .loyalty-section__content {
    display: none;
}

/* ---- Content ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px;
    border: 1px solid var(--loyalty-bg-secondary);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: var(--loyalty-surface);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .inner {
    margin: 0;
    font: inherit;
    color: inherit;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .inner:empty {
    display: none;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section p {
    margin: 0;
    padding: 0;
}

/* ---- Balance ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #loyalty.loyalty-balance {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    font: 14px/20px var(--lpv-font-06);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__available {
    font: bold 14px/20px var(--lpv-font-06);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__label {
    font: 14px/20px var(--lpv-font-06);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    font: bold 14px/20px var(--lpv-font-06);
    white-space: nowrap;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__text {
    margin: 0;
    color: inherit;
}

/* ---- Buttons (Figma Button/Primary, Button/Tertiary & Button/Secondary) ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 34px;
    padding: 2px 10px;
    border-radius: 6px;
    font: 20px/18px var(--lpv-font-01);
    text-align: center;
    text-decoration: none;
    transition: opacity .15s ease;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn:hover,
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn:focus-visible {
    opacity: .85;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn.is-loading {
    opacity: .6;
    pointer-events: none;
    cursor: progress;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn--primary {
    background: var(--loyalty-primary);
    color: #fff;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn--tertiary {
    background: var(--loyalty-border);
    color: var(--loyalty-text-primary);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-btn--secondary {
    background: var(--loyalty-secondary);
    color: #fff;
    line-height: 20px;
}

/* ---- Expiring points (Figma "Info") ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-expiring {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 16px 12px;
    border: 2px solid var(--loyalty-secondary);
    border-radius: 10px;
    background: #FFF3EA;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-expiring__text {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-expiring__icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23F28231' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E") no-repeat center / 18px 18px;
}

/* ---- Vouchers ---- */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: none;
    overflow: visible;
    margin: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers.hidden {
    display: none;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-vouchers__title {
    display: flex;
    align-items: center;
    min-height: 24px;
    font: bold 14px/20px var(--lpv-font-06);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-vouchers__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    min-height: 84px;
    padding: 10px;
    border-radius: 10px;
    background: var(--loyalty-bg-secondary);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    font: bold 14px/20px var(--lpv-font-06);
    color: var(--loyalty-text-primary);
    cursor: pointer;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__value {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__checkbox {
    display: flex;
    flex: 0 0 auto;
    width: auto;
}
/* Figma CheckboxBase S: 14px, 2px turquoise border, filled with a white check when active. */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers .discount-checkbox input {
    position: static;
    top: auto;
    width: 14px;
    height: 14px;
    margin: 0;
    border: 2px solid var(--loyalty-primary);
    border-radius: 2px;
    background: transparent no-repeat center / 10px 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers .discount-checkbox input:checked {
    background-color: var(--loyalty-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers .discount-checkbox input:checked::before,
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #display_cart_vouchers .discount-checkbox input:checked::after {
    content: none;
    display: none;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 18px;
    background: var(--loyalty-text-primary);
    color: #fff;
    font: bold 12px/12px var(--lpv-font-06);
    white-space: nowrap;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher__cumul {
    font: 12px/16px var(--lpv-font-06);
}

/* ---- Promo code field (Figma Input/Text + Button/Input) ---- */
/* orderOpcRecap.css centres #voucher with max-width + auto margins, which shrinks it to its
   content inside this flex column. */
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #voucher {
    width: 100%;
    max-width: none;
    margin: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher-form__field {
    display: flex;
    align-items: stretch;
    height: 38px;
    overflow: hidden;
    border: 2px solid var(--loyalty-border);
    border-radius: 6px;
    background: var(--loyalty-surface);
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher fieldset #discount_name {
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0 10px 0 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--loyalty-text-primary);
    font: 14px/16px var(--lpv-font-06);
    font-size: 14px !important;
    text-align: left;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher fieldset #discount_name::placeholder {
    color: var(--loyalty-text-secondary);
    opacity: 1;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-voucher-form__submit {
    flex: 0 0 auto;
    padding: 0 12px;
    border: 0;
    border-radius: 0 4px 4px 0;
    background: var(--loyalty-border);
    color: var(--loyalty-text-primary);
    font: 18px/1 var(--lpv-font-01);
    cursor: pointer;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher ul.error {
    margin: 0;
    padding: 0;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher ul.error:not(:has(li)) {
    display: none;
}
.lpv_cart_opc #rubriques #loyalty-target.loyalty-section #cart_voucher ul.error li {
    margin: 0;
    font: bold 14px/20px var(--lpv-font-06);
}

/* ---- Summary card: points earned with this order (moved there by cart-summary.js) ---- */
.lpv_cart_opc #cart_summary .loyalty-earning {
    clear: both;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--lpv-color-15);
    color: var(--lpv-color-03);
    font: 12px/16px var(--lpv-font-06);
    text-align: left;
}
.lpv_cart_opc #cart_summary .loyalty-earning__icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23484D52' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13'/%3E%3Cpath d='M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7'/%3E%3Cpath d='M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E") no-repeat center / 18px 18px;
}
.lpv_cart_opc #cart_summary .loyalty-earning__text {
    flex: 1 1 auto;
    margin: 0;
}
/* The hook copy stays hidden until moveLoyaltyText() moves it (same as #loyalty). */
#HOOK_SHOPPING_CART #loyalty-cart-earning {
    display: none;
}

/* ---- Desktop: 305px sidebar, always open ---- */
@media only screen and (min-width: 1025px) {
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__header {
        cursor: default;
        pointer-events: none;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-section__chevron {
        display: none;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section[data-open="false"] .loyalty-section__content {
        display: flex;
    }

    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance--guest .loyalty-balance__info {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 4px;
        text-align: left;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance--guest .loyalty-balance__info > :not(.loyalty-balance__label, .loyalty-balance__score) {
        flex: 0 0 100%;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__value {
        font-size: 12px;
        line-height: 20px;
    }
}

/* ---- Tablet / mobile: full width under the products ---- */
@media only screen and (max-width: 1024px) {
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section {
        margin: 20px 20px 0;
        padding: 0;
        border-radius: 10px;
    }
    .lpv_cart_opc #cart_summary .loyalty-earning {
        margin: 0 20px;
    }
}

/* ---- Tablet: balance and expiring points side by side (Figma 909:10168) ---- */
@media only screen and (min-width: 600px) and (max-width: 1024px) {
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section #loyalty.loyalty-balance {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 16px;
        border-radius: 10px;
        background: var(--loyalty-bg-tertiary);
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__info {
        flex: 0 0 auto;
        align-items: flex-start;
        gap: 10px;
        text-align: left;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__score {
        justify-content: flex-start;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-balance__info .loyalty-btn {
        align-self: flex-start;
    }
    .lpv_cart_opc #rubriques #loyalty-target.loyalty-section .loyalty-expiring {
        flex: 1 1 0;
        min-width: 0;
        min-height: 125px;
    }
}
