/* ==========================================================================
 * afx-minicart.css — cart drawer (mini cart).
 * Markup: autostore_child Magento_Theme::html/cart/cart-drawer.phtml
 *
 * No brand colour is hardcoded: every accent resolves from afx-store.css, so each store
 * renders in its own colour.
 *
 * Also overrides .btn-secondary, which the compiled tailwind.css bakes to #ff3333 — one
 * tailwind.css is built for both themes, so "View and Edit Cart" rendered red on the green
 * store. Both button classes also inherit stray Bootstrap borders that Hyvä never resets.
 *
 * Every selector is scoped to #cart-drawer / .minicart-wrapper: this file loads on every page
 * (the drawer lives in the header) but must touch nothing outside the mini cart.
 * ========================================================================== */

:root {
    /* Neutrals shared with the cart page (afx-cart.css) so the drawer reads as part of
       the same theme. Brand accents always come from --color-primary*. */
    --afx-mc-border: #e2e8f0;
    --afx-mc-muted: #6b7885;
    --afx-mc-text: #1b2733;
    --afx-mc-card: #f6f7f9;
}

/* ==========================================================================
 * 1. Drawer shell
 * The drawer's own width (w-[480px] md:w-[640px]) is compiled into tailwind.css and
 * works — deliberately not overridden. Only the header/scroll area is adjusted.
 * ========================================================================== */
#cart-drawer #cart-drawer-title {
    font-size: 1.375rem;
    line-height: 1.25;
    color: var(--afx-mc-text);
}

#cart-drawer #cart-drawer-title .items-total {
    display: block;
    margin-top: .125rem;
    font-size: .75rem;
    font-weight: 400;
    color: var(--afx-mc-muted);
}

#cart-drawer .afx-mc-close {
    color: var(--afx-mc-muted) !important;
    background: transparent !important;
    border: none !important;
    padding: .25rem !important;
}

#cart-drawer .afx-mc-list {
    gap: .75rem;
    margin: 1rem 0 0;
    padding: 0 .125rem;
    list-style: none;
}

/* ==========================================================================
 * 2. Item card
 * ========================================================================== */
#cart-drawer .afx-mc-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--afx-mc-card);
    border: 1px solid transparent;
    border-radius: 10px;
}

/* An update/remove request is in flight for this row. */
#cart-drawer .afx-mc-item.is-pending {
    opacity: .55;
    pointer-events: none;
}

#cart-drawer .afx-mc-item__media {
    flex: 0 0 72px;
    width: 72px;
    align-self: center;
}

#cart-drawer .afx-mc-item__media img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

/* Must be allowed to shrink or long product names widen the card instead of wrapping. */
#cart-drawer .afx-mc-item__body {
    flex: 1 1 auto;
    min-width: 0;
}

#cart-drawer .afx-mc-item__name {
    margin: 0;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--afx-mc-text);
    overflow-wrap: anywhere;
}

#cart-drawer .afx-mc-item__sku,
#cart-drawer .afx-mc-item__option {
    margin: .125rem 0 0;
    font-size: .8125rem;
    line-height: 1.4;
    color: var(--afx-mc-muted);
}

#cart-drawer .afx-mc-item__price {
    margin: .375rem 0 0;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-primary, #137C4E);
}

/* No tax text in the mini cart.
   Magento_Tax's checkout/cart/item/price/sidebar.phtml renders the amount inside
   <span class="price-wrapper price-excluding-tax" data-label="Excl. Tax">, and the
   label is drawn purely by CSS from that attribute. Suppressing the pseudo-element
   removes the label and nothing else — the price, the tax calculation and the tax
   configuration are all untouched. */
#cart-drawer .afx-mc-item__price .price-including-tax::before,
#cart-drawer .afx-mc-item__price .price-including-tax::after,
#cart-drawer .afx-mc-item__price .price-excluding-tax::before,
#cart-drawer .afx-mc-item__price .price-excluding-tax::after,
#cart-drawer .afx-mc-item__price .price-label {
    content: none !important;
    display: none !important;
}

/* If the store is configured to show both prices, keep only the first. */
#cart-drawer .afx-mc-item__price .price-including-tax + .price-excluding-tax {
    display: none;
}

#cart-drawer .afx-mc-item__message {
    margin-top: .5rem;
    font-size: .75rem;
    color: #c0392b;
}

/* ==========================================================================
 * 3. Quantity stepper + row actions
 * ========================================================================== */
#cart-drawer .afx-mc-item__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .75rem;
}

#cart-drawer .afx-mc-qty {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

