/* ==========================================================================
   Pizzas Watson — Botón flotante del carrito
   ========================================================================== */

.pw-cart-trigger {
    position: fixed;
    right: 22px;
    bottom: 88px;
    z-index: 1100;

    min-height: 56px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 0 18px;

    border: 0;
    border-radius: 999px;

    color: var(--pw-white);
    background: var(--pw-dark);

    font-family: var(--pw-font-body);
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 18px 42px
        rgba(29, 18, 16, 0.28);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.pw-cart-trigger:hover {
    transform: translateY(-3px);

    box-shadow:
        0 22px 48px
        rgba(29, 18, 16, 0.34);
}

.pw-cart-trigger:focus-visible {
    outline: 3px solid rgba(197, 22, 29, 0.38);
    outline-offset: 4px;
}

.pw-cart-trigger__icon {
    width: 24px;
    height: 24px;

    flex: 0 0 24px;

    display: block;

    object-fit: contain;
}

.pw-cart-trigger__text {
    line-height: 1.2;
    white-space: nowrap;
}

.pw-cart-trigger__count {
    min-width: 28px;
    height: 28px;

    display: inline-grid;
    place-items: center;

    padding: 0 7px;

    border-radius: 999px;

    color: var(--pw-dark);
    background: var(--pw-yellow);

    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
}

body.pw-cart-open {
    overflow: hidden;
}

/* ==========================================================================
   Fondo y panel lateral
   ========================================================================== */

.pw-cart {
    position: fixed;
    inset: 0;
    z-index: 2000;

    visibility: hidden;

    pointer-events: none;
}

.pw-cart.is-open {
    visibility: visible;

    pointer-events: auto;
}

.pw-cart__overlay {
    position: absolute;
    inset: 0;

    background: rgba(29, 18, 16, 0.62);

    opacity: 0;

    transition: opacity 0.25s ease;
}

.pw-cart.is-open .pw-cart__overlay {
    opacity: 1;
}

.pw-cart__panel {
    position: absolute;
    top: 0;
    right: 0;

    width: min(100%, 480px);
    height: 100%;
    height: 100dvh;

    display: grid;

    grid-template-rows:
        auto
        minmax(0, 1fr)
        auto;

    color: var(--pw-text);
    background: var(--pw-white);

    box-shadow:
        -24px 0 70px
        rgba(29, 18, 16, 0.22);

    transform: translateX(100%);

    transition: transform 0.25s ease;
}

.pw-cart.is-open .pw-cart__panel {
    transform: translateX(0);
}

/* ==========================================================================
   Encabezado
   ========================================================================== */

.pw-cart__header {
    position: relative;
    z-index: 1;

    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 22px 24px;

    border-bottom: 1px solid var(--pw-border);

    background: var(--pw-white);
}

.pw-cart__header > div {
    min-width: 0;
}

.pw-cart__header > div > span {
    display: block;

    margin-bottom: 4px;

    color: var(--pw-red);

    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pw-cart__header h2 {
    margin: 0;

    color: var(--pw-dark);

    font-family: var(--pw-font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;

    overflow-wrap: anywhere;
}

/* ==========================================================================
   Botón de cierre
   ========================================================================== */

.pw-cart__close {
    width: 44px;
    height: 44px;

    flex: 0 0 44px;

    display: grid;
    place-items: center;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 14px;

    color: var(--pw-white);
    background: var(--pw-dark);

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.pw-cart__close > span {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    margin: 0;
    padding: 0;

    color: var(--pw-white);

    font-family: Arial, sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;

    transform: translateY(-1px);
}

.pw-cart__close:hover {
    background: var(--pw-red);

    transform: scale(1.04);
}

.pw-cart__close:focus-visible {
    outline: 3px solid rgba(197, 22, 29, 0.35);
    outline-offset: 3px;
}

/* ==========================================================================
   Contenido y listado de productos
   ========================================================================== */

.pw-cart__body {
    min-height: 0;

    padding: 20px 22px;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;
}

.pw-cart__empty {
    padding: 34px 22px;

    border: 1px dashed var(--pw-border);
    border-radius: var(--pw-radius-md);

    text-align: center;

    background: #fffaf0;
}

.pw-cart__empty strong {
    display: block;

    color: var(--pw-dark);

    font-size: 1.12rem;
    font-weight: 800;
}

.pw-cart__empty p {
    margin: 10px 0 0;

    color: var(--pw-muted);

    font-size: 0.94rem;
    line-height: 1.6;
}

.pw-cart__items {
    display: grid;

    gap: 14px;
}

/* ==========================================================================
   Producto dentro del carrito
   ========================================================================== */

.pw-cart-item {
    min-width: 0;

    display: grid;

    grid-template-columns:
        76px
        minmax(0, 1fr);

    align-items: start;

    gap: 14px;

    padding: 14px;

    border: 1px solid var(--pw-border);
    border-radius: var(--pw-radius-md);

    background: #fffaf0;
}

.pw-cart-item__image {
    width: 76px;
    height: 76px;

    overflow: hidden;

    border-radius: 14px;

    background: var(--pw-cream);
}

.pw-cart-item__image img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}

.pw-cart-item__placeholder {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    font-size: 2rem;
}

.pw-cart-item__content {
    min-width: 0;
}

.pw-cart-item__content h3 {
    margin: 0;

    color: var(--pw-dark);

    font-family: var(--pw-font-heading);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.015em;

    overflow-wrap: anywhere;
}

.pw-cart-item__flavors,
.pw-cart-item__options {
    margin: 5px 0 0;

    color: var(--pw-muted);

    font-size: 0.78rem;
    line-height: 1.4;
}

.pw-cart-item__price {
    display: block;

    margin-top: 6px;

    color: var(--pw-red);

    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.pw-cart-item__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;

    gap: 7px;

    margin-top: 11px;
}

.pw-cart-item__actions button {
    min-width: 34px;
    height: 34px;

    display: inline-grid;
    place-items: center;

    padding: 0 8px;

    border: 1px solid var(--pw-border);
    border-radius: 10px;

    color: var(--pw-dark);
    background: var(--pw-white);

    font-size: 0.86rem;
    font-weight: 800;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.pw-cart-item__actions button:hover {
    border-color: var(--pw-red);

    transform: translateY(-1px);
}

.pw-cart-item__actions button:focus-visible {
    outline: 3px solid rgba(197, 22, 29, 0.22);
    outline-offset: 2px;
}

.pw-cart-item__remove {
    width: auto;

    padding: 0 10px !important;

    color: var(--pw-red) !important;
}

/* ==========================================================================
   Pie del carrito
   ========================================================================== */

.pw-cart__footer {
    max-height: 62vh;
    max-height: 62dvh;

    padding: 20px 22px;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;

    border-top: 1px solid var(--pw-border);

    background: #fffaf0;
}

/* ==========================================================================
   Modalidad del pedido
   ========================================================================== */

.pw-cart__fulfillment {
    min-width: 0;

    margin: 0 0 17px;
    padding: 0;

    border: 0;
}

.pw-cart__fulfillment > legend,
.pw-cart__fulfillment-title {
    width: 100%;

    display: block;

    margin: 0 0 10px;
    padding: 0;

    color: var(--pw-dark);

    font-family: var(--pw-font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
}

.pw-cart__fulfillment-options,
.pw-cart__fulfillment-list {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 9px;
}

.pw-cart__fulfillment-option {
    position: relative;

    min-width: 0;
    min-height: 53px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 10px 11px;

    border: 1px solid var(--pw-border);
    border-radius: 13px;

    color: var(--pw-text);
    background: var(--pw-white);

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.pw-cart__fulfillment-option:hover {
    border-color: rgba(197, 22, 29, 0.4);
}

.pw-cart__fulfillment-option:has(
    input[data-cart-fulfillment]:checked
) {
    border-color: rgba(197, 22, 29, 0.55);

    background: rgba(197, 22, 29, 0.045);

    box-shadow:
        0 0 0 2px
        rgba(197, 22, 29, 0.08);
}

.pw-cart__fulfillment-option:has(
    input[data-cart-fulfillment]:focus-visible
) {
    outline: 3px solid rgba(197, 22, 29, 0.25);
    outline-offset: 2px;
}

.pw-cart__fulfillment-option input[data-cart-fulfillment] {
    width: 17px;
    height: 17px;

    flex: 0 0 17px;

    margin: 0;

    accent-color: var(--pw-red);

    cursor: pointer;
}

.pw-cart__fulfillment-option > span {
    min-width: 0;

    color: var(--pw-dark);

    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}

.pw-cart__fulfillment-option > span strong {
    display: block;

    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
}

.pw-cart__fulfillment-option > span small {
    display: block;

    margin-top: 3px;

    color: var(--pw-muted);

    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.25;
}

/* ==========================================================================
   Desglose del pedido y cobro de empaque
   ========================================================================== */

.pw-cart__breakdown,
[data-cart-breakdown] {
    display: grid;

    gap: 9px;

    margin-bottom: 14px;
    padding: 13px 0;

    border-top: 1px solid var(--pw-border);
    border-bottom: 1px solid var(--pw-border);
}

.pw-cart__breakdown-row,
.pw-cart__subtotal,
.pw-cart__packaging-row,
[data-cart-packaging-row] {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.pw-cart__breakdown-row > span:first-child,
.pw-cart__subtotal > span:first-child,
.pw-cart__packaging-row > span:first-child,
[data-cart-packaging-row] > span:first-child {
    min-width: 0;

    color: var(--pw-muted);

    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.pw-cart__breakdown-row > strong,
.pw-cart__subtotal > strong,
.pw-cart__packaging-row > strong,
[data-cart-subtotal],
[data-cart-packaging-total] {
    flex: 0 0 auto;

    color: var(--pw-dark);

    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;

    white-space: nowrap;
}

[data-cart-packaging-row] [data-cart-packaging-count] {
    color: var(--pw-muted);

    font-size: 0.76rem;
    font-weight: 600;
}

.pw-cart__packaging-note,
[data-cart-packaging-note] {
    margin: 0;

    color: var(--pw-muted);

    font-size: 0.75rem;
    line-height: 1.45;
}

/*
 * Respeta los elementos que JavaScript oculta
 * mediante el atributo HTML hidden.
 */

.pw-cart [hidden] {
    display: none !important;
}

/* ==========================================================================
   Total estimado
   ========================================================================== */

.pw-cart__total {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 17px;
}

.pw-cart__total > span {
    color: var(--pw-muted);

    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.pw-cart__total > strong,
.pw-cart__total [data-cart-total] {
    color: var(--pw-red);

    font-family: var(--pw-font-heading);
    font-size: 1.48rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;

    white-space: nowrap;
}

/* ==========================================================================
   Campos del cliente
   ========================================================================== */

.pw-cart__field {
    min-width: 0;

    display: grid;

    gap: 7px;

    margin-top: 14px;
}

.pw-cart__field > span {
    color: var(--pw-dark);

    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.25;
}

.pw-cart__field input,
.pw-cart__field textarea {
    width: 100%;

    padding: 12px 14px;

    border: 1px solid var(--pw-border);
    border-radius: 13px;

    color: var(--pw-text);
    background: var(--pw-white);

    font-family: var(--pw-font-body);
    font-size: 0.92rem;
    line-height: 1.4;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.pw-cart__field input::placeholder,
.pw-cart__field textarea::placeholder {
    color: rgba(124, 104, 96, 0.78);
}

.pw-cart__field textarea {
    min-height: 88px;

    resize: vertical;
}

.pw-cart__field input:focus,
.pw-cart__field textarea:focus {
    border-color: var(--pw-red);

    outline: 3px solid rgba(255, 201, 60, 0.35);
    outline-offset: 1px;
}

/* ==========================================================================
   Botones del pedido
   ========================================================================== */

.pw-cart__checkout,
.pw-cart__clear {
    width: 100%;
    min-height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-top: 16px;
    padding: 0 16px;

    border-radius: 999px;

    font-family: var(--pw-font-body);
    font-size: 0.93rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.pw-cart__checkout {
    border: 0;

    color: var(--pw-white);
    background: #22c55e;
}

.pw-cart__checkout:hover {
    background: #16a34a;

    transform: translateY(-1px);
}

.pw-cart__checkout.is-disabled,
.pw-cart__checkout[aria-disabled="true"] {
    opacity: 0.55;

    pointer-events: none;
}

.pw-cart__clear {
    border: 1px solid var(--pw-border);

    color: var(--pw-red);
    background: transparent;

    cursor: pointer;
}

.pw-cart__clear:hover {
    border-color: rgba(197, 22, 29, 0.5);

    background: rgba(197, 22, 29, 0.04);
}

.pw-cart__checkout:focus-visible,
.pw-cart__clear:focus-visible {
    outline: 3px solid rgba(197, 22, 29, 0.28);
    outline-offset: 3px;
}

/* ==========================================================================
   Advertencias
   ========================================================================== */

.pw-cart__warning {
    margin: 16px 0 0;
    padding: 14px;

    border-radius: 13px;

    color: #7c2d12;
    background: #ffedd5;

    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.5;
}

/* ==========================================================================
   Móviles
   ========================================================================== */

@media (max-width: 560px) {
    .pw-cart-trigger {
        right: 14px;
        bottom: 80px;

        min-height: 52px;

        gap: 8px;

        padding: 0 13px;
    }

    .pw-cart-trigger__text {
        display: none;
    }

    .pw-cart-trigger__icon {
        width: 23px;
        height: 23px;

        flex-basis: 23px;
    }

    .pw-cart-trigger__count {
        min-width: 26px;
        height: 26px;
    }

    .pw-cart__panel {
        width: 100%;
    }

    .pw-cart__header {
        gap: 12px;

        padding: 17px 18px;
    }

    .pw-cart__header h2 {
        font-size: 1.32rem;
    }

    .pw-cart__close {
        width: 42px;
        height: 42px;

        flex-basis: 42px;

        border-radius: 12px;
    }

    .pw-cart__body {
        padding: 16px 18px;
    }

    .pw-cart__footer {
        max-height: 64vh;
        max-height: 64dvh;

        padding: 17px 18px;
    }

    .pw-cart-item {
        grid-template-columns:
            64px
            minmax(0, 1fr);

        gap: 11px;

        padding: 12px;
    }

    .pw-cart-item__image {
        width: 64px;
        height: 64px;

        border-radius: 12px;
    }

    .pw-cart-item__content h3 {
        font-size: 0.92rem;
    }

    .pw-cart-item__actions {
        gap: 6px;

        margin-top: 9px;
    }

    .pw-cart-item__actions button {
        min-width: 32px;
        height: 32px;

        font-size: 0.81rem;
    }

    .pw-cart__fulfillment-options,
    .pw-cart__fulfillment-list {
        gap: 8px;
    }

    .pw-cart__fulfillment-option {
        min-height: 50px;

        gap: 7px;

        padding: 9px;
    }

    .pw-cart__fulfillment-option > span {
        font-size: 0.75rem;
    }

    .pw-cart__total > strong,
    .pw-cart__total [data-cart-total] {
        font-size: 1.36rem;
    }

    .pw-cart__field input,
    .pw-cart__field textarea {
        /*
         * Evita el zoom automático de Safari
         * al enfocar campos en iPhone.
         */

        font-size: 16px;
    }
}

/* ==========================================================================
   Teléfonos pequeños
   ========================================================================== */

@media (max-width: 380px) {
    .pw-cart__header,
    .pw-cart__body,
    .pw-cart__footer {
        padding-inline: 14px;
    }

    .pw-cart__header h2 {
        font-size: 1.2rem;
    }

    .pw-cart__fulfillment-options,
    .pw-cart__fulfillment-list {
        grid-template-columns: 1fr;
    }

    .pw-cart__fulfillment-option {
        min-height: 46px;
    }

    .pw-cart-item {
        grid-template-columns:
            56px
            minmax(0, 1fr);

        gap: 9px;

        padding: 10px;
    }

    .pw-cart-item__image {
        width: 56px;
        height: 56px;
    }

    .pw-cart-item__content h3 {
        font-size: 0.86rem;
    }

    .pw-cart-item__actions {
        gap: 5px;
    }

    .pw-cart-item__actions button {
        min-width: 30px;
        height: 30px;

        padding-inline: 6px;
    }

    .pw-cart__total > span {
        font-size: 0.85rem;
    }

    .pw-cart__total > strong,
    .pw-cart__total [data-cart-total] {
        font-size: 1.24rem;
    }
}

/* ==========================================================================
   Accesibilidad: reducción de movimiento
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .pw-cart-trigger,
    .pw-cart__overlay,
    .pw-cart__panel,
    .pw-cart__close,
    .pw-cart-item__actions button,
    .pw-cart__fulfillment-option,
    .pw-cart__checkout,
    .pw-cart__clear {
        transition: none;
    }

    .pw-cart-trigger:hover,
    .pw-cart__close:hover,
    .pw-cart-item__actions button:hover,
    .pw-cart__checkout:hover {
        transform: none;
    }
}