/* Pipe Chat - Estilos del Widget de Chat */

/* =========================================================
   Variables CSS (dark theme por defecto)
   Sobreescritas por el bloque <style> inline del template
   ========================================================= */
#pipe-chat-widget-container {
    --pipe-header-bg       : #111827;
    --pipe-chat-bg         : #0f172a;
    --pipe-accent          : #25D366;

    /* Derivados — se calculan en base a los anteriores */
    --pipe-bot-bubble-bg   : #1e293b;
    --pipe-bot-bubble-text : #e2e8f0;
    --pipe-bot-bubble-border: #334155;
    --pipe-user-bubble-bg  : #1a3a2a;
    --pipe-user-bubble-text: #d1fae5;
    --pipe-input-bg        : #1e293b;
    --pipe-input-border    : #334155;
    --pipe-input-text      : #e2e8f0;
    --pipe-input-area-bg   : #111827;
    --pipe-input-area-border: #1e293b;
    --pipe-time-color      : #64748b;
    --pipe-scrollbar       : #334155;
    --pipe-typing-bg       : #111827;
    --pipe-typing-dot      : #64748b;
    --pipe-window-shadow   : rgba(0, 0, 0, 0.6);
}

/* Contenedor del Widget */
#pipe-chat-widget-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.pipe-chat-widget-right {
    bottom: 20px;
    right: 20px;
}

.pipe-chat-widget-left {
    bottom: 20px;
    left: 20px;
}

/* Botón de Chat */
.pipe-chat-button {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer;
    /* Anillo brillante configurable + halo difuso + sombra base.
       El color sale de --pipe-button-ring que setea el template. */
    box-shadow:
        0 0 0 3px var(--pipe-button-ring, transparent),
        0 0 18px 4px var(--pipe-button-ring-glow, transparent),
        0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    /* No overflow:hidden — el badge se sale del botón y lo escondería.
       background-size:cover queda igual recortado al border-radius. */
    padding: 0 !important;
    outline: none;
    background-clip: padding-box;
    animation: pipeRingPulse 2.4s ease-in-out infinite;
}

/* Cuando el chat está abierto, ocultamos el botón flotante de verdad.
   jQuery .hide() solo no alcanza porque "display: flex !important" gana
   sobre el inline style. Sin esto el botón sigue animándose detrás de la
   ventana y en iOS Safari produce artefactos de repaint durante el scroll. */
#pipe-chat-widget-container.pipe-chat-is-open .pipe-chat-button,
#pipe-chat-widget-container.pipe-chat-is-open .pipe-chat-badge {
    display: none !important;
    animation: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes pipeRingPulse {
    0%, 100% { box-shadow:
        0 0 0 3px var(--pipe-button-ring, transparent),
        0 0 14px 3px var(--pipe-button-ring-glow, transparent),
        0 4px 12px rgba(0, 0, 0, 0.4); }
    50%      { box-shadow:
        0 0 0 3px var(--pipe-button-ring, transparent),
        0 0 22px 6px var(--pipe-button-ring-glow, transparent),
        0 4px 12px rgba(0, 0, 0, 0.4); }
}

.pipe-chat-button:hover {
    transform: scale(1.08);
}

.pipe-chat-button:active {
    transform: scale(0.95);
}

.pipe-chat-icon {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1;
}

