/* ==========================================================
   RETAPIZAVE - Estilos del carrito de pedido
   Autocontenido: no depende de las clases compiladas en tailwind.css.
   Colores del sitio: navy #21437d · navy-dark #18325e · celeste #d2e8ff
   ========================================================== */

/* ---------- Corrección: desborde horizontal en móvil ----------
   Las animaciones de entrada (translateX) de animaciones.css empujaban la página a ~444px
   en pantallas de 390px; Chrome móvil ensanchaba el viewport y los elementos "fixed"
   (panel, avisos) quedaban desplazados. "clip" recorta sin crear contenedor de scroll,
   por lo que el header "sticky" sigue funcionando. */
@supports (overflow: clip) {
    html, body { overflow-x: clip; }
}

/* ---------- Botón del carrito en el header ---------- */
.rv-cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    border: 2px solid rgba(33, 67, 125, .2);
    background: #fff;
    color: #21437d;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, transform .2s;
}
.rv-cart-btn:hover { background: rgba(33, 67, 125, .08); border-color: #21437d; }
.rv-cart-btn:focus-visible { outline: 3px solid #6ea8ff; outline-offset: 2px; }
.rv-cart-btn-desk { margin-right: .75rem; }
.rv-cart-btn-mob { margin-right: .25rem; }
@media (min-width: 768px) { .rv-cart-btn-mob { display: none; } }

.rv-cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .3rem;
    border-radius: 9999px;
    background: #f59e0b;
    color: #18325e;
    border: 2px solid #fff;
    font-size: .68rem;
    font-weight: 800;
    line-height: calc(1.25rem - 4px);
    text-align: center;
    box-sizing: content-box;
    display: none;
}
.rv-cart-badge.has-items { display: block; }
.rv-cart-btn.rv-bump { animation: rvBump .45s ease; }
@keyframes rvBump { 30% { transform: scale(1.18); } 60% { transform: scale(.94); } }

/* ---------- Botones dentro de las tarjetas del catálogo ---------- */
.rv-btn-outline {
    background: #fff;
    color: #21437d;
    border: 2px solid #21437d;
    transition: background-color .2s;
}
.rv-btn-outline:hover { background: rgba(33, 67, 125, .08); }

.rv-size-label { display: block; margin-bottom: .6rem; }
.rv-size-label > span {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #4b5563;
    margin-bottom: .25rem;
}
.rv-size-select {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: .75rem;
    padding: .55rem .75rem;
    font-size: .8rem;
    font-weight: 600;
    color: #1f2937;
}
.rv-size-select:focus { outline: none; border-color: #21437d; box-shadow: 0 0 0 3px rgba(33, 67, 125, .15); }

/* ---------- Panel lateral ---------- */
body.rv-cart-lock { overflow: hidden; }

.rv-cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s;
}
.rv-cart-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .3s ease; }

.rv-cart {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 71;
    width: min(100%, 26rem);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -12px 0 40px rgba(15, 23, 42, .25);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #1f2937;
}
.rv-cart.is-open { transform: none; visibility: visible; transition: transform .3s ease; }
@supports (height: 100dvh) { .rv-cart { height: 100dvh; } }

