/* ============================================================
   CARRITO FLOTANTE
   Agregar al final de assets/css/public.css
   ============================================================ */

/* Botón flotante */
.cart-fab {
    /* posición en floating_stack.css */
    z-index: 1100;
    width: 56px;
    height: 56px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(108,92,231,.25), 0 1px 4px rgba(0,0,0,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: transform .2s, box-shadow .2s;
}
.cart-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(108,92,231,.35);
}
.cart-fab i {
    font-size: 1.5rem;
    color: #1A1040;
}

/* Badge contador */
.cart-fab__badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e53e3e;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    transform: scale(0);
    transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.cart-fab__badge.visible {
    transform: scale(1);
}

/* Drawer del carrito */
.cart-drawer {
    position: fixed;
    /* bottom y right en floating_stack.css */
    z-index: 1099;
    width: 320px;
    max-height: 70vh;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.92) translateY(12px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.34,1.4,.64,1), opacity .2s;
}
.cart-drawer.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header del drawer */
.cart-drawer__header {
    padding: 16px 18px 12px;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: #1A1040;
    border-bottom: 1px solid #f0edf9;
    flex-shrink: 0;
}

/* Lista de items */
.cart-drawer__list {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #e0d9f5 transparent;
}
.cart-drawer__list::-webkit-scrollbar { width: 4px; }
.cart-drawer__list::-webkit-scrollbar-thumb { background: #e0d9f5; border-radius: 4px; }

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    transition: background .15s;
}
.cart-item:hover { background: #faf8ff; }

.cart-item__img {
    width: 48px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0edf9;
}
.cart-item__img-placeholder {
    width: 48px;
    height: 36px;
    border-radius: 8px;
    background: #f0edf9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #6C5CE7;
    flex-shrink: 0;
}

.cart-item__info {
    flex: 1;
    min-width: 0;
}
.cart-item__name {
    font-size: .82rem;
    font-weight: 600;
    color: #1A1040;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item__price {
    font-size: .8rem;
    color: #6C5CE7;
    font-weight: 700;
    margin-top: 2px;
}

.cart-item__remove {
    background: none;
    border: none;
    color: #999;
    font-size: .8rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
    line-height: 1;
}
.cart-item__remove:hover { color: #e53e3e; background: #fff0f0; }

/* Estado vacío */
.cart-drawer__empty {
    padding: 32px 16px;
    text-align: center;
    color: #aaa;
    font-size: .88rem;
}
.cart-drawer__empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: .4;
}

/* Footer con total y botón */
.cart-drawer__footer {
    padding: 14px 16px;
    border-top: 1px solid #f0edf9;
    flex-shrink: 0;
    background: #fff;
}
.cart-drawer__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: .9rem;
    font-weight: 700;
    color: #1A1040;
}
.cart-drawer__total span:last-child {
    color: #6C5CE7;
    font-size: 1.05rem;
}

.btn-cart-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    font-weight: 700;
    font-size: .92rem;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
}
.btn-cart-checkout:hover { opacity: .92; transform: translateY(-1px); }

/* Botones en product_card y product_detail */
.btn-carrito {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #6C5CE7 0%, #EC4899 100%);
    color: #fff;
    font-weight: 600;
    font-size: .82rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    white-space: nowrap;
}
.btn-carrito:hover { opacity: .88; transform: translateY(-1px); }

/* Botones en product_detail */
.product-detail__btns {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.btn-carrito-lg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #6C5CE7 0%, #a855f7 100%);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    flex: 1;
    justify-content: center;
    min-width: 160px;
}
.btn-carrito-lg:hover { opacity: .88; transform: translateY(-1px); }

.btn-comprar-lg--wa {
    flex: 1;
    min-width: 160px;
    text-align: center;
    justify-content: center;
}

/* Toast feedback */
.cart-toast {
    position: fixed;
    /* posición en floating_stack.css */
    z-index: 1200;
    background: #1A1040;
    color: #fff;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateX(12px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .cart-drawer {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 74px;
    }
    .cart-fab {
        bottom: 16px;
        right: 16px;
    }
}