/* Ventana de Chat */
.pipe-chat-window {
    position: absolute;
    bottom: 80px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--pipe-chat-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--pipe-window-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.pipe-chat-widget-right .pipe-chat-window {
    right: 0;
}

.pipe-chat-widget-left .pipe-chat-window {
    left: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Encabezado */
.pipe-chat-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    background: var(--pipe-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pipe-chat-header-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pipe-chat-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.pipe-chat-status {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
    color: #d1fae5;
}

.pipe-chat-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* Botones del header (reset + close): cuadraditos redondeados,
   transparentes que se iluminan al hover. */
#pipe-chat-widget-container .pipe-chat-header-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

#pipe-chat-widget-container .pipe-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}

#pipe-chat-widget-container #pipe-chat-reset:hover {
    transform: rotate(-90deg);
}

#pipe-chat-widget-container .pipe-chat-header-btn svg path {
    fill: #fff;
}

/* Área de Mensajes */
.pipe-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* anti-scroll horizontal accidental */
    padding: 20px;
    background: var(--pipe-chat-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Aísla la pintura: ningún elemento de fuera puede filtrarse acá
       durante repaint de scroll en iOS Safari. */
    contain: paint;
    isolation: isolate;
    position: relative;
}

.pipe-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.pipe-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.pipe-chat-messages::-webkit-scrollbar-thumb {
    background: var(--pipe-scrollbar);
    border-radius: 3px;
}

/* Burbujas de Mensaje */
.pipe-chat-message {
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pipe-chat-bot-message {
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.pipe-chat-bot-message .pipe-chat-message-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.pipe-chat-user-message {
    align-self: flex-end;
}

.pipe-chat-message-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.pipe-chat-bot-message .pipe-chat-message-text {
    background: var(--pipe-bot-bubble-bg);
    color: var(--pipe-bot-bubble-text);
    border: 1px solid var(--pipe-bot-bubble-border);
    border-top-left-radius: 4px;
}

.pipe-chat-user-message .pipe-chat-message-text {
    background: var(--pipe-user-bubble-bg);
    color: var(--pipe-user-bubble-text);
    border-top-right-radius: 4px;
}

.pipe-chat-message-time {
    font-size: 11px;
    color: var(--pipe-time-color);
    margin-top: 4px;
    display: block;
}

.pipe-chat-bot-message .pipe-chat-message-time {
    text-align: left;
}

.pipe-chat-user-message .pipe-chat-message-time {
    text-align: right;
}

/* =========================================================
   Preguntas sugeridas (pills clicables antes del primer envío)
   ========================================================= */
#pipe-chat-widget-container .pipe-chat-suggestions {
    padding: 8px 16px 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    flex-shrink: 0;
    max-height: 38vh;
    overflow-y: auto;
}

#pipe-chat-widget-container .pipe-chat-suggestion {
    background: transparent !important;
    border: 1px solid var(--pipe-accent) !important;
    color: var(--pipe-accent) !important;
    padding: 8px 14px !important;
    border-radius: 22px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-align: left !important;
    line-height: 1.3 !important;
    transition: background .15s, color .15s, transform .1s !important;
    max-width: 100%;
    white-space: normal;
    font-family: inherit !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
}

#pipe-chat-widget-container .pipe-chat-suggestion:hover {
    background: var(--pipe-accent) !important;
    color: #fff !important;
}

#pipe-chat-widget-container .pipe-chat-suggestion:active {
    transform: scale(0.97);
}

/* Área de Entrada */
.pipe-chat-input-area {
    display: flex;
    padding: 12px 16px;
    background: var(--pipe-input-area-bg);
    border-top: 1px solid var(--pipe-input-area-border);
    gap: 10px;
}

.pipe-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--pipe-input-border);
    border-radius: 20px;
    /* 16px mínimo evita el zoom automático en iOS Safari */
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--pipe-input-bg);
    color: var(--pipe-input-text);
    -webkit-appearance: none;
    appearance: none;
}

.pipe-chat-input::placeholder {
    color: #64748b;
}

.pipe-chat-input:focus {
    border-color: var(--pipe-accent);
}

#pipe-chat-widget-container .pipe-chat-send {
    background: var(--pipe-accent) !important;
    border: none !important;
    cursor: pointer;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0 !important;
    border-radius: 50%;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

#pipe-chat-widget-container .pipe-chat-send svg {
    width: 18px;
    height: 18px;
}

#pipe-chat-widget-container .pipe-chat-send svg path {
    fill: #ffffff !important;
}

#pipe-chat-widget-container .pipe-chat-send:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

#pipe-chat-widget-container .pipe-chat-send:active {
    transform: scale(0.95);
}

#pipe-chat-widget-container .pipe-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Indicador de Escritura */
.pipe-chat-typing {
    padding: 10px 20px;
    background: var(--pipe-typing-bg);
    border-top: 1px solid var(--pipe-input-area-border);
}