.rv-cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.25rem;
    background: #21437d;
    color: #fff;
}
.rv-cart-title { margin: 0; font-size: 1.15rem; font-weight: 800; outline: none; }
.rv-cart-title i { margin-right: .4rem; color: #d2e8ff; }
.rv-cart-close {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    border: 0;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
.rv-cart-close:hover { background: rgba(255, 255, 255, .3); }

.rv-cart-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; overscroll-behavior: contain; }

/* Estado vacío */
.rv-empty { text-align: center; padding: 2.5rem 1rem; color: #6b7280; }
.rv-empty-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    border-radius: 9999px;
    background: rgba(33, 67, 125, .08);
    color: #21437d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.rv-empty p { margin: 0 0 1rem; font-size: .9rem; }
.rv-empty-links { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.rv-empty-links a {
    padding: .55rem 1rem;
    border-radius: 9999px;
    background: #21437d;
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    text-decoration: none;
}
.rv-empty-links a:hover { background: #18325e; }

/* Productos */
.rv-item {
    display: grid;
    grid-template-columns: 4.5rem 1fr auto;
    gap: .75rem;
    padding: .85rem 0;
    border-bottom: 1px solid #e5e7eb;
}
.rv-item:first-child { padding-top: 0; }
.rv-item-img { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: .75rem; background: #f3f4f6; }
.rv-item-title { margin: 0; font-size: .9rem; font-weight: 700; color: #21437d; line-height: 1.25; word-break: break-word; }
.rv-item-meta { margin: .15rem 0 0; font-size: .75rem; color: #6b7280; }
.rv-item-unit { margin: .15rem 0 .45rem; font-size: .75rem; color: #6b7280; }
.rv-item-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.rv-item-sub { margin: 0; font-size: .95rem; font-weight: 800; color: #21437d; }
.rv-remove {
    border: 0;
    background: transparent;
    color: #9ca3af;
    width: 2rem;
    height: 2rem;
    border-radius: .5rem;
    cursor: pointer;
}
.rv-remove:hover { color: #dc2626; background: #fef2f2; }

.rv-qty { display: inline-flex; align-items: center; border: 1px solid #d1d5db; border-radius: 9999px; overflow: hidden; }
.rv-qty button {
    width: 2rem;
    height: 2rem;
    border: 0;
    background: #f9fafb;
    color: #21437d;
    font-size: .7rem;
    cursor: pointer;
}
.rv-qty button:hover:not(:disabled) { background: rgba(33, 67, 125, .12); }
.rv-qty button:disabled { color: #d1d5db; cursor: not-allowed; }
.rv-qty span { min-width: 2rem; text-align: center; font-size: .85rem; font-weight: 700; }

/* Datos opcionales */
.rv-extra { margin-top: 1rem; padding: 1rem; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 1rem; }
.rv-extra[hidden] { display: none; }
.rv-extra label { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; margin-bottom: .25rem; }
.rv-extra label small { text-transform: none; letter-spacing: 0; font-weight: 500; color: #9ca3af; }
.rv-extra input, .rv-extra textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: .75rem;
    padding: .55rem .75rem;
    font: inherit;
    font-size: .85rem;
    background: #fff;
    margin-bottom: .75rem;
}
.rv-extra textarea { resize: vertical; min-height: 4rem; margin-bottom: 0; }
.rv-extra input:focus, .rv-extra textarea:focus { outline: none; border-color: #21437d; box-shadow: 0 0 0 3px rgba(33, 67, 125, .15); }

/* Pie con total y botón de WhatsApp */
.rv-cart-foot {
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 -6px 16px rgba(15, 23, 42, .06);
}
.rv-cart-foot[hidden] { display: none; }
.rv-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .75rem; }
.rv-total span { font-size: .8rem; font-weight: 700; text-transform: uppercase; color: #4b5563; }
.rv-total strong { font-size: 1.6rem; font-weight: 900; color: #21437d; }
.rv-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    box-sizing: border-box;
    padding: .95rem 1rem;
    border-radius: 1rem;
    background: #16a34a;
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(22, 163, 74, .3);
    transition: background-color .2s;
}
.rv-wa:hover { background: #15803d; }
.rv-wa i { font-size: 1.4rem; }
.rv-wa[aria-disabled="true"] { background: #9ca3af; box-shadow: none; pointer-events: none; }
.rv-clear {
    display: block;
    margin: .7rem auto 0;
    border: 0;
    background: transparent;
    color: #6b7280;
    font-size: .78rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}
.rv-clear:hover, .rv-clear.is-armed { color: #dc2626; }
.rv-note { margin: .6rem 0 0; font-size: .7rem; line-height: 1.4; color: #9ca3af; text-align: center; }

/* ---------- Aviso al agregar ---------- */
.rv-toast {
    position: fixed;
    left: 50%;
    bottom: 11rem; /* por encima del botón flotante de WhatsApp */
    z-index: 75;
    max-width: calc(100% - 2rem);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    border-radius: 9999px;
    background: #18325e;
    color: #fff;
    font-size: .82rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .35);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 12px);
    transition: opacity .25s, transform .25s, visibility 0s linear .25s;
}
.rv-toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .25s, transform .25s; }
.rv-toast i.rv-toast-ok { color: #4ade80; }
.rv-toast i.rv-toast-warn { color: #fbbf24; }
.rv-toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-toast button {
    flex-shrink: 0;
    border: 0;
    border-radius: 9999px;
    padding: .3rem .8rem;
    background: #d2e8ff;
    color: #18325e;
    font-weight: 800;
    font-size: .75rem;
    cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
    .rv-cart, .rv-cart-overlay, .rv-toast { transition: none; }
    .rv-cart-btn.rv-bump { animation: none; }
}

/* Precio de promoción en divisas (tarjetas del catálogo) */
.rv-promo { margin: 0 0 .6rem; }
.rv-promo-tag {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    color: #92400e; background: #fef3c7; border: 1px solid #fde68a;
    padding: .15rem .55rem; border-radius: 999px; margin-bottom: .25rem;
}
