/* ============================================================
   cart-popup.css — unified cart item layout (Stilla / saved-designs
   language), shared by every cart app (book, frame, canvas, acrylic,
   card, calendar, student). Loaded AFTER each product css so these
   rules win the cascade.

   Convention: c-* classes carry the presentation. JS hooks are left
   untouched in the markup — code_* classes, data-* attributes, element
   ids, and the few presentation classes that JS reads as live selectors
   (.cart_item_price, .cart_item_quantity, the uni_selected state class,
   and frame's .cart_glass/.cart_surface/.cart_effect).
   ============================================================ */
:root {
    --qx-orange: #f58a00; --qx-orange-deeper: #d97900;
    --qx-orange-tint: #fff4e6; --qx-orange-tint-2: #fde9cf; --qx-orange-text: #a85f00;
    --qx-ink: #161513; --qx-ink-2: #46433f; --qx-muted: #675f54; --qx-muted-2: #7a7164;
    --qx-line: #e4e1db; --qx-line-soft: #efece6; --qx-surface: #f5f3ef; --qx-surface-2: #faf8f4;
    --qx-tap: 44px;
    --bw-pri: #1b1a18; --bw-pri-deep: #000; --bw-state-bg: #f0eeea; --bw-state-line: #d8d4cd;
}

/* list + item card */
#code_target_cart { display: flex; flex-direction: column; gap: 10px; }
.c-row { border: 1px solid var(--qx-line); border-radius: 14px; background: #fff; padding: 12px;
         display: flex; flex-direction: column; gap: 12px; overflow: visible; }
.c-row + .c-row { margin-top: 0; }
.c-row__main { display: flex; align-items: flex-start; gap: 12px; }
.c-thumb-link { display: block; flex-shrink: 0; line-height: 0; }
.c-thumb { width: 64px; height: 74px; border-radius: 6px; flex-shrink: 0; object-fit: contain;
           background: var(--qx-surface-2); border: 1px solid var(--qx-line-soft); display: block; }
