/* =============================================================
   CART DRAWER — WooCommerce Block Mini-Cart restyling
   Preem3D / Hermes Child Theme
   Labels: [CSS]
   ============================================================= */

/* ==================== DRAWER CONTAINER ==================== */

/* Width: 420px desktop, 100% mobile */
.wc-block-components-drawer {
    width: 420px !important;
    max-width: 100vw !important;
    background: var(--global-palette8) !important;
    border-left: 1px solid var(--global-palette6) !important;
    box-shadow: -8px 0 40px rgba(26, 23, 20, 0.14), -2px 0 8px rgba(26, 23, 20, 0.06) !important;
}

/* Warm overlay — no backdrop-filter (expensive GPU op, causes jank) */
.wc-block-components-drawer__screen-overlay {
    background-color: rgba(26, 23, 20, 0.45) !important;
}

/* Contents background: warm page colour */
:where(.wp-block-woocommerce-mini-cart-contents) {
    background: var(--global-palette8) !important;
}

.wp-block-woocommerce-filled-mini-cart-contents-block,
.wp-block-woocommerce-empty-mini-cart-contents-block {
    background: var(--global-palette8) !important;
}

/* ==================== HIDDEN ATTRIBUTE GUARD ==================== */

/* blocks.css sets .wc-block-components-product-price { display: block !important }
   which overrides the browser's [hidden]{ display:none } on sale-price spans,
   backorder badges, non-catalog fallback names/images, etc.
   This rule has higher specificity (class + attribute = 0,2,0) than the
   blocks.css rule (class = 0,1,0), so it wins even with !important on both. */
.wc-block-components-product-price[hidden] {
    display: none !important;
}

/* Catch-all for any other hidden elements inside the drawer that theme CSS
   might force visible (backorder badge, sale badge, separator spans, etc.) */
.wc-block-components-drawer [hidden] {
    display: none !important;
}

/* ==================== CLOSE BUTTON ==================== */

.wc-block-components-button.wc-block-components-drawer__close {
    top: 18px !important;
    right: 16px !important;
    width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--global-palette7) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    transition: background-color 0.2s ease, transform 0.2s ease !important;
    color: var(--global-palette3) !important;
    border: 1px solid var(--global-palette6) !important;
}

.wc-block-components-button.wc-block-components-drawer__close:hover {
    background: var(--global-palette6) !important;
    transform: rotate(90deg) !important;
    opacity: 1 !important;
}

.wc-block-components-button.wc-block-components-drawer__close svg {
    width: 16px !important;
    height: 16px !important;
}

/* ==================== HEADER ==================== */

h2.wc-block-mini-cart__title {
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    color: var(--global-palette3) !important;
    letter-spacing: -0.02em !important;
    /* Override WC's mask-image overlap trick */
    margin: 0 !important;
    padding: 20px 20px 16px !important;
    padding-right: 56px !important;
    border-bottom: 1px solid var(--global-palette6) !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    background: var(--global-palette8) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    align-items: center !important;
}

/* Item count pill — targets second span inside the h2 */
h2.wc-block-mini-cart__title span:last-child {
    display: inline-flex !important;
    align-items: center !important;
    padding: 2px 9px !important;
    background: var(--global-palette7) !important;
    border: 1px solid var(--global-palette6) !important;
    border-radius: 20px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    color: var(--global-palette5) !important;
    letter-spacing: 0.01em !important;
    vertical-align: middle !important;
}

/* ==================== ITEMS AREA ==================== */

.wc-block-mini-cart__items {
    padding: 0 !important;
    background: var(--global-palette8) !important;
}

/* ==================== CART ITEM ROW ==================== */

/* Keep WC's native grid-template-columns — overriding it breaks the 3-column layout
   (image | product | total) and causes the total cell to auto-place incorrectly.
   Only add cosmetic overrides here. */
.wc-block-cart-items__row {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--global-palette6) !important;
    transition: background-color 0.15s ease !important;
}

.wc-block-cart-items__row:hover {
    background-color: var(--global-palette7) !important;
}

.wc-block-cart-items__row:last-child,
.wc-block-mini-cart__products-table .wc-block-cart-items__row:last-child {
    border-bottom: none !important;
}

.wc-block-mini-cart__products-table .wc-block-cart-items__row:last-child::after {
    content: none !important;
}

/* ==================== PRODUCT IMAGE ==================== */

