/* ==========================================================================
   WM Mini Cart — trigger icon and sidebar panel
   ========================================================================== */

/* ── Trigger button ───────────────────────────────────────────────────────── */
.wm-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: color 0.15s ease;
    position: relative;
}

.wm-cart-trigger__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wm-cart-trigger__icon i {
    display: block;
    font-size: 22px;
    line-height: 1;
}

/* SVG icons (Elementor renders FA as inline SVG when "Improved Asset Loading" is on) */
.wm-cart-trigger__icon svg {
    display: block;
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.wm-cart-trigger__count {
    position: absolute;
    top: -8px;
    right: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: currentColor;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    /* invert the text colour to be readable against the bg */
    filter: invert(0);
}

/* We use a pseudo-element trick: the count inherits color from trigger
   but the text inside needs to contrast — use a wrapper approach */
.wm-cart-trigger__count {
    background-color: #333;
    color: #fff;
}

.wm-cart-trigger__total {
    font-size: 0.875em;
    white-space: nowrap;
}

/* ── Sidebar backdrop + panel ─────────────────────────────────────────────── */
.wm-cart-sidebar {
    position: fixed;
    inset: 0;
    z-index: 99999;
    visibility: hidden;
    pointer-events: none;
}

.wm-cart-sidebar.is-open {
    visibility: visible;
    pointer-events: auto;
}

.wm-cart-sidebar__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wm-cart-sidebar.is-open .wm-cart-sidebar__overlay {
    opacity: 1;
}

.wm-cart-sidebar__panel {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 400px;
    max-width: 100vw;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.wm-cart-sidebar.is-open .wm-cart-sidebar__panel {
    transform: translateX(0);
}

/* Prevent body scroll when open */
body.wm-cart-open {
    overflow: hidden;
}

/* Loading state */
.wm-cart-sidebar.is-loading .wm-cart-sidebar__panel {
    opacity: 0.6;
    pointer-events: none;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.wm-cart-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.wm-cart-sidebar__title {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wm-cart-sidebar__close {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    color: inherit;
    flex-shrink: 0;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* ── Items area ───────────────────────────────────────────────────────────── */
.wm-cart-sidebar__items-wrap {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 24px;
    overscroll-behavior: contain;
}

.wm-cart-sidebar__empty {
    padding: 32px 0;
    text-align: center;
    opacity: 0.5;
    margin: 0;
}

/* ── Single cart item ─────────────────────────────────────────────────────── */
.wm-cart-item {
    display: grid;
    grid-template-columns: auto 72px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.wm-cart-item:last-child {
    border-bottom: none;
}

.wm-cart-item__image {
    display: block;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.wm-cart-item__image img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: cover;
    object-position: center;
}

.wm-cart-item__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wm-cart-item__name {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wm-cart-item__price {
    font-size: 0.875em;
    opacity: 0.7;
}

.wm-cart-item__remove {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    align-self: center;
    padding: 0;
    cursor: pointer;
    color: inherit;
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* ── Qty stepper in sidebar ───────────────────────────────────────────────── */
.wm-cart-item__qty-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.wm-cart-qty-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    color: inherit;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.wm-cart-item__qty {
    min-width: 28px;
    text-align: center;
    font-size: 0.875em;
    font-weight: 500;
    padding: 0 4px;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    line-height: 32px;
}

/* ── Footer: promo + totals + checkout ───────────────────────────────────── */
.wm-cart-sidebar__footer {
    flex-shrink: 0;
    padding: 0 24px 24px;
}

.wm-cart-sidebar__promo {
    padding: 14px 0;
}

.wm-cart-promo-toggle {
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875em;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.65;
    transition: color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

.wm-cart-promo-toggle:hover {
    opacity: 1;
}

.wm-cart-promo-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.wm-cart-promo-input {
    flex: 1 1 auto;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.875em;
}

.wm-cart-promo-apply {
    -webkit-appearance: none;
    appearance: none;
    padding: 8px 16px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875em;
    white-space: nowrap;
    color: inherit;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.wm-cart-promo-feedback {
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 0.825em;
    line-height: 1.4;
}

.wm-cart-promo-feedback.is-error {
    background: #fef0f0;
    color: #c0392b;
    border: 1px solid #f5c6c6;
}

.wm-cart-promo-feedback.is-success {
    background: #f0fef4;
    color: #1a7a44;
    border: 1px solid #b7e8c8;
}

.wm-cart-sidebar__divider {
    margin: 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Totals rows ──────────────────────────────────────────────────────────── */
.wm-cart-sidebar__totals {
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wm-cart-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875em;
}

.wm-cart-totals__label {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.9em;
    flex-shrink: 0;
}

.wm-cart-totals__value {
    text-align: right;
    opacity: 0.75;
}

.wm-cart-totals__shipping {
    font-size: 0.875em;
    max-width: 200px;
}

.wm-cart-totals__value--discount {
    color: #27ae60;
}

.wm-cart-coupon-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    width: 16px;
    height: 16px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    vertical-align: middle;
    transition: opacity 0.15s ease;
}

.wm-cart-coupon-remove:hover {
    opacity: 1;
}

/* ── Total row ────────────────────────────────────────────────────────────── */
.wm-cart-sidebar__total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    font-weight: 700;
}

.wm-cart-sidebar__total-label {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wm-cart-sidebar__total-value {
    font-size: 1.1em;
}

/* ── Actions ──────────────────────────────────────────────────────────────── */
.wm-cart-sidebar__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.wm-cart-sidebar__checkout {
    display: block;
    width: 100%;
    padding: 14px 24px;
    text-align: center;
    text-decoration: none;
    background: #333;
    color: #fff;
    border-radius: 32px;
    font-weight: 600;
    font-size: 0.9em;
    letter-spacing: 0.04em;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-sizing: border-box;
}

.wm-cart-sidebar__checkout:hover {
    background: #111;
    color: #fff;
}

.wm-cart-sidebar__cart-link {
    font-size: 0.85em;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.wm-cart-sidebar__cart-link:hover {
    opacity: 1;
}