/* !important is required, not stylistic: the theme CSS carries
   `button, .cart-container .action.continue, a.action.primary
    { border: none !important; padding: 0 20px !important }` plus a white button
   colour, which only bites <button> elements. Without matching it the stepper
   buttons lose their ring and render a white glyph on a white circle. */
#cart-drawer .afx-mc-qty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0 !important;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1;
    background: transparent !important;
    border: 1px solid var(--color-primary, #137C4E) !important;
    border-radius: 50%;
    color: var(--color-primary, #137C4E) !important;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

#cart-drawer .afx-mc-qty__btn:hover:not(:disabled) {
    background: var(--color-primary, #137C4E) !important;
    color: #fff !important;
}

#cart-drawer .afx-mc-qty__btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#cart-drawer .afx-mc-qty__btn:focus-visible {
    outline: 2px solid var(--color-primary-darker, #0f5d3a);
    outline-offset: 2px;
}

#cart-drawer .afx-mc-qty__value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .5rem;
    background: #e9edf1;
    border-radius: 50%;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--afx-mc-text);
}

#cart-drawer .afx-mc-item__actions {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

/* Edit / remove icon buttons. Same !important reasoning as the stepper — and the
   trash icon's stroke="currentColor" was resolving to the inherited white, drawing
   a white icon on a white card. */
#cart-drawer .afx-mc-item__actions a.btn,
#cart-drawer .afx-mc-item__actions button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px;
    color: var(--afx-mc-muted) !important;
    transition: color .15s ease, background-color .15s ease;
}

#cart-drawer .afx-mc-item__actions a.btn svg,
#cart-drawer .afx-mc-item__actions button.btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

#cart-drawer .afx-mc-item__actions a.btn:hover {
    color: var(--color-primary, #137C4E) !important;
}

#cart-drawer .afx-mc-item__actions button.btn:hover {
    color: #c0392b !important;
    background: #fbeceb !important;
}

/* ==========================================================================
 * 4. Footer — "To pay" + actions
 * ========================================================================== */
#cart-drawer .afx-mc-footer {
    padding-top: 1rem;
    margin-top: .5rem;
    border-top: 1px solid var(--afx-mc-border);
}

#cart-drawer .afx-mc-total {
    margin: 0 0 .875rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--afx-mc-text);
}

#cart-drawer .afx-mc-total dd {
    color: var(--color-primary, #137C4E);
    font-size: 1.125rem;
}

#cart-drawer .afx-mc-total .price-including-tax::after,
#cart-drawer .afx-mc-total .price-excluding-tax::after,
#cart-drawer .afx-mc-total .price-label {
    content: none !important;
    display: none !important;
}

#cart-drawer .afx-mc-actions {
    gap: .625rem;
}

/* ==========================================================================
 * 5. Action buttons (Go to checkout / View and Edit Cart)
 *    Both are theme-filled with white labels; the secondary uses the darker shade so
 *    the pair still reads as a hierarchy.
 * ========================================================================== */
#cart-drawer .btn-primary,
#cart-drawer .btn-secondary,
.minicart-wrapper .btn-primary,
.minicart-wrapper .btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3rem;
    box-sizing: border-box;
    padding: .5rem 1rem;
    border: none;
    border-radius: 9999px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .01em;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease-in-out;
}

#cart-drawer .btn-primary,
.minicart-wrapper .btn-primary {
    background: var(--color-primary, #137C4E);
}

#cart-drawer .btn-primary:hover,
.minicart-wrapper .btn-primary:hover {
    background: var(--color-primary-darker, #0f5d3a);
    color: #fff;
}

#cart-drawer .btn-secondary,
.minicart-wrapper .btn-secondary {
    background: var(--color-primary-darker, #0f5d3a);
}

#cart-drawer .btn-secondary:hover,
.minicart-wrapper .btn-secondary:hover {
    background: var(--color-primary, #137C4E);
    color: #fff;
}

#cart-drawer .btn-primary:focus-visible,
#cart-drawer .btn-secondary:focus-visible {
    outline: 2px solid var(--color-primary, #137C4E);
    outline-offset: 2px;
}

/* Empty state */
#cart-drawer .grow.grid p {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: var(--afx-mc-muted);
}

/* ==========================================================================
 * 6. Responsive
 * ========================================================================== */
@media (max-width: 480px) {
    #cart-drawer .afx-mc-item {
        gap: .75rem;
        padding: .75rem;
    }

    #cart-drawer .afx-mc-item__media,
    #cart-drawer .afx-mc-item__media img {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
    }

    #cart-drawer .afx-mc-item__controls {
        flex-wrap: wrap;
        gap: .5rem;
    }

    #cart-drawer .btn-primary,
    #cart-drawer .btn-secondary {
        min-height: 2.75rem;
        font-size: .9375rem;
    }
}
