/**
 * SOLVA - Product Cart (WhatsApp quote request)
 */

/* ---------- Header cart button ---------- */
.cart-toggle {
    position: relative;
    width: 44px; height: 44px;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--primary);
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    transition: transform .25s ease, background .25s ease;
    flex: none;
}
.cart-toggle:hover { transform: scale(1.08); background: var(--gray-200); }
.cart-count {
    position: absolute; top: -4px; inset-inline-end: -4px;
    min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px;
    background: #25d366; color: #fff;
    font-size: .7rem; font-weight: 800; line-height: 20px; text-align: center;
    border: 2px solid var(--white);
    direction: ltr; unicode-bidi: isolate;
}
.cart-count[hidden] { display: none; }
body.dark-mode .cart-toggle { background: #1e293b; border-color: rgba(255, 255, 255, .15); color: #e2e8f0; }

/* ---------- Add buttons ---------- */
.cart-add {
    font-family: inherit; cursor: pointer; border: 0;
    transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.cart-add .cart-add-icon-on { display: none; }
.cart-add.is-in-cart .cart-add-icon-on { display: inline; }
.cart-add.is-in-cart .cart-add-icon-off { display: none; }
.cart-add.cart-pop { animation: cartPop .35s ease; }
@keyframes cartPop { 50% { transform: scale(1.18); } }

/* Round button on product cards (sits over the image, next to the card link) */
.product-item { position: relative; }
.cart-add-card {
    position: absolute; z-index: 3;
    /* physical left: the card's brand tag is pinned to the right in both languages */
    top: 12px; left: 12px;
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--primary); color: #fff;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(29, 29, 53, .25);
}
.cart-add-card:hover { transform: scale(1.1); }
.cart-add-card.is-in-cart { background: #16a34a; }
.cart-add-card .cart-add-qty {
    position: absolute; top: -5px; right: -5px;
    min-width: 20px; height: 20px; padding: 0 4px;
    border-radius: 999px; background: #fff; color: #16a34a;
    font-size: .7rem; font-weight: 800; line-height: 18px;
    border: 1px solid #16a34a;
}
.cart-add-card .cart-add-qty:empty { display: none; }
body.dark-mode .cart-add-card:not(.is-in-cart) { color: #040712; }

/* Wide button on the product page */
.cart-add-wide {
    display: inline-flex; align-items: center; justify-content: center; gap: .75rem;
    padding: 1.2rem 2.2rem;
    border-radius: 50px;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 1.1rem; font-weight: 700;
}
.cart-add-wide:hover { background: var(--primary); color: var(--white); transform: translateY(-3px); }
.cart-add-wide.is-in-cart { border-color: #16a34a; color: #16a34a; }
.cart-add-wide.is-in-cart:hover { background: #16a34a; color: #fff; }

/* Product page: WhatsApp + cart side by side, hint on its own row */
.desktop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.desktop-actions .whatsapp-hint { flex-basis: 100%; margin-top: 0 !important; }

/* Card hover lifts the card by 12px: lift the button with it */
@media (min-width: 769px) {
    .product-item:hover .cart-add-card { transform: translateY(-12px); }
    .product-item:hover .cart-add-card:hover { transform: translateY(-12px) scale(1.1); }
}

/* Small round button in the product page's mobile sticky bar */
.cart-add-sticky {
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--gray-100); color: var(--primary);
    border: 1px solid var(--gray-200);
    font-size: 1.1rem; flex: none; position: relative;
}
.cart-add-sticky.is-in-cart { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.cart-add-sticky .cart-add-qty {
    position: absolute; top: -4px; inset-inline-end: -4px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: #16a34a; color: #fff; font-size: .65rem; font-weight: 800; line-height: 18px;
}
.cart-add-sticky .cart-add-qty:empty { display: none; }

/* ---------- Drawer ---------- */
html.cart-lock, html.cart-lock body { overflow: hidden; }

.cart-overlay {
    position: fixed; inset: 0; z-index: 10040;
    background: rgba(4, 7, 18, .55);
    opacity: 0; transition: opacity .3s ease;
}
.cart-overlay.is-open { opacity: 1; }
.cart-overlay[hidden] { display: none; }

.cart-drawer {
    position: fixed; top: 0; bottom: 0; z-index: 10050;
    width: min(420px, 100vw);
    display: flex; flex-direction: column;
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 0 60px rgba(0, 0, 0, .25);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), visibility .3s;
    visibility: hidden;
    outline: none;
}
html[dir="rtl"] .cart-drawer { left: 0; transform: translateX(-105%); }
html[dir="ltr"] .cart-drawer { right: 0; transform: translateX(105%); }
.cart-drawer.is-open { transform: none !important; visibility: visible; }
body.dark-mode .cart-drawer { background: #0b1222; color: #e2e8f0; }

.cart-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}
.cart-head h2 { font-size: 1.2rem; margin: 0; display: flex; align-items: center; gap: .6rem; color: inherit; }
.cart-head-count { font-size: .95rem; color: var(--gray-500); font-weight: 600; }
.cart-close {
    width: 40px; height: 40px; border-radius: 50%;
    border: 0; background: var(--gray-100); color: inherit; cursor: pointer; font-size: 1rem;
}
.cart-close:hover { background: var(--gray-200); }

.cart-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; overscroll-behavior: contain; }

.cart-empty { text-align: center; padding: 3rem 1rem; }
.cart-empty[hidden] { display: none; }
.cart-empty-icon {
    width: 84px; height: 84px; margin: 0 auto 1rem; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem;
    background: var(--gray-100); color: var(--gray-400);
}
.cart-empty h3 { font-size: 1.15rem; margin-bottom: .5rem; color: inherit; }
.cart-empty p { color: var(--gray-500); line-height: 1.8; margin-bottom: 1.25rem; font-size: .95rem; }

.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item {
    display: grid; grid-template-columns: 72px 1fr auto; gap: .85rem; align-items: start;
    padding: .9rem 0;
    border-bottom: 1px solid var(--gray-200);
}
.cart-item-img {
    width: 72px; height: 72px; border-radius: 12px; overflow: hidden;
    background: #fff; border: 1px solid var(--gray-200);
    display: grid; place-items: center;
}
.cart-item-img img { max-width: 90%; max-height: 90%; object-fit: contain; }
.cart-item-info { min-width: 0; }
.cart-item-name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-weight: 700; font-size: .92rem; line-height: 1.55; color: inherit; text-decoration: none;
    overflow-wrap: anywhere;
}
.cart-item-name:hover { text-decoration: underline; }
.cart-item-brand { display: block; font-size: .78rem; color: var(--gray-500); margin-top: .15rem; }
.cart-item-price { display: inline-block; margin-top: .3rem; font-size: .88rem; font-weight: 800; color: #a16207; }
body.dark-mode .cart-item-price { color: #fde68a; }

.cart-qty {
    display: inline-flex; align-items: center; margin-top: .55rem;
    border: 1.5px solid #cbd5e1; border-radius: 10px; overflow: hidden;
}
.cart-qty-btn {
    width: 34px; height: 34px; border: 0; background: var(--gray-50); color: inherit; cursor: pointer; font-size: .8rem;
}
.cart-qty-btn:hover:not(:disabled) { background: var(--gray-200); }
.cart-qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.cart-qty-input {
    width: 44px; height: 34px; border: 0; text-align: center;
    font-family: inherit; font-weight: 700; font-size: .95rem;
    background: #fff; color: #1d1d35;
    -moz-appearance: textfield;
}
.cart-qty-input::-webkit-outer-spin-button, .cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cart-remove {
    width: 36px; height: 36px; border-radius: 10px; border: 0; cursor: pointer;
    background: transparent; color: #dc2626; font-size: .9rem;
}
.cart-remove:hover { background: #fee2e2; }

.cart-form { padding-top: 1rem; display: grid; gap: .4rem; }
.cart-form[hidden] { display: none; }
.cart-form label { font-weight: 700; font-size: .88rem; margin-top: .4rem; }
.cart-input {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid #cbd5e1; border-radius: 12px;
    background: #fff; color: #1d1d35; font-family: inherit; font-size: .95rem;
}
.cart-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 29, 53, .1); }
textarea.cart-input { resize: vertical; min-height: 64px; }

.cart-foot {
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.cart-foot[hidden] { display: none; }
body.dark-mode .cart-foot { background: #070d1b; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: .4rem; }
.cart-summary strong { font-size: 1.3rem; }
.cart-hint { font-size: .8rem; color: var(--gray-500); margin: 0 0 .85rem; display: flex; gap: .4rem; align-items: center; }

.cart-btn {
    width: 100%;
    display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
    padding: 14px 20px; border-radius: 14px; border: 0;
    font-family: inherit; font-weight: 700; font-size: 1.02rem;
    cursor: pointer; text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}
.cart-btn-primary { background: var(--primary); color: var(--white); width: auto; }
.cart-btn-wa { background: #25d366; color: #fff; box-shadow: 0 10px 24px rgba(37, 211, 102, .3); }
.cart-btn-wa:hover:not(:disabled) { transform: translateY(-2px); }
.cart-btn-wa:disabled { opacity: .6; cursor: not-allowed; }
.cart-btn-wa i { font-size: 1.3rem; }
.cart-clear {
    display: block; margin: .7rem auto 0; padding: .3rem .6rem;
    background: none; border: 0; color: var(--gray-500); font-family: inherit; font-size: .85rem; cursor: pointer;
}
.cart-clear:hover { color: #dc2626; }

body.dark-mode .cart-input, body.dark-mode .cart-qty-input { background: #0f172a; color: #e2e8f0; border-color: rgba(255, 255, 255, .18); }
body.dark-mode .cart-qty { border-color: rgba(255, 255, 255, .18); }
body.dark-mode .cart-item-img { background: #fff; }

/* ---------- Toast ---------- */
.cart-toast {
    position: fixed; z-index: 10030;
    bottom: 24px; left: 50%;
    transform: translate(-50%, 20px);
    display: flex; align-items: center; gap: .75rem;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: .75rem .9rem .75rem 1.1rem;
    border-radius: 14px;
    background: #1d1d35; color: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
    opacity: 0; transition: opacity .25s ease, transform .25s ease;
    font-weight: 600; font-size: .92rem;
}
.cart-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.cart-toast[hidden] { display: none; }
.cart-toast > i { color: #4ade80; }
.cart-toast.is-warn > i { color: #fbbf24; }
.cart-toast button {
    border: 0; border-radius: 10px; padding: .45rem .8rem;
    background: rgba(255, 255, 255, .15); color: #fff;
    font-family: inherit; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.cart-toast button:hover { background: rgba(255, 255, 255, .25); }

@media (max-width: 768px) {
    /* Product page bottom bar: the page uses .d-flex but no utility CSS defines it,
       so the bar used to stack. One row: price | cart | order */
    .mobile-sticky-action .d-flex { display: flex; align-items: center; gap: .6rem; }
    .mobile-sticky-action .sticky-price { flex: 0 1 auto; min-width: 0; }
    .mobile-sticky-action .btn-sticky-order { margin-inline-start: 0; flex: 1 1 auto; white-space: nowrap; }
    .cart-add-card { width: 38px; height: 38px; top: 8px; left: 8px; font-size: .9rem; }
    /* keep the toast above the product page's sticky order bar */
    .cart-toast { bottom: 96px; }
}
@media (max-width: 380px) {
    .header-actions { gap: .5rem; }
}

/* ---------- Product page: catalog / datasheet card ---------- */
.product-catalog {
    display: flex; align-items: center; gap: .9rem;
    margin: 0 0 1.5rem; padding: .9rem 1rem;
    border-radius: 16px;
    background: #fff;
    border: 1.5px solid #fecaca;
    box-shadow: 0 6px 18px rgba(220, 38, 38, .08);
    color: #1d1d35; text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.product-catalog:hover { transform: translateY(-2px); border-color: #dc2626; box-shadow: 0 12px 26px rgba(220, 38, 38, .14); color: #1d1d35; }
.product-catalog .pc-ico {
    width: 48px; height: 48px; flex: none; border-radius: 12px;
    display: grid; place-items: center;
    background: #fee2e2; color: #dc2626; font-size: 1.35rem;
}
.product-catalog .pc-text { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.product-catalog .pc-text strong { font-size: 1rem; }
.product-catalog .pc-text small { color: #64748b; font-size: .82rem; line-height: 1.6; }
.product-catalog .pc-go {
    width: 38px; height: 38px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    background: #dc2626; color: #fff; font-size: .9rem;
}
body.dark-mode .product-catalog { background: #0b1222; border-color: rgba(248, 113, 113, .35); color: #e2e8f0; }
body.dark-mode .product-catalog .pc-ico { background: rgba(220, 38, 38, .18); }
body.dark-mode .product-catalog .pc-text small { color: #94a3b8; }

/* =====================================================
   Minimal direction (design-system/solva/MASTER.md)
   ===================================================== */
.cart-toggle { box-shadow: none; }
.cart-toggle:hover { transform: none; }
.cart-add-card { box-shadow: 0 1px 3px rgba(15, 23, 42, .2); }
.cart-add-card:hover, .product-item:hover .cart-add-card, .product-item:hover .cart-add-card:hover { transform: none; }
.cart-add.cart-pop { animation: none; }
.cart-add-wide { border-radius: 8px; border-width: 1px; height: 52px; padding: 0 1.5rem; font-size: 1rem; }
.cart-add-wide:hover { transform: none; }
.cart-add-sticky { border-radius: 8px; }
.cart-drawer { box-shadow: 0 0 40px rgba(15, 23, 42, .2); }
.cart-head h2 i, .cart-empty-icon { display: none; }
.cart-close, .cart-remove, .cart-qty-btn { border-radius: 8px; }
.cart-item-img { border-radius: 8px; }
.cart-qty { border-radius: 8px; border-width: 1px; }
.cart-input { border-radius: 8px; border-width: 1px; }
.cart-btn { border-radius: 8px; height: 46px; padding: 0 1rem; }
.cart-btn-wa { background: #1fa855; box-shadow: none; }
.cart-btn-wa:hover:not(:disabled) { transform: none; background: #188a46; }
.cart-hint i { display: none; }
.cart-item-price { color: #0f172a; }
body.dark-mode .cart-item-price { color: #e2e8f0; }
.cart-toast { border-radius: 8px; }
.cart-toast > i { display: none; }

.product-catalog {
    border-radius: 10px; border: 1px solid #e3e6ec; box-shadow: none; padding: .85rem 1rem;
}
.product-catalog:hover { transform: none; box-shadow: none; border-color: #c9ced8; }
.product-catalog .pc-ico { width: auto; height: auto; padding: .3rem .5rem; border-radius: 6px; background: #fef2f2; font-size: 1.1rem; }
.product-catalog .pc-go { width: auto; height: auto; background: none; color: #0f172a; font-size: .95rem; }
.product-catalog .pc-text strong { color: #0f172a; }
body.dark-mode .product-catalog .pc-text strong, body.dark-mode .product-catalog .pc-go { color: #e2e8f0; }

/* ---------- Motion helpers (assets/js/motion.js) ---------- */
.mo-mask { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.mo-word { display: inline-block; will-change: transform; }
