/* ════════════════════════════════════════
   CraftCart v2.0.0
════════════════════════════════════════ */
:root {
    --cc-bg:        #1a1b1e;
    --cc-surface:   #25262b;
    --cc-border:    #2c2d32;
    --cc-text:      #e8e9ec;
    --cc-muted:     #868e96;
    --cc-accent:    #f97316;
    --cc-red:       #ef4444;
    --cc-cta:       #3f9cff;
    --cc-badge:     #ef4444;
    --cc-btn-g1:    #f43f96;
    --cc-btn-g2:    #f97316;
    --cc-btn-count: #ef4444;
    --cc-w:         420px;
}

/* ── Shortcode bouton ── */
.craftcart-open-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 6px; background: none; border: none; cursor: pointer;
    color: #111; transition: opacity .2s;
}
.craftcart-open-btn svg { width: 26px; height: 26px; stroke: currentColor; }
.craftcart-open-btn:hover { opacity: .7; }
.craftcart-btn-label { font-size: 14px; font-weight: 700; }
.craftcart-btn-badge {
    position: absolute; top: -2px; right: -6px;
    background: var(--cc-btn-count); color: #fff;
    font-size: 11px; font-weight: 800; min-width: 20px; height: 20px;
    border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px; line-height: 1; border: 2px solid #fff;
}

/* ── Drawer ── */
#craftcart-drawer {
    position: absolute; top: 0; right: 0; height: 100%; width: var(--cc-w); max-width: 100vw;
    display: flex; flex-direction: column;
    background: var(--cc-bg); color: var(--cc-text);
    font-family: "Segoe UI", system-ui, sans-serif;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

/* ── Header ── */
.craftcart-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; border-bottom: 1px solid var(--cc-border); flex-shrink: 0;
}
.craftcart-header__title { font-size: 16px; font-weight: 700; margin: 0; color: var(--cc-text); }
.craftcart-header-count  { color: var(--cc-muted); font-weight: 400; margin-left: 3px; }
.craftcart-close-btn {
    background: var(--cc-surface); border: 1px solid var(--cc-border);
    border-radius: 8px; color: var(--cc-muted); width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 14px; transition: color .2s; padding: 0;
}
.craftcart-close-btn:hover { color: var(--cc-text); }

/* ── Body ── */
.craftcart-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.craftcart-items { padding: 16px 20px; flex-shrink: 0; }

/* ── Loader ── */
.craftcart-loading {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 40px 0; color: var(--cc-muted); font-size: 13px;
}
.craftcart-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--cc-border); border-top-color: var(--cc-accent);
    border-radius: 50%; animation: craftcart-spin .7s linear infinite;
}
@keyframes craftcart-spin { to { transform: rotate(360deg); } }

/* ── Empty ── */
.craftcart-empty {
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 40px 20px; color: var(--cc-muted); font-size: 14px; text-align: center;
}
.craftcart-shop-btn {
    display: inline-block; margin-top: 8px; padding: 10px 24px;
    background: var(--cc-accent); color: #fff; border-radius: 30px;
    text-decoration: none; font-size: 13px; font-weight: 700;
    transition: opacity .2s;
}
.craftcart-shop-btn:hover { opacity: .85; }