.c-info { flex: 1; min-width: 0; }
.c-name { font-weight: 700; font-size: 1.08rem; color: var(--qx-ink); margin: 0;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; }
.c-sub { font-size: 0.88rem; color: var(--qx-muted); margin-top: 3px; }
.c-sub .sep { color: #cdc7be; margin: 0 6px; }

/* buttons (cart-scoped, self-contained) */
.c-btn { font-family: "Afacad", sans-serif; font-weight: 700; font-size: 0.98rem; cursor: pointer;
         border-radius: 11px; min-height: var(--qx-tap); padding: 0 16px; border: 1.5px solid transparent;
         display: inline-flex; align-items: center; justify-content: center; gap: 8px;
         transition: background .15s, border-color .15s, color .15s; }
.c-btn svg { width: 18px; height: 18px; }
.c-btn--pri { background: var(--bw-pri); color: #fff; border-color: var(--bw-pri-deep); }
.c-btn--ghost { background: #fff; border-color: var(--qx-line); color: var(--qx-ink); }
.c-btn--danger { background: var(--qx-surface); border-color: var(--qx-line-soft); color: var(--qx-ink-2); }
.c-btn--block { width: 100%; }
.c-iconbtn { flex: 0 0 var(--qx-tap); width: var(--qx-tap); height: var(--qx-tap); padding: 0;
             text-decoration: none; color: var(--qx-ink-2); }
.c-iconbtn svg { width: 19px; height: 19px; }
/* no default blue focus ring on any cart control; subtle ink ring for keyboard only */
.c-btn:focus, .popup_cart_control .cart_svg_button:focus,
.c-seg button:focus, .c-qty button:focus { outline: none; }
.c-btn:focus-visible, .popup_cart_control .cart_svg_button:focus-visible,
.c-seg button:focus-visible, .c-qty button:focus-visible {
    outline: 2px solid var(--qx-ink-2); outline-offset: 2px; }

/* options block */
.c-opts { display: flex; flex-direction: column; gap: 10px; margin: 0;
          border-top: 1px solid var(--qx-line-soft); padding-top: 12px; }
.c-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.c-opt__label { font-size: 0.94rem; color: var(--qx-ink-2); font-weight: 600;
                text-transform: none; letter-spacing: 0; width: auto; min-width: 0; }

/* segmented toggle (two-button Yta) — keeps code_select_surface buttons + uni_selected state */
.c-seg { display: inline-flex; background: var(--qx-surface); border-radius: 10px; padding: 3px; gap: 2px; }
.c-seg button { border: none; background: transparent; font: 600 0.9rem "Afacad", sans-serif;
                color: var(--qx-muted); padding: 0 16px; height: 34px; border-radius: 8px; cursor: pointer; box-shadow: none; }
.c-seg button.uni_selected, .c-seg button.is-on {
                background: var(--bw-pri); color: #fff; font-weight: 700; box-shadow: none; }

/* switch (Effekt checkbox) */
.c-switch-wrap { position: relative; display: inline-flex; align-items: center; }
.c-switch-wrap input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.c-switch { width: 44px; height: 26px; border-radius: 999px; background: var(--qx-line);
            position: relative; transition: background .15s; cursor: pointer; display: inline-block; }
.c-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
            border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.c-switch-wrap input:checked + .c-switch { background: var(--bw-pri); }
.c-switch-wrap input:checked + .c-switch::after { left: 21px; }

/* select (multi-option dropdowns: Glas/Yta/Montering/Upphängning/Effekt) */
.c-select { appearance: none; -webkit-appearance: none; font: 600 0.92rem "Afacad", sans-serif;
            color: var(--qx-ink); border: 1.5px solid var(--qx-line); border-radius: 10px;
            min-height: 40px; padding: 0 36px 0 14px; cursor: pointer; max-width: 64%;
            background: var(--qx-surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23675f54' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center; }
.c-select:focus { border-color: var(--qx-ink); outline: none; background-color: #fff; }
/* align multi-option selects to one width: fixed label column, selects fill the
   rest equally. min-width:0 lets the select shrink to the popup instead of
   overflowing on long option text. */
.c-opt:has(.c-select) { gap: 12px; }
.c-opt:has(.c-select) .c-opt__label { flex: 0 0 96px; }
.c-opt:has(.c-select) .c-select { flex: 1 1 0; min-width: 0; max-width: none; }

/* footer: quantity stepper + line total */
.c-row__foot { display: flex; align-items: center; justify-content: space-between; margin: 0;
               border-top: 1px solid var(--qx-line-soft); padding-top: 12px; }
.c-qty { display: inline-flex; align-items: center; border: 1.5px solid var(--qx-line);
         border-radius: 11px; overflow: hidden; }
.c-qty button { width: 40px; height: 40px; border: none; background: #fff; color: var(--qx-ink);
                font-size: 1.2rem; line-height: 1; cursor: pointer; font-family: inherit; border-radius: 0;
                display: flex; align-items: center; justify-content: center; }
.c-qty button:active { background: var(--qx-surface); }
.c-qty > span, .c-qty .val { min-width: 36px; text-align: center; font-weight: 700; font-size: 1rem; color: var(--qx-ink); }
.c-qty input { width: 46px; height: 40px; border: none; text-align: center; font-weight: 700;
               font-size: 1rem; color: var(--qx-ink); font-family: inherit; background: #fff; padding: 0; }
.c-linetotal { font-weight: 700; font-size: 1.08rem; color: var(--qx-ink); text-align: right; }

/* dual quantity (card: Kort + Kuvert) stacked rows */
.c-row__foot--stack { flex-direction: column; align-items: stretch; gap: 12px; }
.c-qtys { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.c-qtyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.c-qtyrow__label { font-size: 0.9rem; color: var(--qx-ink-2); font-weight: 600; }
.c-qtytotal { display: flex; align-items: center; justify-content: space-between; }

/* alert (frame oversized / student double-sided) */
.cart_alert, .c-alert { display: flex; flex-direction: column; gap: 2px; background: var(--qx-orange-tint);
            border: 1px solid var(--qx-orange-tint-2); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; }
.cart_alert strong, .c-alert strong { color: var(--qx-orange-text); font-size: 0.9rem; }
.cart_alert span, .c-alert span { color: var(--qx-ink-2); font-size: 0.82rem; }

/* empty state */
.cart_empty { padding: 18px 10px; color: var(--qx-muted); text-align: center; }

/* shared cart confirm modal (window.cartConfirm) */
.c-confirm-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .32); z-index: 400;
    display: flex; align-items: center; justify-content: center; padding: 20px; }
.c-confirm { background: #fff; border: 1px solid #e2e2e2; border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .22); padding: 18px; width: 300px; max-width: calc(100vw - 40px); }
.c-confirm__msg { font-size: 1.02rem; color: var(--qx-ink); line-height: 1.4; margin-bottom: 16px; }
.c-confirm__row { display: flex; gap: 10px; }
.c-confirm__row .c-btn { flex: 1; }

/* top action bar (Lägg till i kundvagn / Till kassan) restyled in place.
   The checkout link carries href; the add button does not — so we colour
   by that: checkout = primary (dark), add = ghost. */
.popup_cart_control { display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 12px; }
.popup_cart_control .cart_svg_button { width: 100%; display: inline-flex; align-items: center; justify-content: center;
            gap: 8px; min-height: var(--qx-tap); border-radius: 11px; text-decoration: none;
            font-family: "Afacad", sans-serif; font-weight: 700; font-size: 0.98rem;
            border: 1.5px solid var(--qx-line); background: #fff; color: var(--qx-ink); }
/* the legacy heavy fill-icons clash with the line aesthetic (and vanish on the
   dark button) — drop them; the labels carry the meaning. */
.popup_cart_control .cart_svg_button svg { display: none; }
.popup_cart_control .cart_svg_button div { font-size: 0.98rem; }
.popup_cart_control .cart_svg_button,
.popup_cart_control .cart_svg_button div { color: var(--qx-ink); }
.popup_cart_control a.cart_svg_button[href] { background: var(--bw-pri); border-color: var(--bw-pri-deep); }
.popup_cart_control a.cart_svg_button[href],
.popup_cart_control a.cart_svg_button[href] div { color: #fff; }
.popup_cart hr { border: none; border-top: 1px solid var(--qx-line-soft); margin: 0 0 12px; }

/* clean "+" glyph on the add-to-cart button (the legacy svg is hidden) */
.popup_cart_control .cart_svg_button:not([href])::before {
    content: ""; width: 16px; height: 16px; flex-shrink: 0; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ── hover states (desktop) ── */
.popup_cart_control .cart_svg_button { transition: background .15s, border-color .15s, color .15s; }
.popup_cart_control .cart_svg_button:hover { background: var(--qx-surface); border-color: var(--qx-muted-2); }
.popup_cart_control a.cart_svg_button[href]:hover { background: #000; border-color: #000; }
.c-btn--pri:hover { background: #000; }
.c-btn--ghost:hover { background: var(--qx-surface); border-color: var(--qx-muted-2); }
.c-btn--danger:hover { background: #e8e4dd; color: var(--qx-ink); }
.c-iconbtn:hover { background: #e8e4dd; color: var(--qx-ink); }
.c-qty button:hover { background: var(--qx-surface); }
.c-seg button:not(.uni_selected):hover { color: var(--qx-ink); }
.c-select:hover { border-color: var(--qx-muted-2); }
.c-switch-wrap:hover .c-switch { box-shadow: 0 0 0 3px var(--qx-line-soft); }
.code_action_open_cart:hover .c-thumb { border-color: var(--qx-muted-2); }
