.mini-cart-popover {
    position: absolute;
    z-index: 80;
    top: calc(100% + 1rem);
    right: -3.25rem;
    width: min(27rem, calc(100vw - 2rem));
    max-height: calc(100vh - 5rem);
    overflow: hidden;
    border: 1px solid #e7e5e4;
    border-radius: 1.25rem;
    color: #292524;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2), 0 4px 16px rgba(15, 23, 42, 0.08);
}

.mini-cart-popover::before {
    content: '';
    position: absolute;
    z-index: 2;
    top: -0.4rem;
    right: 3.5rem;
    width: 0.8rem;
    height: 0.8rem;
    border-top: 1px solid #e7e5e4;
    border-left: 1px solid #e7e5e4;
    background: #ffffff;
    transform: rotate(45deg);
}

.mini-cart-popover[hidden] { display: none; }

.mini-cart-toast {
    position: absolute;
    z-index: 81;
    top: calc(100% + 0.8rem);
    right: -1.2rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: max-content;
    min-width: 12.5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.85rem;
    color: #292524;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
    animation: mini-cart-toast-in 180ms ease-out;
}

.mini-cart-toast[hidden] { display: none; }

.mini-cart-toast__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: #15803d;
    background: #dcfce7;
}

.mini-cart-toast__icon svg { width: 1rem; height: 1rem; stroke-width: 2.5; }
.mini-cart-toast__content { display: flex; align-items: center; gap: 0.65rem; }
.mini-cart-toast__content strong { color: #292524; font-size: 0.78rem; font-weight: 750; white-space: nowrap; }
.mini-cart-toast__content button { padding: 0; border: 0; color: var(--color-secondary, #e53e29); background: transparent; font-size: 0.75rem; font-weight: 760; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.mini-cart-toast__content button:hover { color: var(--color-secondary-dark, #cb3421); }

.mini-cart-badge-bump { animation: mini-cart-badge-bump 600ms ease-out; }

@keyframes mini-cart-toast-in {
    from { opacity: 0; transform: translateY(-0.35rem) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mini-cart-badge-bump {
    0%, 100% { transform: scale(1); }
    35% { transform: scale(1.45) rotate(6deg); }
    65% { transform: scale(0.92) rotate(-3deg); }
}

.mini-cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    min-height: 11rem;
    color: #78716c;
    font-size: 0.85rem;
}

.mini-cart-spinner {
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid #e7e5e4;
    border-top-color: var(--color-secondary, #e53e29);
    border-radius: 999px;
    animation: mini-cart-spin 700ms linear infinite;
}

@keyframes mini-cart-spin { to { transform: rotate(360deg); } }

.mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.4rem 1.15rem;
    border-bottom: 1px solid #f1f0ef;
    background: linear-gradient(135deg, #fafaf9 0%, #ffffff 75%);
}

.mini-cart-header h2 {
    margin: 0;
    color: #1c1917;
    font-size: 1.2rem;
    font-weight: 780;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.mini-cart-header p {
    margin: 0.2rem 0 0;
    color: #a8a29e;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mini-cart-close {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #e7e5e4;
    border-radius: 0.7rem;
    color: #78716c;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.mini-cart-close:hover { border-color: #d6d3d1; color: #1c1917; background: #fafaf9; }
.mini-cart-close:focus-visible { outline: 2px solid var(--color-secondary, #e53e29); outline-offset: 2px; }
.mini-cart-close svg { width: 1rem; height: 1rem; }

.mini-cart-items {
    max-height: min(24rem, calc(100vh - 22rem));
    min-height: 7rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mini-cart-item {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1.15rem 1.4rem;
}

.mini-cart-item + .mini-cart-item { border-top: 1px solid #f1f0ef; }

.mini-cart-item__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    overflow: hidden;
    border: 1px solid #f1f0ef;
    border-radius: 0.9rem;
    background: #fafaf9;
}

.mini-cart-item__image img { width: 100%; height: 100%; object-fit: contain; }
.mini-cart-item__image > span { color: #a8a29e; }
.mini-cart-item__image svg { width: 1.5rem; height: 1.5rem; }
.mini-cart-item__content { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.mini-cart-item__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.65rem; }
.mini-cart-item__title-wrap { min-width: 0; }
.mini-cart-item__title { display: -webkit-box; overflow: hidden; color: #292524; font-size: 0.875rem; font-weight: 720; line-height: 1.35; text-decoration: none; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mini-cart-item__title:hover { color: var(--color-secondary, #e53e29); }
.mini-cart-item__title-wrap p { margin: 0.25rem 0 0; overflow: hidden; color: #a8a29e; font-size: 0.7rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }

.mini-cart-item__remove {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 0.5rem;
    color: #a8a29e;
    background: transparent;
    cursor: pointer;
}

.mini-cart-item__remove:hover { color: #dc2626; background: #fef2f2; }
.mini-cart-item__remove:disabled { cursor: wait; opacity: 0.5; }
.mini-cart-item__remove svg { width: 0.95rem; height: 0.95rem; }
.mini-cart-item__bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-top: 0.8rem; }

.mini-cart-quantity { display: inline-grid; grid-template-columns: 1.8rem 2rem 1.8rem; align-items: center; overflow: hidden; border: 1px solid #e7e5e4; border-radius: 0.55rem; }
.mini-cart-quantity button { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; border: 0; color: #57534e; background: #fafaf9; font-size: 1rem; cursor: pointer; }
.mini-cart-quantity button:hover { color: var(--color-secondary, #e53e29); background: #f5f5f4; }
.mini-cart-quantity button:disabled { color: #d6d3d1; cursor: not-allowed; }
.mini-cart-quantity span { color: #292524; font-size: 0.78rem; font-weight: 750; text-align: center; }
.mini-cart-item__price { min-width: 0; text-align: right; }
.mini-cart-item__price strong { color: var(--color-secondary, #e53e29); font-size: 0.95rem; font-weight: 800; }
.mini-cart-item__price span { margin-left: 0.2rem; color: #a8a29e; font-size: 0.65rem; font-weight: 650; }
.mini-cart-item__unavailable { color: #b45309; font-size: 0.72rem; }

.mini-cart-footer { padding: 1.15rem 1.4rem 1.25rem; border-top: 1px solid #e7e5e4; background: #fafaf9; }
.mini-cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.mini-cart-subtotal > span { color: #78716c; font-size: 0.75rem; font-weight: 780; letter-spacing: 0.07em; text-transform: uppercase; }
.mini-cart-subtotal strong { color: #1c1917; font-size: 1.2rem; font-weight: 820; }
.mini-cart-subtotal small { color: #78716c; font-size: 0.65rem; font-weight: 650; }
.mini-cart-actions { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 0.65rem; }
.mini-cart-view-cart,
.mini-cart-checkout { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.75rem; border-radius: 0.7rem; font-size: 0.8rem; font-weight: 760; text-decoration: none; transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.mini-cart-view-cart { border: 1px solid #d6d3d1; color: #44403c; background: #ffffff; }
.mini-cart-view-cart:hover { border-color: var(--color-secondary, #e53e29); color: var(--color-secondary, #e53e29); }
.mini-cart-checkout { border: 1px solid var(--color-secondary, #e53e29); color: #ffffff; background: var(--color-secondary, #e53e29); box-shadow: 0 5px 14px color-mix(in srgb, var(--color-secondary, #e53e29) 22%, transparent); }
.mini-cart-checkout:hover { color: #ffffff; filter: brightness(0.94); transform: translateY(-1px); }
.mini-cart-checkout svg { width: 0.95rem; height: 0.95rem; }
.mini-cart-shipping-note { display: flex; align-items: center; justify-content: center; gap: 0.35rem; margin: 0.8rem 0 0; color: #a8a29e; font-size: 0.65rem; }
.mini-cart-shipping-note svg { width: 0.8rem; height: 0.8rem; }

.mini-cart-empty { padding: 2.5rem 1.5rem 2.25rem; text-align: center; }
.mini-cart-empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 3.5rem; height: 3.5rem; margin-bottom: 1rem; border-radius: 1rem; color: var(--color-secondary, #e53e29); background: color-mix(in srgb, var(--color-secondary, #e53e29) 9%, white); }
.mini-cart-empty__icon svg { width: 1.5rem; height: 1.5rem; }
.mini-cart-empty h3 { margin: 0; color: #292524; font-size: 1rem; font-weight: 760; }
.mini-cart-empty p { margin: 0.45rem 0 1.15rem; color: #78716c; font-size: 0.8rem; }
.mini-cart-empty a,
.mini-cart-empty button { display: inline-flex; min-height: 2.5rem; align-items: center; justify-content: center; padding: 0.6rem 1rem; border: 0; border-radius: 0.65rem; color: #ffffff; background: var(--color-secondary, #e53e29); font-size: 0.78rem; font-weight: 740; text-decoration: none; cursor: pointer; }

html.dark .mini-cart-popover { border-color: #44403c; color: #e7e5e4; background: #1c1917; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48); }
html.dark .mini-cart-toast { border-color: #44403c; color: #e7e5e4; background: rgba(28, 25, 23, 0.98); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45); }
html.dark .mini-cart-toast__icon { color: #86efac; background: rgba(22, 101, 52, 0.3); }
html.dark .mini-cart-toast__content strong { color: #fafaf9; }
html.dark .mini-cart-popover::before { border-color: #44403c; background: #1c1917; }
html.dark .mini-cart-header { border-color: #44403c; background: linear-gradient(135deg, #1c1917, #292524); }
html.dark .mini-cart-header h2,
html.dark .mini-cart-item__title,
html.dark .mini-cart-quantity span,
html.dark .mini-cart-subtotal strong,
html.dark .mini-cart-empty h3 { color: #fafaf9; }
html.dark .mini-cart-close { border-color: #57534e; color: #a8a29e; background: #292524; }
html.dark .mini-cart-close:hover { color: #ffffff; background: #44403c; }
html.dark .mini-cart-item + .mini-cart-item,
html.dark .mini-cart-footer { border-color: #44403c; }
html.dark .mini-cart-item__image { border-color: #44403c; background: #292524; }
html.dark .mini-cart-item__remove:hover { color: #fca5a5; background: rgba(153, 27, 27, 0.18); }
html.dark .mini-cart-quantity { border-color: #57534e; }
html.dark .mini-cart-quantity button { color: #d6d3d1; background: #292524; }
html.dark .mini-cart-quantity button:hover { color: #fb6b57; background: #44403c; }
html.dark .mini-cart-footer { background: #292524; }
html.dark .mini-cart-view-cart { border-color: #57534e; color: #e7e5e4; background: #1c1917; }
html.dark .mini-cart-empty__icon { background: rgba(251, 65, 42, 0.12); }

@media (max-width: 900px) {
    .mini-cart-popover { position: fixed; top: 4.25rem; right: 1rem; left: 1rem; width: auto; }
    .mini-cart-popover::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .mini-cart-spinner { animation: none; }
    .mini-cart-checkout { transition: none; }
    .mini-cart-toast,
    .mini-cart-badge-bump { animation: none; }
}