/* Hide any secondary image inside the total column (present in some WC block states) */
.wc-block-cart-item__total .wc-block-cart-item__image {
    display: none !important;
}

.wc-block-cart-item__image {
    padding-right: 14px !important;
    align-self: start !important;
}

.wc-block-cart-item__image a {
    display: block !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(26, 23, 20, 0.08) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.wc-block-cart-item__image a:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 4px 12px rgba(26, 23, 20, 0.14) !important;
}

/* Scope to the linked image only — the sibling img[hidden] (non-catalog fallback)
   must stay hidden; targeting all img would override its hidden="" attribute */
.wc-block-cart-item__image a img {
    width: 74px !important;
    height: 74px !important;
    object-fit: cover !important;
    display: block !important;
}

/* ==================== PRODUCT DETAILS ==================== */

.wc-block-cart-item__product {
    padding: 0 !important;
    align-self: start !important;
}

/* Only target the <a> link — the sibling <span hidden=""> (non-catalog fallback)
   must stay hidden; display:block !important on both selectors would override it */
.wc-block-cart-item__product a.wc-block-components-product-name {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--global-palette3) !important;
    line-height: 1.4 !important;
    display: block !important;
    margin-bottom: 4px !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.wc-block-cart-item__product a.wc-block-components-product-name:hover {
    color: var(--global-palette1) !important;
}

/* Variation details */
.wc-block-components-product-details {
    margin: 0 !important;
    padding: 0 !important;
}

.wc-block-components-product-details__item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    margin: 2px 4px 2px 0 !important;
}

.wc-block-components-product-details__item dt,
.wc-block-components-product-details__item dd {
    font-size: 0.7rem !important;
    color: var(--global-palette5) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
}

.wc-block-components-product-details__item dt::after {
    content: ": " !important;
}

/* Fix crushed price: WC default max-width: 3em clips the price text.
   Do NOT add display:block — would override hidden="" on the sale price span
   and reveal both the sale and regular price containers simultaneously. */
.wc-block-cart-item__product .wc-block-components-product-price,
.wc-block-cart-item__prices .wc-block-components-product-price {
    max-width: none !important;
    margin-top: 5px !important;
}

/* WC Block mini-cart uses .wc-block-components-product-price__value and
   .wc-block-formatted-money-amount (NOT the classic .woocommerce-Price-amount).
   Target both the per-item price and the line-total price. */
.wc-block-cart-item__prices .wc-block-components-product-price__value,
.wc-block-cart-item__prices .wc-block-formatted-money-amount,
.wc-block-cart-item__total .wc-block-components-product-price__value,
.wc-block-cart-item__total .wc-block-formatted-money-amount {
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: var(--global-palette3) !important;
    font-variant-numeric: tabular-nums !important;
}

/* Crossed-out original on sale items */
.wc-block-cart-item__prices .wc-block-components-product-price__regular {
    font-weight: 400 !important;
    color: var(--global-palette5) !important;
    font-size: 0.75rem !important;
    text-decoration: line-through !important;
}

/* Sale (discounted) price highlight */
.wc-block-cart-item__prices .wc-block-components-product-price__value.is-discounted {
    color: var(--global-palette1) !important;
    font-weight: 700 !important;
}

/* Hide "Megtakarítás: 0 Ft" / "Save 0 Ft" badge */
.wc-block-components-product-price__savings,
.wc-block-components-sale-badge {
    display: none !important;
}

/* ==================== PRICE SCOPE RESET ==================== */

/* Blanket reset: ensure ALL price text inside the drawer is compact.
   This overrides blocks.css (1.5rem) and woocommerce.css (1.65rem purple)
   which bleed into the drawer because .single-product wraps it on product pages. */
.wc-block-components-drawer .wc-block-components-product-price__value,
.wc-block-components-drawer .wc-block-formatted-money-amount,
.wc-block-components-drawer .wc-block-components-product-price__regular,
.wc-block-components-drawer .wc-block-components-product-price .woocommerce-Price-amount {
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: var(--global-palette3) !important;
    font-variant-numeric: tabular-nums !important;
}

/* ==================== QUANTITY SELECTOR ==================== */