/* ── Item ── */
.craftcart-item {
    display: flex; align-items: stretch; gap: 12px; padding: 12px;
    background: var(--cc-surface); border: 1px solid var(--cc-border);
    border-radius: 12px; margin-bottom: 10px;
}
.craftcart-item__img { position: relative; flex-shrink: 0; text-decoration: none; }
.craftcart-item__img img { width: 120px; height: 76px; object-fit: cover; border-radius: 8px; display: block; transition: opacity .2s; }
.craftcart-item__img:hover img { opacity: .85; }
.craftcart-item__name-link { text-decoration: none; }
.craftcart-item__name-link:hover .craftcart-item__name { text-decoration: underline; }
.craftcart-item__content { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.craftcart-item__name {
    font-size: 13px; font-weight: 600; color: var(--cc-text); line-height: 1.4; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.craftcart-item__variation { font-size: 11px; color: var(--cc-muted); }

/* 25002500 Champs personnalis00e9s dans le panier 25002500 */
.craftcart-item__meta { display:flex; flex-direction:column; gap:3px; margin-top:2px; }
.craftcart-item__meta-row { display:flex; align-items:flex-start; gap:5px; font-size:11px; line-height:1.5; margin-bottom:2px; flex-wrap:nowrap; }
.craftcart-item__meta-key { color:var(--cc-muted); font-weight:600; flex-shrink:0; white-space:nowrap; }
.craftcart-item__meta-key::after { content:" :"; }
.craftcart-item__meta-val { color:var(--cc-text); font-weight:600; word-break:break-word; overflow-wrap:anywhere; min-width:0; flex:1; }
.craftcart-item__custom-fields { background:var(--cc-border); border-radius:6px; padding:6px 10px; margin-top:6px; margin-bottom:4px; overflow:hidden; }
.craftcart-item__qty--fixed { pointer-events:none; opacity:.6; justify-content:flex-start; }
.craftcart-item__qty { display: flex; align-items: center; }
.craftcart-qty-btn {
    width: 28px; height: 28px; border: 1px solid #d1d5db; background: #fff; color: #374151;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; cursor: pointer; padding: 0;
}
.craftcart-qty-btn:first-child { border-radius: 50px 0 0 50px; border-right: none; }
.craftcart-qty-btn:last-child  { border-radius: 0 50px 50px 0; border-left:  none; }
.craftcart-qty-btn:hover { background: #f3f4f6; }
.craftcart-qty-val {
    width: 30px; height: 28px; text-align: center; line-height: 28px;
    font-size: 13px; font-weight: 600; color: #111;
    border-top: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db; background: #fff;
}
.craftcart-item__right {
    flex-shrink: 0; display: flex; flex-direction: column;
    align-items: flex-end; justify-content: space-between; align-self: stretch;
}
.craftcart-item__remove {
    color: var(--cc-muted); cursor: pointer; background: none; border: none; padding: 0;
    display: flex; align-items: center; transition: color .2s;
}
.craftcart-item__remove svg { width: 20px; height: 20px; }
.craftcart-item__remove:hover { color: var(--cc-red); }
.craftcart-item__price { font-size: 15px; font-weight: 700; color: var(--cc-text); white-space: nowrap; }

/* ── Badge réduction ── */
.craftcart-badge {
    position: absolute; bottom: 5px; left: 5px;
    background: var(--cc-badge); color: #fff;
    font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; line-height: 1.4;
}
.craftcart-badge--sm { font-size: 10px; padding: 2px 6px; bottom: 4px; left: 4px; }

/* ── Upsells ── */
.craftcart-upsells { background: #eeeeee; padding: 14px 20px; border-top: 1px solid var(--cc-border); flex: 1; }
.craftcart-upsells__title { font-size: 14px; font-weight: 700; color: #111; margin: 0 0 12px; }
.craftcart-upsells__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.craftcart-upsells__item { display: flex; align-items: center; gap: 12px; }
.craftcart-upsells__img { position: relative; flex-shrink: 0; }
.craftcart-upsells__img img { width: 100px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.craftcart-upsells__info { flex: 1; min-width: 0; }
.craftcart-upsells__name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 13px; font-weight: 600; color: #111; line-height: 1.35; margin: 0 0 4px;
}
.craftcart-upsells__price { font-size: 14px; font-weight: 700; color: #111; margin: 0; }
.craftcart-upsells__add {
    flex-shrink: 0; width: 44px; height: 44px; border: 1.5px solid #c5c5c5; border-radius: 10px;
    background: #fff; color: #555; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .2s; text-decoration: none; font-size: 18px;
}
.craftcart-upsells__add:hover { border-color: #999; color: #111; }

/* ── Footer ── */
#craftcart-footer { flex-shrink: 0; }
.craftcart-footer { padding: 14px 20px 18px; border-top: 1px solid var(--cc-border); background: var(--cc-bg); }

/* Coupon accordéon */
.craftcart-coupon { border-top: 1px solid var(--cc-border); margin-bottom: 0; }
.craftcart-coupon-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; cursor: pointer; color: var(--cc-muted); font-size: 13px; font-weight: 500;
    background: none; border: none; width: 100%; text-align: left;
}
.craftcart-coupon-toggle:hover { color: var(--cc-text); }
.craftcart-coupon-arrow { font-size: 9px; transition: transform .25s; flex-shrink: 0; }
.craftcart-coupon-toggle.open .craftcart-coupon-arrow { transform: rotate(180deg); }
.craftcart-coupon-body { display: none; padding-bottom: 12px; }
.craftcart-coupon-body.open { display: block; }
.craftcart-coupon-row { display: flex; border: 1px solid var(--cc-border); border-radius: 8px; overflow: hidden; }
.craftcart-coupon-input {
    flex: 1; padding: 10px 12px; border: none; outline: none;
    background: var(--cc-surface); color: var(--cc-text); font-size: 13px;
}
.craftcart-coupon-input::placeholder { color: var(--cc-muted); }
.craftcart-coupon-btn {
    padding: 10px 16px; background: #3f9cff; border: none;
    color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: opacity .2s; white-space: nowrap;
}
.craftcart-coupon-btn:hover { opacity: .85; }
.craftcart-coupons-applied { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.craftcart-coupon-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.3);
    color: #22c55e; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700;
}
.craftcart-coupon-remove { background: none; border: none; cursor: pointer; color: #22c55e; font-size: 13px; padding: 0; }
.craftcart-coupon-msg { font-size: 12px; margin-top: 8px; min-height: 16px; }
.craftcart-coupon-msg--ok  { color: #22c55e; }
.craftcart-coupon-msg--err { color: var(--cc-red); }


/* Totaux */
.craftcart-footer__totals { margin-bottom: 10px; }
.craftcart-footer__row { display: flex; justify-content: space-between; font-size: 12px; color: var(--cc-muted); margin-bottom: 4px; }
.craftcart-footer__row--discount { color: #22c55e; }
.craftcart-footer__total-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.craftcart-footer__label { font-size: 13px; color: var(--cc-muted); }
.craftcart-footer__price { font-size: 28px; font-weight: 800; color: var(--cc-text); letter-spacing: -.5px; }

/* Bouton Continuer */
.craftcart-footer__cta {
    display: flex; align-items: center; justify-content: center;
    padding: 15px; background: var(--cc-cta); position: relative;
    color: #fff !important; font-size: 13px; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase; text-decoration: none;
    border-radius: 30px; border: none; cursor: pointer;
    transition: opacity .2s, transform .2s; min-height: 50px;
}
.craftcart-footer__cta:hover { opacity: .9; transform: translateY(-1px); }
.craftcart-cta-text { transition: opacity .2s; }
.craftcart-cta-spinner {
    display: none;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: craftcart-spin .65s linear infinite;
}

/* ── Scrollbar ── */
.craftcart-body::-webkit-scrollbar { width: 4px; }
.craftcart-body::-webkit-scrollbar-thumb { background: var(--cc-border); border-radius: 4px; }

@media (max-width: 480px) { :root { --cc-w: 100vw; } }

.craftcart-upsells__img { position: relative; flex-shrink: 0; text-decoration: none; }
.craftcart-upsells__img:hover img { opacity: .85; }
.craftcart-upsells__name-link { text-decoration: none; }
.craftcart-upsells__name-link:hover .craftcart-upsells__name { text-decoration: underline; }

/* ── Message erreur sous le formulaire ── */
.craftcart-msg-error {
    display: block;
    width: 100%;
    background: rgba(239,68,68,.1);
    border: 1.5px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px;
    margin-top: 12px;
    line-height: 1.5;
    box-sizing: border-box;
    animation: craftcart-fadein .2s ease;
}
@keyframes craftcart-fadein {
    from { opacity:0; transform:translateY(-4px); }
    to   { opacity:1; transform:translateY(0); }
}
