/**
 * Mini Cart Sidebar
 * Single Responsibility: visual layer of the mini cart sidebar only.
 * Methodology: BEM. No !important. No page-specific overrides.
 */

/* ── Overlay ─────────────────────────────── */

.mini-cart-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}
.mini-cart-overlay.mini-cart--open {
    display: block;
}

/* ── Panel ───────────────────────────────── */

.mini-cart {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}
.mini-cart.mini-cart--open {
    right: 0;
}

/* ── Header ──────────────────────────────── */

.mini-cart__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
}
.mini-cart__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #111;
}
.mini-cart__close {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease;
}
.mini-cart__close:hover {
    background: #eee;
    transform: rotate(90deg);
}

/* ── Body ────────────────────────────────── */

.mini-cart__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 24px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}
.mini-cart__body::-webkit-scrollbar { width: 4px; }
.mini-cart__body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ── Items list ──────────────────────────── */

.mini-cart .mini-cart-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mini-cart .mini-cart-item {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 24px;
    gap: 12px;
    align-items: start;
    padding: 16px 0;
    border-bottom: 1px solid #f1f1f1;
    box-sizing: border-box;
    list-style: none;
    margin: 0;
}
.mini-cart .mini-cart-item:last-child {
    border-bottom: none;
}

/* ── Item: image ─────────────────────────── */

.mini-cart .mini-cart-image {
    width: 80px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: #f9f9f9;
    flex-shrink: 0;
}
.mini-cart .mini-cart-image a {
    display: block;
    width: 100%;
    height: 100%;
}
.mini-cart .mini-cart-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    float: none;
    margin: 0;
    max-width: none;
    box-shadow: none;
}

/* ── Item: info ──────────────────────────── */

.mini-cart .mini-cart-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}
.mini-cart .mini-cart-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #222;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.mini-cart .mini-cart-title a {
    color: #222;
    text-decoration: none;
    font-weight: 500;
}
.mini-cart .mini-cart-title a:hover { color: #666; }
.mini-cart .mini-cart-attributes {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}
.mini-cart .mini-cart-attributes .variation {
    margin: 0;
    padding: 0;
    border: 0;
}
.mini-cart .mini-cart-attributes td {
    padding: 0;
    border: none;
    background: none;
    display: block;
}
.mini-cart .mini-cart-price {
    font-size: 13px;
    font-weight: 500;
    color: #444;
}

/* ── Item: remove ────────────────────────── */

.mini-cart .mini-cart-remove {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2px;
}
.mini-cart .mini-cart-remove .remove {
    color: #bbb;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mini-cart .mini-cart-remove .remove:hover { color: #e74c3c; }

/* ── Empty state ─────────────────────────── */

.mini-cart .mini-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}
.mini-cart .mini-cart-empty p {
    font-size: 15px;
    margin: 0;
}

/* ── Footer ──────────────────────────────── */

.mini-cart__footer {
    flex-shrink: 0;
    padding: 20px 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
    box-sizing: border-box;
}
.mini-cart__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #111;
}
.mini-cart__total-price { font-size: 18px; }

/* ── Buttons ─────────────────────────────── */

.mini-cart__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    box-sizing: border-box;
    text-transform: uppercase;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}
.mini-cart__btn:last-child { margin-bottom: 0; }
.mini-cart__btn--primary {
    background: #111;
    color: #fff;
    border: 1px solid #111;
}
.mini-cart__btn--primary:hover {
    background: #c09578;
    border-color: #c09578;
    color: #fff;
}
.mini-cart__btn--secondary {
    background: transparent;
    color: #555;
    border: 1px solid #ddd;
}
.mini-cart__btn--secondary:hover {
    color: #111;
    border-color: #111;
}

/* ── Body lock ───────────────────────────── */

body.mini-cart-active { overflow: hidden; }

/* ── Quantity controls ───────────────────── */

.mini-cart-qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}
.mini-cart-qty {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}
.mini-cart-qty__btn {
    background: #f5f5f5;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.mini-cart-qty__btn:hover { background: #e0e0e0; }
.mini-cart-qty__value {
    min-width: 32px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    padding: 0 4px;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    line-height: 28px;
    display: block;
}
.mini-cart-price {
    font-size: 13px;
    font-weight: 600;
    color: #222;
}
.mini-cart-qty__btn:disabled {
opacity: 0.4;
cursor: not-allowed;
background: #f5f5f5;
}

.mini-cart-qty__btn--disabled {
opacity: 0.4;
cursor: not-allowed;
pointer-events: none;
}

.mini-cart-stock-notice {
font-size: 12px;
color: #c62828;
padding: 4px 0 0;
text-align: left;
animation: miniCartNoticeFade 3s ease forwards;
}

@keyframes miniCartNoticeFade {
0%, 70% { opacity: 1; }
100% { opacity: 0; }
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 480px) {
    .mini-cart { width: 100vw; }
    .mini-cart .mini-cart-item {
        grid-template-columns: 64px minmax(0, 1fr) 20px;
        gap: 10px;
    }
    .mini-cart .mini-cart-image {
        width: 64px;
        height: 82px;
    }
}