.wc-block-cart-item__quantity {
    padding: 8px 0 0 0 !important;
    align-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.wc-block-components-quantity-selector {
    border: 1.5px solid var(--global-palette6) !important;
    border-radius: 8px !important;
    background: var(--global-palette9) !important;
    overflow: hidden !important;
    height: 34px !important;
    display: inline-flex !important;
    align-items: center !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.wc-block-components-quantity-selector:focus-within {
    border-color: var(--global-palette1) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
}

.wc-block-components-quantity-selector__button {
    width: 30px !important;
    min-width: 30px !important;
    height: 32px !important;
    background: transparent !important;
    color: var(--global-palette3) !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

.wc-block-components-quantity-selector__button:hover {
    background: var(--global-palette7) !important;
    color: var(--global-palette1) !important;
}

.wc-block-components-quantity-selector__input {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--global-palette3) !important;
    background: transparent !important;
    border: none !important;
    text-align: center !important;
    width: 32px !important;
    height: 100% !important;
    padding: 0 !important;
}

/* ==================== REMOVE BUTTON ==================== */

/* WC block sets visibility:hidden by default — make it visible */
.wc-block-cart-item__remove-link {
    visibility: visible !important;
    width: 26px !important;
    height: 26px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: var(--global-palette5) !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    white-space: normal !important;
    font-size: 0 !important;
    flex-shrink: 0 !important;
}

.wc-block-cart-item__remove-link svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor !important;
    display: block !important;
    font-size: initial !important;
}

.wc-block-cart-item__remove-link:hover {
    background: rgba(220, 38, 38, 0.08) !important;
    color: var(--global-palette13) !important;
}

/* ==================== FOOTER ==================== */

.wc-block-mini-cart__footer {
    border-top: 1px solid var(--global-palette6) !important;
    padding: 20px !important;
    background: var(--global-palette8) !important;
}

.wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal {
    font-weight: 700 !important;
    margin-bottom: 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: baseline !important;
}

.wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal
.wc-block-components-totals-item__label {
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    color: var(--global-palette5) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}

.wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal
.wc-block-components-totals-item__value {
    font-size: 1.375rem !important;
    font-weight: 800 !important;
    color: var(--global-palette3) !important;
    letter-spacing: -0.02em !important;
}

.wc-block-components-totals-item.wc-block-mini-cart__footer-subtotal
.wc-block-components-totals-item__description {
    font-size: 0.7rem !important;
    color: var(--global-palette5) !important;
    display: block !important;
}

/* ==================== FOOTER BUTTONS ==================== */

/* Stacked for clear checkout hierarchy */
.wc-block-mini-cart__footer-actions {
    flex-direction: column !important;
    gap: 10px !important;
}

.wc-block-mini-cart__footer-actions .wc-block-components-button,
.wc-block-mini-cart__footer-actions .wp-block-button__link {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

/* PRIMARY — Tovább a pénztárhoz: orange accent
   Covers both rendering paths: class on same <a> element OR on a wrapper div */
a.wp-block-woocommerce-mini-cart-checkout-button-block,
.wp-block-woocommerce-mini-cart-checkout-button-block .wc-block-components-button,
.wp-block-woocommerce-mini-cart-checkout-button-block .wp-block-button__link {
    background: var(--global-palette2) !important;
    color: var(--global-palette9) !important;
    border: none !important;
    padding: 14px 20px !important;
    font-size: 0.9375rem !important;
    min-height: 50px !important;
    box-shadow: 0 4px 14px rgba(232, 121, 58, 0.32) !important;
}

a.wp-block-woocommerce-mini-cart-checkout-button-block:hover,
.wp-block-woocommerce-mini-cart-checkout-button-block .wc-block-components-button:hover,
.wp-block-woocommerce-mini-cart-checkout-button-block .wp-block-button__link:hover {
    background: var(--global-palette14) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(232, 121, 58, 0.42) !important;
    color: var(--global-palette9) !important;
}

/* SECONDARY — Kosaram megtekintése: subtle outline */
a.wp-block-woocommerce-mini-cart-cart-button-block,
.wp-block-woocommerce-mini-cart-cart-button-block .wc-block-components-button,
.wp-block-woocommerce-mini-cart-cart-button-block .wp-block-button__link {
    background: transparent !important;
    color: var(--global-palette3) !important;
    border: 1.5px solid var(--global-palette6) !important;
    padding: 12px 20px !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    min-height: 44px !important;
    box-shadow: none !important;
}

a.wp-block-woocommerce-mini-cart-cart-button-block:hover,
.wp-block-woocommerce-mini-cart-cart-button-block .wc-block-components-button:hover,
.wp-block-woocommerce-mini-cart-cart-button-block .wp-block-button__link:hover {
    background: var(--global-palette7) !important;
    border-color: var(--global-palette5) !important;
    color: var(--global-palette3) !important;
}

/* ==================== EMPTY CART STATE ==================== */

.wp-block-woocommerce-empty-mini-cart-contents-block .wc-block-mini-cart__empty-cart-wrapper {
    padding: 48px 24px 32px !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Shopping bag illustration */
.wc-block-mini-cart__empty-cart-wrapper::before {
    content: '' !important;
    display: block !important;
    width: 80px !important;
    height: 80px !important;
    background: var(--global-palette7) !important;
    border-radius: 50% !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z'/%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 38px 38px !important;
    flex-shrink: 0 !important;
    margin-bottom: 4px !important;
}

.wc-block-mini-cart__empty-cart-wrapper > p:first-of-type {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--global-palette3) !important;
    margin: 0 !important;
}

.wc-block-mini-cart__shopping-button {
    width: 100% !important;
    margin-top: 4px !important;
}

.wc-block-mini-cart__shopping-button a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    background: var(--global-palette2) !important;
    color: var(--global-palette9) !important;
    border: 2px solid var(--global-palette2) !important;
    border-radius: 10px !important;
    padding: 14px 28px !important;
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.wc-block-mini-cart__shopping-button a:hover {
    background: var(--global-palette14) !important;
    border-color: var(--global-palette14) !important;
    color: var(--global-palette9) !important;
    transform: translateY(-1px) !important;
}

/* ==================== MOBILE ==================== */

@media (max-width: 600px) {
    .wc-block-components-drawer {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    h2.wc-block-mini-cart__title {
        padding: 18px 16px 14px !important;
        padding-right: 52px !important;
        font-size: 1.125rem !important;
    }

    .wc-block-cart-items__row {
        padding: 14px 16px !important;
    }

    /* Larger touch targets on mobile (48px minimum) */
    .wc-block-components-quantity-selector {
        height: 44px !important;
    }

    .wc-block-components-quantity-selector__button {
        width: 44px !important;
        min-width: 44px !important;
        height: 42px !important;
    }

    .wc-block-components-quantity-selector__input {
        width: 36px !important;
    }

    .wc-block-mini-cart__footer {
        padding: 16px !important;
    }

    .wc-block-components-button.wc-block-components-drawer__close {
        top: 14px !important;
        right: 12px !important;
    }
}

/* ==================== FREE SHIPPING BAR (injected via Snippet 4a) ==================== */

#preem-shipping-bar {
    padding: 12px 20px 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.04), rgba(232, 121, 58, 0.04));
    border-bottom: 1px solid var(--global-palette6);
    font-size: 0.8125rem;
    color: var(--global-palette5);
    line-height: 1.5;
}

