/* Asistente del sitio (resources/views/partials/assistant.blade.php + public/js/asistente.js). */
.tnl-chat {
    --c-brand: #a8338f;
    --c-brand-dark: #8a2874;
    --c-brand-soft: #fbe6f7;
    --c-bg: #ffffff;
    --c-bot: #f4f4f5;
    --c-text: #27272a;
    --c-muted: #71717a;
    --c-border: #e4e4e7;
    font-family: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
}
.dark .tnl-chat {
    --c-brand-soft: #3a1a33;
    --c-bg: #13111d;
    --c-bot: #1d1a2b;
    --c-text: #e4e4e7;
    --c-muted: #a1a1aa;
    --c-border: #2b2740;
}

.tnl-chat__toggle {
    position: fixed;
    right: 1rem;
    bottom: 5.25rem; /* en el celular queda arriba del botón de WhatsApp */
    z-index: 40;
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border: 0;
    border-radius: 9999px;
    background: var(--c-brand);
    color: #fff;
    box-shadow: 0 12px 24px -6px rgb(0 0 0 / 0.3);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}
.tnl-chat__toggle:hover { background: var(--c-brand-dark); transform: scale(1.05); }
.tnl-chat__toggle:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 3px; }
.tnl-chat__toggle svg { width: 1.6rem; height: 1.6rem; }
.tnl-chat__icon-close, .tnl-chat--open .tnl-chat__icon-open { display: none; }
.tnl-chat--open .tnl-chat__icon-close { display: block; }
@media (min-width: 640px) {
    .tnl-chat__toggle { bottom: 1.25rem; right: 1.25rem; }
}

.tnl-chat__panel {
    position: fixed;
    right: 0.75rem;
    left: 0.75rem;
    bottom: 9.5rem;
    z-index: 40;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 11rem);
    height: 32rem;
    overflow: hidden;
    border: 1px solid var(--c-border);
    border-radius: 1rem;
    background: var(--c-bg);
    color: var(--c-text);
    box-shadow: 0 24px 48px -12px rgb(0 0 0 / 0.35);
}
.tnl-chat__panel[hidden] { display: none; }
@media (min-width: 640px) {
    .tnl-chat__panel { left: auto; right: 1.25rem; bottom: 5.5rem; width: 23rem; max-height: calc(100dvh - 7.5rem); }
}

.tnl-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    background: var(--c-brand);
    color: #fff;
}
.tnl-chat__title { margin: 0; font-weight: 700; font-size: 0.95rem; }
.tnl-chat__subtitle { margin: 0; font-size: 0.75rem; opacity: 0.85; }
.tnl-chat__close {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.tnl-chat__close:hover { background: rgb(255 255 255 / 0.15); }
.tnl-chat__close svg { width: 1.25rem; height: 1.25rem; }

.tnl-chat__log {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.875rem;
    line-height: 1.45;
}
.tnl-chat__msg { max-width: 88%; padding: 0.55rem 0.8rem; border-radius: 0.9rem; white-space: pre-line; overflow-wrap: anywhere; }
.tnl-chat__msg--bot { align-self: flex-start; background: var(--c-bot); border-bottom-left-radius: 0.25rem; }
.tnl-chat__msg--user { align-self: flex-end; background: var(--c-brand); color: #fff; border-bottom-right-radius: 0.25rem; }
.tnl-chat__typing { color: var(--c-muted); font-style: italic; }

.tnl-chat__products { align-self: stretch; display: flex; flex-direction: column; gap: 0.4rem; }
.tnl-chat__product {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding: 0.45rem;
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    background: var(--c-bg);
}
.tnl-chat__product:hover { border-color: var(--c-brand); }
.tnl-chat__product img { width: 3.25rem; height: 3.25rem; flex-shrink: 0; object-fit: contain; border-radius: 0.5rem; background: #fff; }
.tnl-chat__product-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; font-weight: 600; }
.tnl-chat__product-price { font-weight: 700; color: var(--c-brand); }
.dark .tnl-chat__product-price { color: #e17fcc; }
.tnl-chat__product-stock { font-size: 0.7rem; color: var(--c-muted); }

.tnl-chat__links { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tnl-chat__link {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--c-brand);
    color: var(--c-brand);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.dark .tnl-chat__link { color: #e17fcc; border-color: #e17fcc; }
.tnl-chat__link:hover { background: var(--c-brand-soft); }
.tnl-chat__link--whatsapp, .dark .tnl-chat__link--whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.tnl-chat__link--whatsapp:hover { background: #1ebe5b; }

.tnl-chat__chips { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0 0.75rem 0.6rem; scrollbar-width: none; }
.tnl-chat__chips::-webkit-scrollbar { display: none; }
.tnl-chat__chips button {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--c-border);
    border-radius: 9999px;
    background: var(--c-bg);
    color: var(--c-text);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}
.tnl-chat__chips button:hover { border-color: var(--c-brand); color: var(--c-brand); }

.tnl-chat__form { display: flex; gap: 0.5rem; padding: 0.6rem 0.75rem 0.75rem; border-top: 1px solid var(--c-border); }
.tnl-chat__form input {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    background: var(--c-bg);
    color: var(--c-text);
    font: inherit;
    font-size: 16px; /* evita el zoom automático en iPhone */
}
.tnl-chat__form input:focus { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px rgb(168 51 143 / 0.2); }
.tnl-chat__form button {
    display: grid;
    place-items: center;
    width: 2.6rem;
    flex-shrink: 0;
    border: 0;
    border-radius: 0.75rem;
    background: var(--c-brand);
    color: #fff;
    cursor: pointer;
}
.tnl-chat__form button:disabled { opacity: 0.5; cursor: default; }
.tnl-chat__form button svg { width: 1.2rem; height: 1.2rem; }
.tnl-chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .tnl-chat__toggle { transition: none; }
}
@media print {
    .tnl-chat { display: none; }
}
