/* ── Cart overlay ── */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.overlay[hidden] { display: none; }
.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.overlay-panel {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: overlayIn 0.25s ease;
}
@keyframes overlayIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-rosa-borde);
}
.overlay-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--color-texto-oscuro); }
.overlay-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    color: var(--color-texto);
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.overlay-close:hover { color: #dc2626; background: var(--color-melocoton); }
.overlay-items {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.overlay-promo-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    margin: 0 20px 8px;
    background: #E8F5E9;
    border: 1.5px solid var(--color-verde);
    border-radius: 10px;
}
.overlay-promo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.overlay-promo-info { flex: 1; min-width: 0; }
.overlay-promo-title { font-weight: 700; font-size: 0.85rem; color: var(--color-verde); }
.overlay-promo-sub { font-size: 0.75rem; color: var(--color-texto); line-height: 1.3; }
.overlay-promo-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    background: #dc2626;
    color: white;
}
.overlay-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-rosa-borde);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.overlay-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-texto-oscuro);
}
.overlay-footer .btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.overlay-footer .btn-primary {
    background: #25D366;
    color: white;
    border: none;
}
.overlay-footer .btn-primary:hover { background: #1da851; }
.overlay-footer .btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.overlay-footer .btn-secondary {
    background: var(--color-crema);
    color: #dc2626;
    border: 1.5px solid var(--color-rosa-borde);
}
.overlay-footer .btn-secondary:hover { border-color: #dc2626; background: var(--color-melocoton); }
.overlay-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-rosa-borde);
}
.overlay-item:last-child { border-bottom: none; }
.overlay-item-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-crema);
}
.overlay-item-img img { width: 100%; height: 100%; object-fit: contain; }
.overlay-item-img .placeholder { font-size: 1.2rem; color: var(--color-rosa-borde); }
.overlay-item-info { flex: 1; min-width: 0; }
.overlay-item-name { font-weight: 700; font-size: 0.9rem; color: var(--color-texto-oscuro); }
.overlay-item-price { font-size: 0.85rem; font-weight: 600; color: var(--color-texto); }
.overlay-item-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}
.overlay-item-qty .qty-btn {
    width: 36px; height: 36px;
    border: 1.5px solid var(--color-rosa-borde);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-texto);
}
.overlay-item-qty .qty-btn:hover { border-color: var(--color-rosa); background: var(--color-melocoton); }
.overlay-item-qty .qty-num {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}
.overlay-item-subtotal {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-texto-oscuro);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}
.overlay-item-remove {
    border: none;
    background: none;
    color: var(--color-texto);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.overlay-item-remove:hover { color: #dc2626; background: var(--color-melocoton); }
.overlay-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-texto);
}
.overlay-empty .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.overlay-empty p { font-size: 1rem; font-weight: 600; }

@media (max-width: 1024px) {
    .overlay { align-items: flex-end; }
    .overlay-panel {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        animation: overlaySlideUp 0.3s ease;
    }
    @keyframes overlaySlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .overlay-panel { animation: none; }
}
