/* Flavor Cart — live update enhancements */

/* ─────────────────────────────────────────────────────────────────────
 * .screen-reader-text — visually hidden (WP standard a11y pattern)
 * Fix 2026-04-24: WC emite <span class="screen-reader-text">Prețul
 * inițial a fost:</span> în markup preț sale. Fără această regulă,
 * textul apare inline în product cards.
 * Deplasat aici din main.css pentru deploy rapid via plugin.
 * ───────────────────────────────────────────────────────────────────── */
.screen-reader-text,
.screen-reader-text span {
    border: 0 !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    -webkit-clip-path: inset(50%) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    width: 1px !important;
    word-wrap: normal !important;
    white-space: nowrap !important;
}
.screen-reader-text:focus {
    background-color: #eee;
    clip: auto !important;
    -webkit-clip-path: none !important;
    clip-path: none !important;
    color: #444;
    display: block;
    font-size: 1em;
    height: auto !important;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto !important;
    z-index: 100000;
}


/* ═══════════════════════════════════════════════════════════════
   DESIGN #23 — user choice 2026-04-24
   Layout: container bordered teal, butoane SOLID teal filled
   stacked right (+ sus / − jos), chevron alb SVG.
   Input ocupă tot spațiul cu padding-right rezervat pentru stepper.

   Aplicat pe:
     - .cart-item__qty        → pagina coș (cart-item wrapper custom)
     - .pdp-atc .quantity     → PDP single-product
     - form.cart .quantity    → PDP default WC (fallback dacă tema schimbă)
     - .flavor-qty-wrap       → oriunde aplicat manual (extensibilitate)
   ═══════════════════════════════════════════════════════════════ */

