/* ============================================================
   CART DRAWER — mini-carrito lateral
   ============================================================ */

.mf-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 8000;
    pointer-events: none;
}

.mf-cart-drawer[hidden] {
    display: block !important; /* ocultamos con is-visible, no con el atributo hidden */
}

/* Overlay semitransparente (solo visible cuando el drawer está abierto) */
.mf-cart-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(31, 26, 22, 0.38);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
    cursor: pointer;
}

.mf-cart-drawer.is-visible .mf-cart-drawer__overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Panel lateral */
.mf-cart-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 380px;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: -8px 0 40px rgba(31, 26, 22, 0.14);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    overflow: hidden;
}

.mf-cart-drawer.is-visible .mf-cart-drawer__panel {
    transform: translateX(0);
}

/* ── HEAD ── */
.mf-cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0e8dd;
    flex: 0 0 auto;
}

.mf-cart-drawer__head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-cart-drawer__head-icon {
    color: #1f1a16;
    flex: 0 0 auto;
}

.mf-cart-drawer__title {
    margin: 0;
    color: #1f1a16;
    font-size: 17px;
    font-weight: 800;
    line-height: 1;
}

.mf-cart-drawer__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f3b805;
    color: #2f2403;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.mf-cart-drawer__count[hidden] {
    display: none !important;
}

.mf-cart-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f3ede4;
    color: #8a8078;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background-color 0.15s;
}

.mf-cart-drawer__close:hover {
    background: #e8dfd3;
    color: #574f47;
}

/* ── BODY ── */
.mf-cart-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Loading spinner */
.mf-cart-drawer__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.mf-cart-drawer__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #f0e8dd;
    border-top-color: #f3b805;
    border-radius: 50%;
    animation: mfCartSpin 0.7s linear infinite;
}

@keyframes mfCartSpin {
    to { transform: rotate(360deg); }
}

/* ── Fuerza display:none cuando el atributo hidden está presente
   (algunos CSS resets sobreescriben el comportamiento por defecto del navegador) */
.mf-cart-drawer__loading[hidden],
.mf-cart-drawer__items[hidden],
.mf-cart-drawer__empty[hidden],
.mf-cart-drawer__footer[hidden],
.mf-cart-drawer__count[hidden] {
    display: none !important;
}

/* Empty state */
.mf-cart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 52px 32px;
    text-align: center;
}

.mf-cart-drawer__empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f3ede4;
    color: #c3b4a2;
    margin-bottom: 4px;
}

.mf-cart-drawer__empty-title {
    margin: 0;
    color: #1f1a16;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}

.mf-cart-drawer__empty-subtitle {
    margin: 0;
    color: #8a8078;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    max-width: 260px;
}

.mf-cart-drawer__empty-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    background: #1f1a16;
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: background-color 0.15s, transform 0.15s;
}

.mf-cart-drawer__empty-cta:hover {
    background: #3a342e;
    transform: translateY(-1px);
}

/* ── ITEMS ── */
.mf-cart-drawer__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mf-cart-drawer__item {
    display: grid;
    grid-template-areas:
        "img info  del"
        "img qty   price"
        "edit edit edit";
    grid-template-columns: 72px 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 0 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #f5ede3;
    align-items: start;
}

.mf-cart-drawer__item-thumb {
    grid-area: img;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    overflow: hidden;
    background: #faf6f0;
    border: 1px solid #e8ddd0;
    flex: 0 0 auto;
}

.mf-cart-drawer__item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mf-cart-drawer__item-info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mf-cart-drawer__item-name {
    color: #1f1a16;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.mf-cart-drawer__item-variant {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f5ee;
    color: #2d735f;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    width: fit-content;
}

.mf-cart-drawer__item-meta {
    color: #8a8078;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

.mf-cart-drawer__item-del {
    grid-area: del;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #c3b4a2;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
    padding: 0;
}

.mf-cart-drawer__item-del:hover {
    color: #b00020;
    background: #fff2f2;
}

.mf-cart-drawer__item-qty {
    grid-area: qty;
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-top: 8px;
    width: fit-content;
    border: 1px solid #e8ddd0;
    border-radius: 10px;
    overflow: hidden;
    background: #faf6f0;
}

.mf-cart-drawer__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #574f47;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.12s;
    line-height: 1;
}

.mf-cart-drawer__qty-btn:hover {
    background: #f0e8dd;
}

.mf-cart-drawer__qty-value {
    min-width: 28px;
    text-align: center;
    color: #1f1a16;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.mf-cart-drawer__item-price {
    grid-area: price;
    margin-top: 8px;
    color: #1f1a16;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    text-align: right;
}

/* Botón "Editar configuración" — solo para el Funko */
.mf-cart-drawer__item-edit {
    grid-area: edit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 14px;
    border: 1px solid #e8ddd0;
    border-radius: 10px;
    background: #faf6f0;
    color: #574f47;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    width: 100%;
    justify-content: center;
}

.mf-cart-drawer__item-edit:hover {
    background: #f0e8dd;
    border-color: #d9ccb9;
}

.mf-cart-drawer__item-edit.is-loading {
    opacity: 0.6;
    cursor: wait;
}

/* ── FOOTER ── */
.mf-cart-drawer__footer {
    flex: 0 0 auto;
    border-top: 1px solid #f0e8dd;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
}

/* Barra de envío gratis */
.mf-cart-drawer__shipping-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f0faf5;
    border: 1px solid #c6e8d9;
}

.mf-cart-drawer__shipping-text {
    margin: 0;
    color: #2d735f;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.mf-cart-drawer__shipping-track {
    height: 5px;
    border-radius: 999px;
    background: #c6e8d9;
    overflow: hidden;
}

.mf-cart-drawer__shipping-fill {
    height: 100%;
    border-radius: 999px;
    background: #2d735f;
    transition: width 0.4s ease;
}

.mf-cart-drawer__shipping-note {
    margin: 4px 0 0;
    font-size: 11px;
    color: #8a8078;
    text-align: right;
}

/* Subtotal */
.mf-cart-drawer__subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.mf-cart-drawer__subtotal-label {
    color: #1f1a16;
    font-size: 15px;
    font-weight: 800;
}

.mf-cart-drawer__subtotal-value {
    color: #1f1a16;
    font-size: 20px;
    font-weight: 800;
}

.mf-cart-drawer__subtotal-note {
    margin: -6px 0 0;
    color: #b3a899;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

/* Botón checkout */
.mf-cart-drawer__checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 20px;
    border-radius: 16px;
    background: #2d735f;
    color: #ffffff;
    font-family: var(--font-primary);
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    transition: background-color 0.15s, transform 0.15s;
}

.mf-cart-drawer__checkout:hover {
    background: #265f4f;
    transform: translateY(-1px);
}

/* Links del footer */
.mf-cart-drawer__footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mf-cart-drawer__footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #e8ddd0;
    border-radius: 12px;
    background: #ffffff;
    color: #574f47;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s;
}

.mf-cart-drawer__footer-link:hover {
    background: #faf6f0;
}

/* ── RESPONSIVO ── */
@media (max-width: 480px) {
    .mf-cart-drawer__panel {
        width: 100%;
    }
}