.pipe-chat-typing-dots {
    display: flex;
    gap: 4px;
}

.pipe-chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--pipe-typing-dot);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.pipe-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.pipe-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* =========================================================
   Botón de enlace estilo WhatsApp
   ========================================================= */

.pipe-link-divider {
    border: none;
    border-top: 1px solid var(--pipe-bot-bubble-border);
    margin: 8px 0 6px;
}

.pipe-link-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    margin-top: 4px;
    border-radius: 8px;
    border: 1px solid var(--pipe-bot-bubble-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--pipe-accent) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    word-break: break-all;
}

.pipe-link-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--pipe-accent);
    text-decoration: none !important;
}

.pipe-link-btn__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--pipe-accent);
}

.pipe-link-btn__icon svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pipe-link-btn__label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mensaje de Error */
.pipe-chat-error {
    background: #2d1b1b !important;
    border-color: #7f1d1d !important;
    color: #fca5a5 !important;
}

/* =========================================================
   Avatares (header + por mensaje del bot)
   Reglas con specificidad reforzada para no perder vs estilos
   de tema (Woodmart, Astra, etc. tienen estilos agresivos en div/button).
   ========================================================= */
#pipe-chat-widget-container .pipe-chat-avatar {
    box-sizing: border-box;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--pipe-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-family: inherit;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border: none;
    padding: 0;
}

#pipe-chat-widget-container .pipe-chat-avatar__initial {
    font-size: inherit;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
}

/* Avatar del header — overflow:visible para que el dot online salga del círculo.
   El border-radius:50% sigue recortando el background-image. */
#pipe-chat-widget-container .pipe-chat-header-avatar {
    width: 38px;
    height: 38px;
    font-size: 16px;
    overflow: visible;
}

/* Dot de "online" abajo a la derecha del avatar del header */
#pipe-chat-widget-container .pipe-chat-avatar__dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #4ade80;
    border: 2px solid var(--pipe-header-bg);
    z-index: 2;
}

/* Avatar al lado de cada mensaje del bot */
#pipe-chat-widget-container .pipe-chat-msg-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
    margin-bottom: 18px; /* alinea visualmente con el timestamp */
}

/* =========================================================
   Badge de mensajes no leídos en el botón flotante
   ========================================================= */
.pipe-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    z-index: 10;
    pointer-events: none;
}

/* =========================================================
   Estado de conexión en el header
   ========================================================= */
.pipe-chat-status[data-state="connecting"]::before { background: #fbbf24; }
.pipe-chat-status[data-state="offline"]::before    { background: #94a3b8; }
.pipe-chat-status[data-state="error"]::before      { background: #ef4444; }

/* =========================================================
   Botón scroll-to-bottom — anclado explícitamente a la DERECHA
   y oculto por defecto. Forzamos left:auto para que ningún CSS
   global de tema pueda empujarlo a la izquierda.
   ========================================================= */
#pipe-chat-widget-container .pipe-chat-scroll-bottom {
    position: absolute !important;
    bottom: 80px !important;
    right: 16px !important;
    left: auto !important;
    top: auto !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: 1px solid var(--pipe-bot-bubble-border) !important;
    background: var(--pipe-bot-bubble-bg) !important;
    color: var(--pipe-bot-bubble-text);
    cursor: pointer;
    display: none;   /* no visible salvo .is-visible */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    z-index: 3;
    padding: 0 !important;
    transform: translateY(0);
    transition: opacity 0.2s ease;
    opacity: 1;
}

#pipe-chat-widget-container .pipe-chat-scroll-bottom.is-visible {
    display: flex !important;
}

#pipe-chat-widget-container .pipe-chat-scroll-bottom:hover {
    background: var(--pipe-input-bg) !important;
    border-color: var(--pipe-accent) !important;
    color: var(--pipe-accent);
}

/* =========================================================
   Markdown ligero dentro de mensajes
   ========================================================= */