/* ──────── CONTAINER ──────── */
.cart-item__qty,
.pdp-atc .quantity,
form.cart .quantity,
.flavor-qty-wrap {
    display: flex !important;
    position: relative;
    align-items: stretch;
    width: 78px !important;
    height: 44px;
    border: 1px solid var(--color-primary, #186e68) !important;
    border-radius: 6px;
    overflow: hidden;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    vertical-align: middle;
}
/* Pe cart ușor mai compact pentru a încăpea pe row dense */
.cart-item__qty {
    width: 72px !important;
    height: 42px;
}
/* Pe cart, interior `.quantity` wrapper WC e neutralized — nu styling propriu */
.cart-item__qty > .quantity {
    display: contents;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    background: transparent !important;
    border: 0 !important;
}

/* ──────── INPUT ──────── */
.cart-item__qty input.qty,
.pdp-atc .quantity input.qty,
.pdp-atc .quantity input[type="number"],
form.cart .quantity input.qty,
form.cart .quantity input[type="number"],
.flavor-qty-wrap input.qty,
.flavor-qty-wrap input[type="number"] {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    border: 0 !important;
    padding: 0 32px 0 6px !important;
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums;
    text-align: center !important;
    background: transparent !important;
    color: var(--color-neutral-900, #0f172a) !important;
    box-sizing: border-box !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    transition: background 0.15s ease;
}
.cart-item__qty input.qty:focus,
.pdp-atc .quantity input.qty:focus,
.pdp-atc .quantity input[type="number"]:focus,
form.cart .quantity input.qty:focus,
.flavor-qty-wrap input.qty:focus,
.flavor-qty-wrap input[type="number"]:focus {
    outline: none !important;
    background: var(--color-primary-lighter, #e6f0ef) !important;
    box-shadow: none !important;
    border: 0 !important;
}
.cart-item__qty input.qty::-webkit-inner-spin-button,
.cart-item__qty input.qty::-webkit-outer-spin-button,
.pdp-atc .quantity input::-webkit-inner-spin-button,
.pdp-atc .quantity input::-webkit-outer-spin-button,
form.cart .quantity input::-webkit-inner-spin-button,
form.cart .quantity input::-webkit-outer-spin-button,
.flavor-qty-wrap input::-webkit-inner-spin-button,
.flavor-qty-wrap input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    display: none;
}

/* ──────── STEPPER WRAPPER ──────── */
.flavor-qty-stepper {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    display: flex;
    flex-direction: column;
    z-index: 2;
    pointer-events: none; /* children re-enable */
}
.cart-item__qty .flavor-qty-stepper {
    width: 28px; /* more compact pe cart */
}

/* ──────── BUTOANE stepper ────────
   Solid teal filled cu chevron alb.
   Plus sus (flavor-qty-plus) cu separator subtil pe border-bottom.
   Minus jos (flavor-qty-minus) — fără border-bottom. */
.flavor-qty-btn {
    appearance: none;
    -webkit-appearance: none;
    pointer-events: auto;
    flex: 1 1 50%;
    width: 100%;
    min-width: 0;
    height: auto;
    border: 0;
    background: var(--color-primary, #186e68);
    color: #fff;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.15s ease;
}
.flavor-qty-plus {
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.flavor-qty-btn:hover {
    background: #135850;
}
.flavor-qty-btn:active {
    background: #0e433d;
}
.flavor-qty-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
}
.flavor-qty-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.flavor-qty-btn:disabled:hover {
    background: var(--color-primary, #186e68);
}
.flavor-qty-btn svg {
    display: block;
    flex-shrink: 0;
}

/* ──────── Product-card footer: qty + ATC side-by-side ──────── */
/* On category / homepage cards, qty stepper shares row with ATC button.
   COMPACT override pe product cards (user feedback 2026-04-24):
   qty ~48px (60% din design default 78px), stepper 20px, font 13px —
   lasă spațiu maxim pentru butonul ATC să încapă "Adaugă în coș".
   NU afectează cart page (.cart-item__qty) sau PDP (.pdp-atc .quantity). */
.product-card__qty-atc {
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: 100%;
}
.product-card__qty-atc > .flavor-qty-wrap,
.product-card__qty-atc > .quantity {
    flex: 0 0 auto;
}
.product-card__qty-atc > .product-card__atc {
    flex: 1 1 auto;
    margin: 0;
    padding: 0 8px;
    min-width: 0; /* permits text truncation instead of overflow */
}

/* COMPACT pe product card — override selectiv al defaults de sus */
/* Wrap 56px (era 48): adăugat 8px pentru stepper 24px să încapă butoanele */
.product-card__qty-atc .flavor-qty-wrap,
.product-card__qty-atc > .quantity {
    width: 56px !important;
    height: 40px;
    overflow: hidden !important; /* safety: clip orice ar depăși */
}
.product-card__qty-atc .flavor-qty-wrap .flavor-qty-stepper,
.product-card__qty-atc > .quantity .flavor-qty-stepper {
    width: 24px;
    overflow: hidden;
}
.product-card__qty-atc .flavor-qty-wrap input.qty,
.product-card__qty-atc .flavor-qty-wrap input[type="number"],
.product-card__qty-atc > .quantity input.qty,
.product-card__qty-atc > .quantity input[type="number"] {
    padding: 0 26px 0 4px !important;
    font-size: 13px !important;
}
/* FIX #1: butoanele ereditau min-width: 36px din UA stylesheet.
   Forțez width strict al stepper-ului (24px) + min-width:0 ca să nu mai
   crească. Afișau jumătate de săgeată user feedback 2026-04-24.
   Și overflow:hidden ca safety dacă SVG/conținut încearcă să depășească. */
.product-card__qty-atc .flavor-qty-btn {
    width: 24px !important;
    min-width: 0 !important;
    max-width: 24px !important;
    flex: 1 1 50% !important;
    padding: 0 !important;
    overflow: hidden;
}
.product-card__qty-atc .flavor-qty-btn svg {
    max-width: 100%;
    max-height: 100%;
}
/* ATC text: fallback la truncare elegantă dacă nu încape oricum.
   Icon-ul rămâne vizibil; pe card foarte îngust, doar iconul + "Adaugă". */
.product-card__qty-atc > .product-card__atc {
    font-size: 13px;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-card__qty-atc > .product-card__atc svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* --- Forced qty banner: full-row width BELOW the cart item ------------ */
/* The theme already renders each cart item as CSS grid with 3 columns
   (img | info | actions). We project the banner as a new grid row spanning
   all columns so it reads as a clear explanatory line. */
.cart-item .flavor-cart__forced-qty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.6em;
    padding: 0.55em 0.85em;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 3px solid #dc2626;
    border-radius: var(--radius-sm, 4px);
    font-size: var(--text-xs, 0.82em);
    line-height: 1.4;
}
.cart-item .flavor-cart__forced-qty::before {
    content: '';
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}
.cart-item .flavor-cart__forced-qty s {
    color: #dc2626;
    font-weight: 600;
    margin: 0 0.15em;
}
.cart-item .flavor-cart__forced-qty strong {
    color: #7f1d1d;
}

/* --- Loading + removed states ------------------------------------------ */
.cart-item.is-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.cart-item.is-loading::after {
    content: '';
    position: absolute;
    right: 0.7em;
    top: 0.7em;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-neutral-200, #cbd5e1);
    border-top-color: var(--color-primary, #2563eb);
    border-radius: 50%;
    animation: flavor-cart-spin 0.75s linear infinite;
}
@keyframes flavor-cart-spin { to { transform: rotate(360deg); } }

.cart-item.is-removed {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* --- Inline row notice ------------------------------------------------- */
.flavor-cart__notice {
    grid-column: 1 / -1;
    margin-top: 0.5em;
    padding: 0.45em 0.75em;
    border-radius: var(--radius-sm, 4px);
    font-size: var(--text-xs, 0.85em);
    line-height: 1.4;
}
.flavor-cart__notice--warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.flavor-cart__notice--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flavor-cart__notice--info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* --- Delete button ("Șterge") — override WC's .remove circle ---------- */
/* WC core styles `.remove` as a small circular × with background on hover.
   Combined with our `.cart-item__remove { font-size: xs }` we get a tiny
   circle clipping the text. Reset to a plain text link whose whole
   surface changes color on hover. */
.cart-item__remove.remove,
.cart-item__remove {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    width: auto !important;
    height: auto !important;
    padding: 0.15em 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: var(--text-xs, 0.78rem) !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    color: var(--color-neutral-600, #64748b) !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.cart-item__remove.remove:hover,
.cart-item__remove:hover,
.cart-item__remove.remove:focus,
.cart-item__remove:focus {
    background: transparent !important;
    color: var(--color-error, #dc2626) !important;
    text-decoration: underline !important;
    text-decoration-color: currentColor !important;
    text-decoration-thickness: 1.5px !important;
}
.cart-item__remove.remove:focus-visible,
.cart-item__remove:focus-visible {
    outline: 2px solid var(--color-primary, #2563eb);
    outline-offset: 2px;
    border-radius: 2px;
}
