/* Mini cart tweaks layered on top of the parent theme's markup. */

/* Coupon: collapsed behind a link until the customer actually has a code. */
.vale-coupon-toggle {
    display: block;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #0e0e0e;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.vale-coupon-toggle:hover {
    color: #c8102e;
}

.woocommerce-mini-cart__coupon.vale-coupon--collapsed .woocommerce-mini-cart-coupon-form,
.woocommerce-mini-cart__coupon.vale-coupon--collapsed .woocommerce-mini-cart__coupon-messages {
    display: none;
}

.woocommerce-mini-cart__coupon:not(.vale-coupon--collapsed) .vale-coupon-toggle {
    margin-bottom: 10px;
}

/* Item list: it runs edge to edge while the shipping banner, coupon and total
   blocks sit 16px in. Needs to outweigh WooCommerce's own `.woocommerce ul.cart_list`. */
.mini-cart-panel ul.woocommerce-mini-cart.cart_list {
    padding-left: 16px;
    padding-right: 16px;
}

/* Subtotal: label and amount on one line, note underneath. */
/* The theme stacks these in a column — put the label and amount back on one line.
   Scoped to .mini-cart-panel to outweigh the theme's own rule. */
.mini-cart-panel .woocommerce-mini-cart__total,
.woocommerce-mini-cart__total {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-cart-panel .woocommerce-mini-cart__total-label,
.mini-cart-panel .woocommerce-mini-cart__total-price {
    margin: 0;
}

.mini-cart-panel .woocommerce-mini-cart__total-price {
    font-weight: 700;
}

.mini-cart-panel .woocommerce-mini-cart__shipping-note {
    flex-basis: 100%;
    margin: 4px 0 0;
}

/* ── Size picker on a cart line (mini cart + checkout summary) ───────────── */

body .vale-size-hidden {
    display: none;
}

/* Mini cart: name on its own line, then size + quantity side by side. */
/* The theme lays this out as a column; we want name on top, then size and
   quantity side by side underneath. */
body .mini-cart-panel .mini-cart-item__details {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

body .mini-cart-item__details .mini-cart-item__name {
    flex: 0 0 100%;
    margin: 0;
}

body .mini-cart-panel .mini-cart-item__details .mini-cart-item__name {
    flex: 0 0 100%;
}

body .mini-cart-panel .mini-cart-item__details .vale-size-switch {
    margin: 0;
}

/* Match the theme's quantity stepper so both controls read as one row.
   The theme styles these from .mini-cart-panel, so we have to be at least as
   specific to win. */
body .mini-cart-panel .mini-cart-item__details .mini-cart-item__quantity,
body .mini-cart-panel .mini-cart-item__details .mini-cart-item__quantity .quantity {
    margin: 0;
    gap: 0;
}

body .mini-cart-panel .mini-cart-item__details .mini-cart-item__quantity .quantity-button,
body .mini-cart-panel .mini-cart-item__details .mini-cart-item__quantity .qty {
    width: 28px;
    min-width: 28px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border-radius: 2px;
}

body .mini-cart-panel .mini-cart-item__details .mini-cart-item__quantity .qty {
    width: 30px;
    min-width: 30px;
    padding: 0;
    text-align: center;
}

.vale-size-switch {
    position: relative;
}

.vale-size-switch__select {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: auto;
    min-width: 58px;
    max-width: 100%;
    height: 30px;
    padding: 0 22px 0 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230e0e0e' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center/9px 6px;
    border: 1px solid #d5d5d5;
    border-radius: 2px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 28px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #0e0e0e;
    cursor: pointer;
}

.vale-size-switch__select:hover {
    border-color: #0e0e0e;
}

.vale-size-switch__select:focus-visible {
    outline: 2px solid #0e0e0e;
    outline-offset: 1px;
}

.vale-size-switch__option--oos {
    color: #9a9a9a;
}

.vale-size-switch.is-busy {
    opacity: .55;
    pointer-events: none;
}

/* Prices: right aligned block, top aligned with the product name. */
body .mini-cart-panel .woocommerce-mini-cart-item .mini-cart-item__price {
    align-self: flex-start;
    text-align: right;
}

/* Checkout summary: the picker sits under the product name, not beside it. */
body .cart-product__name .vale-size-switch {
    margin-top: 6px;
}

body .cart-product__name .vale-size-switch__select {
    height: 30px;
    line-height: 28px;
}

.vale-size-switch__note {
    flex: 0 0 100%;
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.4;
    letter-spacing: .3px;
    color: #4a4a4a;
}

.vale-size-switch__note--error {
    color: #c8102e;
}