.pipe-chat-message-text strong { font-weight: 700; }
.pipe-chat-message-text em     { font-style: italic; }
.pipe-chat-message-text code {
    background: rgba(255, 255, 255, 0.08);
    color: var(--pipe-accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

/* =========================================================
   Botón reintentar dentro de un mensaje de error
   ========================================================= */
.pipe-chat-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #b91c1c;
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.pipe-chat-retry-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

/* =========================================================
   Entrada de mensaje (animación de aparición)
   ========================================================= */
@keyframes pipeMsgIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.pipe-chat-message {
    animation: pipeMsgIn 0.22s ease both;
}

/* Separador de día */
#pipe-chat-widget-container .pipe-chat-day-separator {
    align-self: center !important;
    font-size: 11px;
    color: var(--pipe-time-color);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 10px;
    margin: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================================
   Tarjeta de Pedido WooCommerce
   ========================================================= */

.pipe-order-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-top-left-radius: 4px;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 12px;
    overflow: hidden;
    font-size: 13px;
    min-width: 260px;
    max-width: 300px;
    color: #e2e8f0;
}

.pipe-order-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #14532d;
    color: #d1fae5;
}

.pipe-order-card__icon {
    font-size: 22px;
    line-height: 1;
}

.pipe-order-card__title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pipe-order-card__label {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pipe-order-card__number {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
}

.pipe-order-card__section {
    padding: 10px 14px;
    border-bottom: 1px solid #334155;
}

.pipe-order-card__section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #64748b;
    margin-bottom: 6px;
}

.pipe-order-card__row {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 3px;
    line-height: 1.4;
}

.pipe-order-card__row span {
    color: #94a3b8;
}

.pipe-order-card__items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pipe-order-card__item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    color: #cbd5e1;
}

.pipe-order-card__item-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipe-order-card__item-qty {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.pipe-order-card__item-price {
    font-weight: 600;
    color: #4ade80;
    white-space: nowrap;
}

.pipe-order-card__footer {
    padding: 10px 14px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pipe-order-card__total {
    font-size: 15px;
    color: #e2e8f0;
}

.pipe-order-card__total strong {
    color: #4ade80;
}

.pipe-order-card__status {
    margin-top: 4px;
}

.pipe-order-card__badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #14532d;
    color: #86efac;
    border: 1px solid #166534;
    text-transform: capitalize;
}

/* =========================================================
   Responsivo — móvil
   ========================================================= */
@media (max-width: 600px) {
    /* El contenedor ocupa toda la pantalla en móvil */
    #pipe-chat-widget-container {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        pointer-events: none;
    }

    /* Botón flotante: esquina inferior derecha */
    .pipe-chat-button {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        pointer-events: all;
    }

    .pipe-chat-widget-left .pipe-chat-button {
        right: auto !important;
        left: 20px !important;
    }

    /* Ventana: pantalla completa. El JS fija height/top al visualViewport
       en cada cambio — por eso top/height no llevan !important (necesitan ser
       sobreescritos por los estilos inline del JS). */
    .pipe-chat-window {
        position: fixed !important;
        top: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;   /* fallback antes de que monte el JS */
        height: 100dvh;
        border-radius: 0 !important;
        overflow: hidden !important;
        pointer-events: none;
        padding-top: env(safe-area-inset-top);
        /* Forzamos propia capa de composición para evitar que iOS Safari
           "vea" debajo del chat durante el scroll (artefactos de repaint). */
        transform: translateZ(0);
        backface-visibility: hidden;
        background: var(--pipe-chat-bg);
    }

    /* El transform de animación lo pone/quita el JS, no el CSS */
    .pipe-chat-window.pipe-is-open {
        pointer-events: all;
    }

    /* Evitar zoom de doble toque y flash de tap en iOS */
    .pipe-chat-button,
    .pipe-chat-close,
    .pipe-chat-send,
    .pipe-chat-input,
    .pipe-link-btn,
    .pipe-chat-message-text a {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Área de mensajes: min-height:0 es crítico para que flex reduzca bien su tamaño */
    .pipe-chat-messages {
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        overscroll-behavior: contain;
    }

    /* Área de entrada: no se encoge + respeta la barra de inicio del iPhone */
    .pipe-chat-input-area {
        flex-shrink: 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}
