/**
 * Jida Market — Sidecart 100% custom
 * Fichier : goya-child/assets/css/sidecart.css
 */

:root {
    --jsc-green:       #254636;
    --jsc-green-light: #2e5542;
    --jsc-orange:      #e8601c;
    --jsc-beige:       #f5efe6;
    --jsc-beige-dark:  #ece4d8;
    --jsc-text:        #1a1a1a;
    --jsc-muted:       #6b6660;
    --jsc-white:       #ffffff;
    --jsc-red:         #c0391b;
    --jsc-radius:      14px;
    --jsc-width:       380px;
}

/* ── Désactiver le sidecart natif Goya ─────────────────── */
#side-cart { display: none !important; }

/* ── Overlay ────────────────────────────────────────────── */
#jm-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 99998;
    transition: background 0.3s ease;
}
#jm-cart-overlay.is-open {
    background: rgba(0,0,0,0.45);
}

/* ── Panel ──────────────────────────────────────────────── */
#jm-cart {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--jsc-width);
    max-width: 100vw;
    background: var(--jsc-beige);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(110%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 40px rgba(0,0,0,0.15);
}
#jm-cart.is-open {
    transform: translateX(0);
}

/* ── Header ─────────────────────────────────────────────── */
#jm-cart-header {
    background: var(--jsc-green);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#jm-cart-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--jsc-white);
    display: flex;
    align-items: center;
    gap: 10px;
}
#jm-cart-count {
    background: var(--jsc-orange);
    color: var(--jsc-white);
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    line-height: 1;
}
#jm-cart-close {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 8px;
    color: var(--jsc-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}
#jm-cart-close:hover { background: rgba(255,255,255,0.25); }
#jm-cart-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── Body scrollable ────────────────────────────────────── */
#jm-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}

/* ── État vide ──────────────────────────────────────────── */
#jm-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--jsc-muted);
    text-align: center;
    padding: 40px 20px;
}
#jm-cart-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--jsc-beige-dark);
    fill: none;
    stroke-width: 1.5;
}
#jm-cart-empty p {
    font-size: 14px;
    font-weight: 500;
    color: var(--jsc-muted);
    margin: 0;
}

/* ── Loader ─────────────────────────────────────────────── */
#jm-cart-loader {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(245,239,230,0.75);
    z-index: 10;
    align-items: center;
    justify-content: center;
}
#jm-cart-loader.is-loading { display: flex; }
.jm-cart-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--jsc-beige-dark);
    border-top-color: var(--jsc-green);
    border-radius: 50%;
    animation: jm-spin 0.7s linear infinite;
}
@keyframes jm-spin { to { transform: rotate(360deg); } }

/* ── Item card ──────────────────────────────────────────── */
.jm-cart-item {
    background: var(--jsc-white);
    border-radius: var(--jsc-radius);
    border: 1px solid var(--jsc-beige-dark);
    padding: 12px;
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    animation: jm-fadeIn 0.2s ease both;
}
@keyframes jm-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Thumbnail */
.jm-cart-item-img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--jsc-beige);
    flex-shrink: 0;
}
.jm-cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Contenu */
.jm-cart-item-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Ligne titre + bouton supprimer */
.jm-cart-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}
.jm-cart-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--jsc-text);
    line-height: 1.3;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}
.jm-cart-item-remove {
    width: 22px;
    height: 22px;
    background: var(--jsc-beige-dark);
    border: none;
    border-radius: 50%;
    color: var(--jsc-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}
.jm-cart-item-remove:hover {
    background: #fde8e0;
    color: var(--jsc-orange);
}
.jm-cart-item-remove svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* Prix unitaire */
.jm-cart-item-unit-price {
    font-size: 11px;
    color: var(--jsc-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.jm-cart-item-unit-price .original {
    text-decoration: line-through;
    opacity: 0.7;
}
.jm-cart-item-unit-price .discounted {
    color: var(--jsc-orange);
    font-weight: 700;
}
.jm-cart-item-discount-badge {
    display: inline-flex;
    align-items: center;
    background: #e8f5ec;
    color: #1a5c30;
    border: 1px solid #c3e6cc;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
}

/* Ligne qty + sous-total */
.jm-cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Contrôle qty */
.jm-cart-qty {
    display: flex;
    align-items: center;
    background: var(--jsc-beige);
    border: 1.5px solid var(--jsc-beige-dark);
    border-radius: 8px;
    overflow: hidden;
    height: 32px;
}
.jm-cart-qty-btn {
    width: 30px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--jsc-green);
    font-size: 18px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.jm-cart-qty-btn:active { background: var(--jsc-beige-dark); }
.jm-cart-qty-val {
    min-width: 28px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--jsc-text);
    user-select: none;
}

/* Sous-total ligne */
.jm-cart-item-subtotal {
    font-size: 15px;
    font-weight: 800;
    color: var(--jsc-text);
    white-space: nowrap;
}

/* ── Footer ─────────────────────────────────────────────── */
#jm-cart-footer {
    background: var(--jsc-white);
    border-top: 1px solid var(--jsc-beige-dark);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

/* Récap remises */
#jm-cart-discounts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.jm-cart-discount-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #1a5c30;
    background: #e8f5ec;
    border-radius: 6px;
    padding: 4px 10px;
}
.jm-cart-discount-line span:last-child {
    font-weight: 700;
}

/* Total */
#jm-cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#jm-cart-total-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--jsc-muted);
}
#jm-cart-total-amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--jsc-green);
}

/* Barre de progression */
#jm-cart-progress {
    background: var(--jsc-beige);
    border-radius: 10px;
    padding: 10px 12px;
}
#jm-cart-progress-text {
    font-size: 12px;
    color: var(--jsc-text);
    margin-bottom: 7px;
    line-height: 1.4;
}
#jm-cart-progress-text strong { color: var(--jsc-orange); }
#jm-cart-progress-rail {
    height: 5px;
    background: var(--jsc-beige-dark);
    border-radius: 3px;
    overflow: hidden;
}
#jm-cart-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--jsc-green), var(--jsc-orange));
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

/* CTA */
#jm-cart-cta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.jm-cart-btn {
    width: 100%;
    height: 50px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}
.jm-cart-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.jm-cart-btn--secondary {
    background: transparent;
    color: var(--jsc-green);
    border: 2px solid var(--jsc-green);
    height: 44px;
}
.jm-cart-btn--secondary:hover { background: var(--jsc-beige-dark); }
.jm-cart-btn--primary {
    background: var(--jsc-green);
    color: var(--jsc-white);
    box-shadow: 0 3px 14px rgba(37,70,54,0.28);
}
.jm-cart-btn--primary:hover { background: var(--jsc-green-light); }
.jm-cart-btn--primary:active { transform: scale(0.98); }

