/**
 * Panier de l'en-tête ([ptc_header_cart], inc/cart.php).
 * Mobile et tablette : icône et nombre d'articles. Ordinateur : aperçu au survol.
 */

.ptc-hcart {
    position: relative;
}

#header-main .ptc-hcart__link {
    position: relative;
    text-decoration: none;
}

/* Pastille du nombre d'articles */
.ptc-hcart__count {
    position: absolute;
    top: 2px;
    right: -1px;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #e63c69;
    color: #fff;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.ptc-hcart__count.is-empty {
    display: none;
}

.ptc-hcart__count.is-bump {
    animation: ptc-hcart-bump 0.45s ease;
}

@keyframes ptc-hcart-bump {
    40% { transform: scale(1.35); }
}

/* Aperçu */
.ptc-hcart__panel {
    display: none;
}

@media (hover: hover) and (min-width: 1025px) {
    .ptc-hcart__panel {
        position: absolute;
        top: calc(100% + 10px);
        right: -8px;
        z-index: 1000;
        display: block;
        width: 380px;
        padding: 20px;
        border: 1px solid #ececec;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 18px 40px rgb(0 0 0 / 0.12);
        color: #111;
        text-align: left;
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    }

    /* Pont invisible entre l'icône et l'aperçu : le survol ne se coupe pas */
    .ptc-hcart__panel::before {
        content: "";
        position: absolute;
        right: 0;
        bottom: 100%;
        left: 0;
        height: 14px;
    }

    .ptc-hcart.is-open .ptc-hcart__panel {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition-delay: 0s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ptc-hcart__panel,
    .ptc-hcart__count.is-bump {
        transition: none !important;
        animation: none !important;
    }
}

.ptc-hcart__title {
    margin: 0 0 12px;
    font-family: "Londrina Solid", sans-serif;
    font-size: 1.45rem;
    line-height: 1;
    text-transform: uppercase;
}

.ptc-hcart__title span {
    color: #555;
    font-size: 0.62em;
    vertical-align: middle;
}

.ptc-hcart__items {
    max-height: 290px;
    margin: 0 -12px 0 0;
    padding: 0 12px 0 0; /* la barre de défilement ne colle plus au contenu */
    overflow-y: auto;
    border-top: 1px solid #ececec;
    list-style: none;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* Firefox (Chrome ignorerait sinon le style arrondi ci-dessous) */
@supports not selector(::-webkit-scrollbar) {
    .ptc-hcart__items {
        scrollbar-width: thin;
        scrollbar-color: #cfcfcf transparent;
    }
}

/* Barre de défilement fine et arrondie (Chrome, Edge, Safari) */
.ptc-hcart__items::-webkit-scrollbar {
    width: 6px;
}

.ptc-hcart__items::-webkit-scrollbar-track {
    margin: 8px 0;
    background: transparent;
}

.ptc-hcart__items::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #d4d4d4;
}

.ptc-hcart__items::-webkit-scrollbar-thumb:hover {
    background: #b5b5b5;
}

.ptc-hcart__items::-webkit-scrollbar-button {
    display: none;
    height: 0;
}

.ptc-hcart__item {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #ececec;
}

.ptc-hcart__media {
    display: block;
    overflow: hidden;
    border-radius: 12px;
    background: #f4f4f4;
}

.ptc-hcart__media img {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 8% !important;
    background: transparent !important;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.ptc-hcart__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.ptc-hcart__name {
    overflow: hidden;
    color: #111 !important;
    font-weight: 700;
    text-decoration: none !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.ptc-hcart__name:hover {
    color: #c92f58 !important;
}

.ptc-hcart__options {
    overflow: hidden;
    color: #666;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ptc-hcart__line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #666;
}

.ptc-hcart__line strong {
    color: #111;
}

button.ptc-hcart__remove {
    align-self: flex-start;
    margin: 2px 0 0;
    padding: 0;
    border: 0;
    background: none !important;
    color: #666 !important;
    font-size: 0.8rem;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

button.ptc-hcart__remove:hover,
button.ptc-hcart__remove:focus-visible {
    color: #c92f58 !important;
}

.ptc-hcart__item.is-removing {
    opacity: 0.4;
    pointer-events: none;
}

.ptc-hcart__subtotal {
    display: flex;
    justify-content: space-between;
    margin: 14px 0;
    font-size: 1rem;
}

.ptc-hcart__empty {
    margin: 0 0 14px;
    font-weight: 600;
}

.ptc-hcart__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

a.ptc-hcart__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 14px;
    border: 1.5px solid #111;
    border-radius: 12px;
    background: #fff;
    color: #111 !important;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.ptc-hcart__btn:hover {
    background: #f4f4f4;
}

a.ptc-hcart__btn--primary {
    border-color: #e63c69;
    background: #e63c69;
    color: #fff !important;
}

a.ptc-hcart__btn--primary:hover {
    border-color: #c92f58;
    background: #c92f58;
}

/* ==========================================================================
   Confirmation d'ajout (mobile et tablette) et erreurs : bandeau en bas
   ========================================================================== */

.ptc-toast {
    position: fixed;
    right: 12px;
    bottom: calc(12px + var(--ptc-toast-offset, 0px) + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 12px 12px 12px;
    border-radius: 16px;
    background: #111;
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.25);
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.35;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.ptc-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.ptc-toast.is-error {
    background: #c92f58;
}

.ptc-toast__media {
    flex: 0 0 52px;
    overflow: hidden;
    border-radius: 10px;
    background: #f4f4f4;
}

.ptc-toast__media img {
    display: block;
    width: 52px !important;
    height: 52px !important;
    margin: 0 !important;
    padding: 6% !important;
    background: transparent !important;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.ptc-toast__icon {
    display: grid;
    flex: 0 0 36px;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e63c69;
    font-weight: 700;
}

.ptc-toast.is-error .ptc-toast__icon {
    background: #fff;
    color: #c92f58;
}

.ptc-toast__icon svg {
    width: 18px;
    height: 18px;
}

.ptc-toast__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.ptc-toast__title {
    font-weight: 700;
}

.ptc-toast__text {
    overflow: hidden;
    color: rgb(255 255 255 / 0.75);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ptc-toast.is-error .ptc-toast__text {
    color: #fff;
    white-space: normal;
}

a.ptc-toast__link {
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff;
    color: #111 !important;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
}

.ptc-toast__close {
    display: grid;
    flex: 0 0 32px;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent !important;
    color: #fff !important;
    cursor: pointer;
}

.ptc-toast__close svg {
    width: 18px;
    height: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .ptc-toast {
        transition: none;
    }
}

/* Bouton « Ajouter au panier » pendant l'envoi puis « Ajouté » */
.single_add_to_cart_button.is-loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: progress;
}

.single_add_to_cart_button.is-added .ptc-btn-check {
    display: inline-grid;
    width: 18px;
    height: 18px;
    margin-right: 4px;
    vertical-align: -3px;
}

.single_add_to_cart_button.is-added .ptc-btn-check svg {
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Barres fixées en bas (fiche produit, page Panier) sur mobile : le bas du
   pied de page garde la hauteur de la barre pour ne rien cacher.
   ========================================================================== */

@media (max-width: 767px) {
    body.single-product .elementor-location-footer .e-con.e-parent > .e-con:last-child,
    body.ptc-cart-page .elementor-location-footer .e-con.e-parent > .e-con:last-child {
        padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    }
}

/* Écran bord à bord (viewport-fit=cover, inc/header-nav.php) : marges des encoches en paysage */
body {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
}
