/* ==============================================================
   Turismito — Widget de Chat Asistente Virtual
   Landing Page: RutaTurismo360
   Prefijo: trt-
   ============================================================== */

/* ── Contenedor flotante (posición fija) ─────────────────────── */
.trt-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9998;
    display: flex;
    flex-direction: column-reverse;  /* botón abajo, panel se abre hacia arriba */
    align-items: flex-end;
    gap: 14px;
    pointer-events: none;            /* el contenedor no bloquea clics de la página */
}

/* ── Botón flotante circular ─────────────────────────────────── */
.trt-toggle-btn {
    position: relative;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.45);
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease;
    overflow: visible;
    pointer-events: auto;            /* el botón sí recibe clics */
}

.trt-toggle-btn:hover {
    transform: scale(1.09) translateY(-2px);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.60);
}

.trt-toggle-btn--open {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.55);
}

.trt-toggle-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Badge de mensajes no leídos */
.trt-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45);
    animation: trt-badge-pulse 2s ease-in-out infinite;
    padding: 0 4px;
}

@keyframes trt-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.18); }
}

/* ── Panel de chat ───────────────────────────────────────────── */
.trt-panel {
    width: 360px;
    max-height: 540px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14),
                0 4px 14px rgba(102, 126, 234, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Estado colapsado */
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    pointer-events: none;
    transition: opacity   0.28s ease,
                transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.trt-panel--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────────── */
.trt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
}

.trt-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trt-header-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
}

.trt-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    padding: 3px;
}

/* Punto de estado (verde "en línea") */
.trt-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #764ba2;
    animation: trt-status-pulse 2.5s ease-in-out infinite;
}

@keyframes trt-status-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.trt-header-info {
    display: flex;
    flex-direction: column;
}

.trt-header-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.trt-header-subtitle {
    color: rgba(255, 255, 255, 0.82);
    font-size: 11.5px;
    line-height: 1.3;
}

.trt-header-actions {
    display: flex;
    gap: 4px;
}

.trt-icon-btn {
    background: rgba(255, 255, 255, 0.16);
    border: none;
    border-radius: 9px;
    color: #ffffff;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.trt-icon-btn:hover {
    background: rgba(255, 255, 255, 0.30);
}

.trt-icon-btn .rzi {
    font-size: 18px;
}

/* ── Lista de mensajes ───────────────────────────────────────── */
.trt-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #fafafa;
}

.trt-messages::-webkit-scrollbar        { width: 4px; }
.trt-messages::-webkit-scrollbar-track  { background: transparent; }
.trt-messages::-webkit-scrollbar-thumb  {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 4px;
}

/* ── Burbuja de mensaje ──────────────────────────────────────── */
.trt-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: trt-msg-in 0.22s ease-out;
}

.trt-msg--user {
    flex-direction: row-reverse;
}

@keyframes trt-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

.trt-msg-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.trt-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: #f3f0ff;
    padding: 2px;
}

.trt-msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-line;    /* respeta saltos de línea en los textos */
}

.trt-msg--bot .trt-msg-bubble {
    background: #f0edff;
    color: #1e1b4b;
    border-bottom-left-radius: 4px;
}

.trt-msg--user .trt-msg-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.trt-msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.50;
    margin-top: 5px;
    text-align: right;
}

/* ── Indicador de escritura (tres puntos) ────────────────────── */
.trt-msg-bubble--typing {
    padding: 13px 16px !important;
    min-width: 52px;
    display: flex;
    align-items: center;
    gap: 0;
}

.trt-msg-bubble--typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8b5cf6;
    margin: 0 2.5px;
    animation: trt-dot-bounce 1.2s ease-in-out infinite;
}

.trt-msg-bubble--typing span:nth-child(2) { animation-delay: 0.20s; }
.trt-msg-bubble--typing span:nth-child(3) { animation-delay: 0.40s; }

@keyframes trt-dot-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.5; }
    40%           { transform: translateY(-7px); opacity: 1;   }
}

/* ── Respuestas rápidas ──────────────────────────────────────── */
.trt-replies {
    padding: 10px 14px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid #ede9fe;
    background: #f9f7ff;
    flex-shrink: 0;
    max-height: 140px;
    overflow-y: auto;
}

.trt-replies::-webkit-scrollbar        { width: 3px; }
.trt-replies::-webkit-scrollbar-thumb  {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 3px;
}

.trt-reply-btn {
    background: #ffffff;
    border: 1.5px solid #c4b5fd;
    color: #6d28d9;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    line-height: 1.3;
}

.trt-reply-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.32);
}

.trt-reply-btn:active {
    transform: translateY(0);
}

.trt-reply-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Responsive (móvil) ──────────────────────────────────────── */
@media (max-width: 480px) {
    .trt-widget {
        bottom: 16px;
        right: 16px;
    }

    .trt-panel {
        width: calc(100vw - 32px);
        max-height: 72vh;
    }

    .trt-toggle-btn {
        width: 58px;
        height: 58px;
    }
}
