﻿body.portal-modal-abierto {
    overflow: hidden;
}

.portal-carrito-flotante {
    position: fixed;
    z-index: 950;
    right: 24px;
    bottom: 24px;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #181c22;
    color: #ffffff;
    font-size: 1.45rem;
    cursor: pointer;
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
}

    .portal-carrito-flotante:hover {
        transform: translateY(-3px);
        background: #252a32;
    }

    .portal-carrito-flotante span {
        position: absolute;
        top: -4px;
        right: -2px;
        min-width: 23px;
        height: 23px;
        display: grid;
        place-items: center;
        padding: 0 6px;
        border: 2px solid #ffffff;
        border-radius: 999px;
        background: #e53945;
        color: #ffffff;
        font-size: 0.72rem;
        font-weight: 800;
    }

.portal-modal-fondo {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 18, 23, 0.66);
    backdrop-filter: blur(2px);
}

    .portal-modal-fondo[hidden] {
        display: none;
    }

.portal-modal {
    width: min(520px, 100%);
    max-height: calc(100vh - 36px);
    overflow: hidden;
    border-radius: 17px;
    background: #ffffff;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
    animation: portalModalEntrada 0.2s ease;
}

.portal-modal-carrito {
    width: min(650px, 100%);
}

@keyframes portalModalEntrada {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.portal-modal-encabezado {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 19px;
    background: #181c22;
    color: #ffffff;
}

    .portal-modal-encabezado h2 {
        margin: 0;
        font-size: 1.15rem;
        font-weight: 800;
    }

    .portal-modal-encabezado button {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        flex: 0 0 auto;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #ffffff;
        font-size: 1.1rem;
        cursor: pointer;
    }

        .portal-modal-encabezado button:hover {
            background: rgba(255, 255, 255, 0.12);
        }

.portal-modal-cuerpo {
    max-height: calc(100vh - 210px);
    padding: 20px;
    overflow-y: auto;
}

    .portal-modal-cuerpo h3 {
        margin: 0 0 5px;
        color: #252a32;
        font-size: 1rem;
    }

    .portal-modal-cuerpo p {
        margin: 4px 0;
        color: #667085;
        font-size: 0.9rem;
    }

    .portal-modal-cuerpo label {
        display: block;
        margin: 17px 0 7px;
        color: #344054;
        font-size: 0.87rem;
        font-weight: 700;
    }

    .portal-modal-cuerpo > input[type="number"] {
        width: 100%;
        min-height: 40px;
        padding: 8px 11px;
        border: 1px solid #d0d5dd;
        border-radius: 8px;
        outline: none;
    }

        .portal-modal-cuerpo > input[type="number"]:focus {
            border-color: #1677ff;
            box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
        }

.portal-modal-error {
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 7px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.82rem;
    font-weight: 700;
}

.portal-modal-pie {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 19px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

    .portal-modal-pie button {
        min-height: 39px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 8px 14px;
        border: 0;
        border-radius: 8px;
        font-size: 0.85rem;
        font-weight: 700;
        cursor: pointer;
    }

.portal-boton-principal {
    background: #1677ff;
    color: #ffffff;
}

.portal-boton-secundario {
    background: #eaecf0;
    color: #344054;
}

.portal-boton-peligro {
    margin-right: auto;
    background: #e53945;
    color: #ffffff;
}

.portal-boton-whatsapp {
    background: #19c96d;
    color: #ffffff;
}

.portal-modal-pie button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.portal-carrito-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-carrito-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 11px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #ffffff;
}

.portal-carrito-item-imagen {
    width: 58px;
    height: 58px;
    overflow: hidden;
    border-radius: 9px;
    background: #f2f4f7;
}

    .portal-carrito-item-imagen img {
        width: 100%;
        height: 100%;
        display: block;
        object-fit: contain;
    }

.portal-carrito-item-sin-imagen {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #98a2b3;
    font-size: 1.2rem;
}

.portal-carrito-item-info {
    min-width: 0;
}

    .portal-carrito-item-info h3 {
        margin: 0 0 3px;
        overflow: hidden;
        color: #252a32;
        font-size: 0.9rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .portal-carrito-item-info span {
        display: block;
        color: #667085;
        font-size: 0.77rem;
    }

.portal-carrito-item-precio {
    margin-top: 4px;
    color: #111827 !important;
    font-weight: 800;
}

.portal-carrito-cantidad {
    width: 72px;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    text-align: center;
}

.portal-carrito-eliminar {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: #e53945;
    color: #ffffff;
    cursor: pointer;
}

.portal-carrito-vacio {
    padding: 35px 15px;
    border: 1px dashed #d0d5dd;
    border-radius: 12px;
    color: #667085;
    text-align: center;
}

.portal-carrito-resumen {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    color: #344054;
    font-size: 0.9rem;
}

.portal-carrito-total-precio {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #182230;
    font-size: 1rem;
    font-weight: 800;
}

.portal-carrito-notificacion {
    position: fixed;
    z-index: 2600;
    right: 24px;
    bottom: 100px;
    max-width: min(330px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: 10px;
    background: #181c22;
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 700;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.25);
    animation: portalNotificacionEntrada 0.2s ease;
}

@keyframes portalNotificacionEntrada {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .portal-carrito-flotante {
        right: 17px;
        bottom: 17px;
        width: 56px;
        height: 56px;
    }

    .portal-modal-fondo {
        align-items: flex-end;
        padding: 0;
    }

    .portal-modal {
        width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }

    .portal-modal-cuerpo {
        max-height: calc(92vh - 190px);
    }

    .portal-carrito-item {
        grid-template-columns: 48px minmax(0, 1fr) auto;
    }

    .portal-carrito-item-imagen {
        width: 48px;
        height: 48px;
    }

    .portal-carrito-cantidad {
        grid-column: 2;
        width: 85px;
    }

    .portal-carrito-eliminar {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .portal-carrito-acciones {
        flex-wrap: wrap;
    }

    .portal-boton-peligro {
        margin-right: 0;
    }

    .portal-boton-whatsapp {
        width: 100%;
        order: -1;
    }
}
