/* === ESTILOS DEL BOTÓN DE AGREGAR (INYECTADOS EN EL CATÁLOGO) === */
.add-btn {
    background: linear-gradient(135deg, #ff7a00 0%, #ea580c 100%);
    color: white;
    border: none;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    outline: none;
}

.add-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff8f20 0%, #f97316 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 14px rgba(234, 88, 12, 0.35);
}

.add-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.add-btn:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    border-radius: 50px;
}

/* === ESTILOS DEL WIDGET CARRITO === */
:root {
    --whatsapp-color: #25D366;
    --whatsapp-hover: #128C7E;
    --cart-bg-glass: rgba(255, 255, 255, 0.92);
    --cart-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08), 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Barra del Carrito (Flotante Abajo) */
.cart-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: 90%;
    max-width: 760px;
    background: var(--cart-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(251, 146, 60, 0.25);
    border-radius: 24px;
    box-shadow: var(--cart-shadow);
    z-index: 999;
    padding: 14px 24px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

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

.cart-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.cart-bar-info {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    flex-grow: 1;
}

.cart-icon-container {
    position: relative;
    background: var(--primary-light);
    padding: 10px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(251, 146, 60, 0.2);
}

.cart-icon {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.cart-bar-text {
    display: flex;
    flex-direction: column;
}

.cart-bar-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.cart-bar-summary {
    font-size: 13px;
    color: var(--text-muted);
}

.cart-bar-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.cart-bar-total {
    font-size: 19px;
    font-weight: 800;
    color: var(--primary-color);
}

.btn-checkout-bar {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-checkout-bar:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

/* Overlay de Fondo Oscuro */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Panel Modal Desplegable Lateral */
.cart-modal {
    position: fixed;
    top: 0;
    right: -420px;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: white;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
    visibility: hidden; /* Evita que el modal sea accesible o genere scroll horizontal mientras esté cerrado */
}

.cart-modal.active {
    right: 0;
    visibility: visible;
}

.cart-modal-header {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-modal-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-modal-title-area h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    border: none;
    padding-left: 0;
}

.cart-qty-badge {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 12px;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.btn-close-modal:hover {
    color: var(--text-dark);
    transform: rotate(90deg);
}

/* Lista de Items */
.cart-items-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-empty-state {
    text-align: center;
    margin: auto 0;
    color: var(--text-muted);
    padding: 0 10px;
}

.cart-empty-state p {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.cart-empty-state span {
    font-size: 14px;
}

/* Tarjetas de Producto en el Carrito */
.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.cart-item-info {
    flex-grow: 1;
    min-width: 0; /* Permite que el flex container de la info se contraiga por debajo de su contenido textual */
}

.cart-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
    word-break: break-word; /* Ajuste automático de palabras largas */
    overflow-wrap: break-word;
}

.cart-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 6px;
}

.cart-item-sku {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
}

.cart-item-price-unit {
    color: var(--text-muted);
}

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 100px;
    flex-shrink: 0; /* Evita que los botones y controles se compriman en celulares chicos */
}

.cart-item-subtotal {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-dark);
}

.quantity-selector {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2px;
}

.btn-qty {
    background: white;
    border: 1px solid #e2e8f0;
    color: var(--text-dark);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: var(--transition);
}

.btn-qty:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.qty-val {
    font-size: 13px;
    font-weight: 700;
    width: 32px;
    text-align: center;
    color: var(--text-dark);
}

/* Footer del Modal */
.cart-modal-footer {
    padding: 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.total-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
}

.total-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
}

.cart-actions-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.btn-clear-cart {
    background: white;
    border: 1px solid #cbd5e1;
    color: #ef4444;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    flex-basis: 30%;
}

.btn-clear-cart:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.btn-whatsapp-checkout {
    background-color: var(--whatsapp-color);
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-grow: 2;
    flex-basis: 70%;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.btn-whatsapp-checkout:hover {
    background-color: var(--whatsapp-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

.icon-whatsapp {
    width: 20px;
    height: 20px;
    fill: white;
}

.cart-disclaimer {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

.turnstile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    min-height: 65px;
}

/* Adaptación para pantallas de tablets/móviles */
@media (max-width: 768px) {
    .cart-bar {
        bottom: 16px;
        width: 92%;
        padding: 10px 16px;
        border-radius: 20px;
    }

    .cart-bar-content {
        gap: 10px;
    }

    .cart-icon-container {
        padding: 8px;
    }

    .cart-icon {
        width: 20px;
        height: 20px;
    }

    .cart-bar-title {
        font-size: 13px;
    }

    .cart-bar-summary {
        font-size: 11px;
    }

    .cart-bar-total {
        font-size: 16px;
    }

    .btn-checkout-bar {
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 10px;
    }

    .cart-modal {
        max-width: 100%;
        right: -100%;
    }
    
    td.col-pedir:before {
        content: "Pedir";
    }
}

/* Mejoras específicas para pantallas pequeñas (smartphones) */
@media (max-width: 480px) {
    .cart-bar {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 8px 12px;
    }
    .btn-checkout-bar {
        padding: 8px 10px;
        font-size: 11px;
    }
    .cart-modal {
        width: 100%;
        max-width: 100%;
    }
    .cart-modal-header {
        padding: 12px 16px;
    }
    .cart-items-list {
        padding: 12px 16px;
    }
    .cart-item-info {
        gap: 8px;
    }
    .cart-item-name {
        font-size: 13px;
    }
    .cart-modal-footer {
        padding: 16px;
    }
    .cart-total-row {
        margin-bottom: 12px;
    }
    .total-price {
        font-size: 20px;
    }
    .cart-actions-row {
        flex-direction: column;
        gap: 8px;
    }
    .btn-clear-cart {
        order: 2;
        width: 100%;
        padding: 10px;
    }
    .btn-whatsapp-checkout {
        order: 1;
        width: 100%;
        padding: 14px;
        font-size: 14px;
    }
}