#preem-shipping-bar.is-reached {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.06), rgba(22, 163, 74, 0.03));
}

#preem-shipping-bar #preem-shipping-text {
    margin-bottom: 8px;
    color: var(--global-palette3);
    font-weight: 500;
}

#preem-shipping-bar #preem-shipping-text strong {
    color: var(--global-palette1);
    font-weight: 700;
}

#preem-shipping-bar.is-reached #preem-shipping-text strong {
    color: var(--global-palette11);
}

.preem-shipping-track {
    height: 5px;
    background: var(--global-palette6);
    border-radius: 99px;
    overflow: hidden;
}

.preem-shipping-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--global-palette1), var(--global-palette2));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

#preem-shipping-bar.is-reached .preem-shipping-fill {
    background: linear-gradient(90deg, var(--global-palette11), #22c55e);
}

/* ==================== TRUST SIGNALS STRIP (injected via Snippet 4b) ==================== */

#preem-cart-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 10px 20px;
    border-top: 1px solid var(--global-palette6);
    background: var(--global-palette8);
    font-size: 0.7rem;
    color: var(--global-palette5);
    flex-wrap: wrap;
}

.preem-cart-trust-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    white-space: nowrap;
}

.preem-cart-trust-item:not(:last-child) {
    border-right: 1px solid var(--global-palette6);
}

.preem-cart-trust-item svg {
    width: 13px;
    height: 13px;
    stroke: var(--global-palette1);
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}
