/* ===================================================
   ESTILOS DEL CARRITO MODULAR A WHATSAPP
   =================================================== */
.sticky-cart-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(160%);
    width: calc(100% - 2.5rem);
    max-width: 660px;
    background: #0f172a;
    color: white;
    border-radius: var(--radius-xl);
    padding: 0.85rem 1.25rem;
    box-shadow: var(--shadow-float);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    z-index: 90;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease, visibility 0.25s ease;
}

.sticky-cart-bar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sticky-cart-bar.visible:hover {
    transform: translateX(-50%) translateY(-3px);
}

.cart-info-click {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.cart-icon-bubble {
    width: 44px;
    height: 44px;
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
    flex-shrink: 0;
}

.cart-badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--secondary);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
}

.cart-titles {
    display: flex;
    flex-direction: column;
}

.cart-subtext {
    font-size: 0.72rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
}

.cart-amount {
    font-size: 1.28rem;
    font-weight: 800;
    font-family: var(--font-display);
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-tap-hint {
    font-size: 0.72rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
}

.btn-open-modal {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-lg);
    font-size: 0.92rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-open-modal:hover {
    transform: scale(1.03);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-backdrop.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-subtle);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-close-modal {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.cart-item-thumb {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.cart-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.cart-item-price {
    font-size: 0.84rem;
    color: var(--primary);
    font-weight: 700;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.modal-qty-box {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.15rem 0.35rem;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--emerald);
    width: 24px;
    height: 24px;
    font-weight: 800;
    cursor: pointer;
}

.qty-val {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--emerald);
    min-width: 20px;
    text-align: center;
}

.btn-trash-item {
    background: var(--secondary-light);
    border: 1px solid rgba(225, 29, 72, 0.2);
    color: var(--secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.modal-total-num {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--emerald);
}

.modal-btn-row {
    display: flex;
    gap: 0.75rem;
}

.btn-clear-cart {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-lg);
    font-weight: 700;
    cursor: pointer;
}

.btn-modal-send-wa {
    flex: 1;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* ===================================================
   ADAPTABILIDAD MÓVIL DEL CARRITO (SMARTPHONES)
   =================================================== */
@media (max-width: 768px) {
    .sticky-cart-bar {
        width: calc(100% - 1.5rem);
        bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
        border-radius: var(--radius-lg);
    }

    .cart-info-click {
        gap: 0.6rem;
        min-width: 0;
    }

    .cart-icon-bubble {
        width: 38px;
        height: 38px;
        font-size: 1.05rem;
    }

    .cart-amount {
        font-size: 1.05rem;
    }

    .cart-tap-hint {
        display: none;
    }

    .btn-open-modal {
        padding: 0.6rem 0.85rem;
        font-size: 0.8rem;
        border-radius: var(--radius-md);
    }

    .modal-backdrop {
        padding: 0.75rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .cart-item-row {
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .modal-btn-row {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .qty-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .btn-trash-item {
        width: 40px;
        height: 40px;
    }

    .btn-clear-cart,
    .btn-modal-send-wa {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .sticky-cart-bar {
        width: calc(100% - 1rem);
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        padding: 0.55rem 0.65rem;
    }
    .cart-icon-bubble {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    .cart-amount {
        font-size: 0.95rem;
    }
    .btn-open-modal {
        padding: 0.5rem 0.65rem;
        font-size: 0.75rem;
    }
}
