/* ============================================================
   CONVERTOOLS FOR WOOCOMMERCE — Front CSS
   Responsive : Mobile first (320px → 768px → 1024px+)
   Toutes les couleurs via CSS Variables injectees par PHP
   ============================================================ */

/* ============================================================
   RESET & BASE
   ============================================================ */
.smx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.18s ease;
    line-height: 1.4;
    white-space: nowrap;
}

.smx-btn--primary {
    background: var(--smx-brand, #7C3AED);
    color: #fff !important;
    border-color: var(--smx-brand, #7C3AED);
}

.smx-btn--primary:hover {
    filter: brightness(0.9);
    color: #fff !important;
}

.smx-btn--outline {
    background: transparent;
    color: var(--smx-brand, #7C3AED) !important;
    border-color: var(--smx-brand, #7C3AED);
}

.smx-btn--outline:hover {
    background: var(--smx-brand, #7C3AED);
    color: #fff !important;
}

.smx-btn--full {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   SIDE CART
   ============================================================ */

/* Overlay */
.smx-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.smx-cart-overlay.smx-is-open {
    display: block;
    opacity: 1;
}

/* Drawer */
.smx-side-cart {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: var(--smx-cart-width, 420px);
    background: var(--smx-cart-bg, #ffffff);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
    transform: translateX(110%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.smx-side-cart--right { right: 0; }
.smx-side-cart--left  { left: 0; transform: translateX(-110%); box-shadow: 8px 0 40px rgba(0, 0, 0, 0.12); }

.smx-side-cart.smx-is-open            { transform: translateX(0); }
.smx-side-cart--left.smx-is-open      { transform: translateX(0); }

/* Header */
.smx-cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.smx-cart__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.smx-cart__count {
    background: var(--smx-brand, #7C3AED);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.smx-cart__close {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.smx-cart__close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Shipping bar dans le side cart */
.smx-cart__shipping-bar {
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.smx-shipping-progress__text {
    font-size: 0.82rem;
    font-weight: 500;
    color: #0f172a;
    margin: 0 0 8px;
}

.smx-shipping-progress__bar {
    background: #e2e8f0;
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
}

.smx-shipping-progress__fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease;
    background: var(--smx-bar-fill, #7C3AED);
}

/* Corps du panier */
.smx-cart__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 12px 20px;
}

/* Liste des articles */
.smx-cart__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.smx-cart__item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: flex-start;
}

.smx-cart__item:last-child { border-bottom: none; }

.smx-cart__item-image {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.smx-cart__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.smx-cart__item-info {
    flex: 1;
    min-width: 0;
}

.smx-cart__item-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smx-cart__item-price {
    display: block;
    font-size: 0.82rem;
    color: #64748b;
    margin-bottom: 10px;
}

.smx-cart__item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Selecteur de quantite */
.smx-qty {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    overflow: hidden;
    height: 32px;
}

.smx-qty__btn {
    background: none;
    border: none;
    width: 28px;
    height: 100%;
    cursor: pointer;
    color: #475569;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.smx-qty__btn:hover { background: #f1f5f9; }

.smx-qty__input {
    width: 36px;
    height: 100%;
    border: none;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    -moz-appearance: textfield;
    padding: 0;
}

.smx-qty__input::-webkit-outer-spin-button,
.smx-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; }

.smx-cart__item-subtotal {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
    margin-left: auto;
}

.smx-cart__item-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}

.smx-cart__item-remove:hover { color: #dc2626; background: #fef2f2; }

/* Panier vide */
.smx-cart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
    gap: 12px;
    height: 100%;
}

.smx-cart__empty-icon {
    font-size: 3rem;
    opacity: 0.4;
}

.smx-cart__empty p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0;
}

/* Footer */
.smx-cart__footer {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    padding: 16px 20px;
    background: #fff;
}

/* Code promo */
.smx-cart__coupon { margin-bottom: 14px; }

.smx-coupon-form {
    display: flex;
    gap: 8px;
}

.smx-coupon-form__input {
    flex: 1;
    padding: 9px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.85rem;
    color: #0f172a;
    min-width: 0;
    transition: border-color 0.15s;
}

.smx-coupon-form__input:focus {
    outline: none;
    border-color: var(--smx-brand, #7C3AED);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.smx-coupon-form__btn {
    padding: 9px 16px;
    background: var(--smx-brand, #7C3AED);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s;
}

.smx-coupon-form__btn:hover { filter: brightness(0.9); }

.smx-coupon-form__message {
    font-size: 0.78rem;
    margin: 6px 0 0;
    min-height: 16px;
}

.smx-coupon-form__message.success { color: #059669; }
.smx-coupon-form__message.error   { color: #dc2626; }

.smx-cart__applied-coupons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.smx-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #EDE9FE;
    color: #7C3AED;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.smx-coupon-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #7C3AED;
    font-size: 0.7rem;
    padding: 0;
    line-height: 1;
}

/* Totaux */
.smx-cart__totals {
    margin-bottom: 14px;
}

.smx-cart__total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.875rem;
    color: #475569;
}

.smx-cart__total-row--discount { color: #059669; }

.smx-cart__total-row--total {
    border-top: 1px solid #e2e8f0;
    margin-top: 6px;
    padding-top: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.smx-cart__tax-note {
    font-size: 0.72rem;
    color: #94a3b8;
    margin: 4px 0 0;
    text-align: right;
}

/* Boutons footer */
.smx-cart__buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

/* Mini trust */
.smx-cart__mini-trust {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.72rem;
    color: #94a3b8;
    flex-wrap: wrap;
}

/* ============================================================
   BARRE LIVRAISON GRATUITE (page panier/checkout)
   ============================================================ */

.smx-shipping-bar {
    background: var(--smx-bar-bg, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.smx-shipping-bar__text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #0f172a;
    margin: 0 0 10px;
}

.smx-shipping-bar__track {
    background: #e2e8f0;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}

.smx-shipping-bar__fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease;
}

/* ============================================================
   COMPTE A REBOURS
   ============================================================ */

.smx-countdown {
    background: var(--smx-countdown-bg, #FEF3C7);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--smx-countdown-color, #92400E);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.smx-timer {
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* ============================================================
   URGENCE STOCK
   ============================================================ */

.smx-stock-urgency {
    background: var(--smx-urgency-bg, #FEF3C7);
    border: 1px solid #FDE68A;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 14px 0;
}

.smx-stock-urgency__text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--smx-urgency-color, #92400E);
    margin: 0 0 7px;
}

.smx-stock-urgency__bar {
    background: #FDE68A;
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
}

.smx-stock-urgency__fill {
    height: 100%;
    background: var(--smx-urgency-fill, #D97706);
    border-radius: 20px;
    transition: width 0.4s ease;
}

/* ============================================================
   PREUVE SOCIALE
   ============================================================ */

.smx-social-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.smx-social-proof__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
}

.smx-social-proof__badge--views {
    background: var(--smx-sp-views-bg, #EDE9FE);
    color: var(--smx-sp-views-color, #7C3AED);
}

.smx-social-proof__badge--buys {
    background: var(--smx-sp-buy-bg, #ECFDF5);
    color: var(--smx-sp-buy-color, #059669);
}

.smx-pulse {
    width: 7px;
    height: 7px;
    background: currentColor;
    border-radius: 50%;
    flex-shrink: 0;
    animation: ctw-pulse 1.5s infinite;
}

@keyframes ctw-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ============================================================
   ORDER BUMP
   ============================================================ */

.smx-order-bump {
    background: var(--smx-bump-bg, #FFF7ED);
    border: 2px solid var(--smx-bump-border, #FDE68A);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 10px 0;
}

.smx-order-bump__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.smx-order-bump__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #92400E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.smx-order-bump__content { flex: 1; min-width: 180px; }
.smx-order-bump__title   { font-weight: 700; color: #0f172a; font-size: 0.95rem; margin-bottom: 3px; }
.smx-order-bump__desc    { font-size: 0.82rem; color: #64748b; }
.smx-order-bump__price   { text-align: right; flex-shrink: 0; }
.smx-order-bump__old     { color: #94a3b8; font-size: 0.82rem; display: block; text-decoration: line-through; }
.smx-order-bump__final   { font-size: 1.1rem; font-weight: 700; color: #059669; display: block; }

/* ============================================================
   TRUST BADGES
   ============================================================ */

.smx-trust-badges {
    background: var(--smx-trust-bg, #f8fafc);
    border: 1px solid var(--smx-trust-border, #e2e8f0);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 14px 0;
}

.smx-trust-badges__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.smx-trust-badges__item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #475569;
    font-weight: 500;
}

.smx-trust-badges__payments {
    display: flex;
    align-items: center;
    gap: 5px;
}

.smx-trust-badges__card {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 3px;
    color: #fff;
}

/* ============================================================
   REASSURANCE
   ============================================================ */

.smx-reassurance {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0;
    border-top: 1px solid var(--smx-reassurance-border, #e2e8f0);
    border-bottom: 1px solid var(--smx-reassurance-border, #e2e8f0);
    margin: 14px 0;
}

.smx-reassurance__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--smx-reassurance-color, #475569);
    flex: 1;
    min-width: 140px;
}

/* ============================================================
   LIVRAISON ESTIMEE
   ============================================================ */

.smx-delivery {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--smx-delivery-bg, #EFF6FF);
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--smx-delivery-color, #1E40AF);
}

/* ============================================================
   BADGE ORIGINE
   ============================================================ */

.smx-origin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    margin: 8px 0;
}

/* ============================================================
   PROTECTION & RETOUR
   ============================================================ */

.smx-protection {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--smx-protection-bg, #EDE9FE);
    border: 1px solid #DDD6FE;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 10px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--smx-protection-color, #6D28D9);
}

.smx-return-policy {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 0.82rem;
    color: #475569;
    margin: 10px 0;
    line-height: 1.5;
}

/* ============================================================
   EXIT INTENT POPUP
   ============================================================ */

.smx-exit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.smx-exit-overlay.open { display: flex; }

.smx-exit-modal {
    background: #fff;
    border-radius: 20px;
    padding: 44px 36px;
    width: 100%;
    max-width: 460px;
    text-align: center;
    position: relative;
    animation: ctw-slide-up 0.28s ease;
}

@keyframes ctw-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.smx-exit-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}

.smx-exit-close:hover { background: #f1f5f9; color: #0f172a; }

.smx-coupon-code {
    background: #f8fafc;
    border: 2px dashed var(--smx-brand, #7C3AED);
    border-radius: 10px;
    padding: 12px 20px;
    margin: 16px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--smx-brand, #7C3AED);
    letter-spacing: 3px;
    cursor: pointer;
    user-select: all;
    transition: background 0.15s;
}

.smx-coupon-code:hover { background: #EDE9FE; }

/* ============================================================
   CONVERTISSEUR DEVISE
   ============================================================ */

.smx-currency-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

.smx-currency-widget select {
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    background: none;
    outline: none;
}

/* ============================================================
   RESPONSIVE — MOBILE (< 768px)
   ============================================================ */

@media (max-width: 767px) {

    /* Side cart pleine largeur */
    .smx-side-cart {
        max-width: 100%;
        width: 100%;
    }

    /* Panier header */
    .smx-cart__header { padding: 14px 16px; }
    .smx-cart__body   { padding: 10px 16px; }
    .smx-cart__footer { padding: 12px 16px; }
    .smx-cart__shipping-bar { padding: 10px 16px; }

    /* Items panier */
    .smx-cart__item { gap: 10px; }
    .smx-cart__item-image { width: 60px; height: 60px; }
    .smx-cart__item-actions { gap: 8px; }

    /* Order bump empile */
    .smx-order-bump__inner {
        flex-direction: column;
        gap: 12px;
    }
    .smx-order-bump__price { text-align: left; }

    /* Trust badges : centrer et envelopper */
    .smx-trust-badges__inner {
        justify-content: flex-start;
        gap: 8px;
    }
    .smx-trust-badges__item { font-size: 0.74rem; }

    /* Reassurance : 1 colonne */
    .smx-reassurance { flex-direction: column; gap: 6px; }
    .smx-reassurance__item { min-width: unset; }

    /* Social proof : empiler les badges */
    .smx-social-proof { flex-direction: column; gap: 6px; }

    /* Countdown plus petit */
    .smx-countdown { font-size: 0.82rem; padding: 10px 14px; }

    /* Exit intent popup */
    .smx-exit-modal { padding: 32px 20px; border-radius: 14px; }
    .smx-coupon-code { font-size: 1rem; letter-spacing: 2px; }

    /* Devise widget */
    .smx-currency-widget { bottom: 12px; left: 12px; padding: 6px 10px; }

    /* Protection badge */
    .smx-protection { font-size: 0.78rem; }

    /* Coupon form */
    .smx-coupon-form { flex-direction: column; }
    .smx-coupon-form__btn { width: 100%; }
}

/* ============================================================
   RESPONSIVE — TABLETTE (768px - 1023px)
   ============================================================ */

@media (min-width: 768px) and (max-width: 1023px) {

    .smx-side-cart { max-width: 380px; }

    /* Order bump : flex mais plus compact */
    .smx-order-bump__inner { gap: 12px; }

    /* Reassurance : 2 colonnes */
    .smx-reassurance__item { min-width: 120px; }

    /* Trust badges */
    .smx-trust-badges__inner { gap: 10px; }
}

/* ============================================================
   RESPONSIVE — DESKTOP (1024px+)
   ============================================================ */

@media (min-width: 1024px) {

    .smx-side-cart { max-width: var(--smx-cart-width, 420px); }

    .smx-reassurance { flex-wrap: nowrap; }

    .smx-trust-badges__inner { justify-content: center; }
}

/* ============================================================
   ANIMATION LOADING (skeleton)
   ============================================================ */

.smx-loading-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: ctw-skeleton 1.5s infinite;
    border-radius: 6px;
    height: 16px;
}

@keyframes ctw-skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   ACCESSIBILITE
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .smx-side-cart,
    .smx-cart-overlay,
    .smx-shipping-progress__fill,
    .smx-stock-urgency__fill,
    .smx-shipping-bar__fill { transition: none; }
    .smx-pulse             { animation: none; }
    .smx-loading-skeleton  { animation: none; }
}
