/* ============================================================
   ASISTENTE VIRTUAL — loteria3.es (Reservas empresas / asociaciones)
   Navy #0E4F8A · Gold #c9a961 · Cream #fffdf6
   ============================================================ */

#lt3-chatbot,
#lt3-chatbot *,
#lt3-chatbot *::before,
#lt3-chatbot *::after {
    box-sizing: border-box;
    font-family: 'Lato', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- Floating launcher ---------- */
#lt3-chatbot {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9998;
}

#lt3-chatbot-launcher {
    appearance: none;
    border: 2px solid #c9a961;
    background: linear-gradient(135deg, #0E4F8A 0%, #103a6b 100%);
    color: #fff;
    padding: 14px 22px 14px 16px;
    /* Viñeta de chat: 3 esquinas redondeadas, la esquina inferior derecha mas plana
       para combinar con el "rabito" del bocadillo */
    border-radius: 26px 26px 6px 26px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(14, 79, 138, 0.32), 0 2px 6px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 11px;
    letter-spacing: 0.02em;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

/* Rabito del bocadillo (triangulo abajo a la derecha) */
#lt3-chatbot-launcher::after {
    content: "";
    position: absolute;
    bottom: -9px;
    right: 18px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 9px 0 0;
    border-color: #c9a961 transparent transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.08));
}
/* Triangulo interior (azul) que cubre el borde dorado dejando solo el contorno */
#lt3-chatbot-launcher::before {
    content: "";
    position: absolute;
    bottom: -5px;
    right: 19.5px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 6px 0 0;
    border-color: #103a6b transparent transparent transparent;
    z-index: 1;
}

#lt3-chatbot-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(14, 79, 138, 0.42), 0 3px 8px rgba(0, 0, 0, 0.15);
}

#lt3-chatbot-launcher .lt3-cb-launcher-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c9a961;
    color: #0E4F8A;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#lt3-chatbot-launcher .lt3-cb-launcher-icon svg {
    width: 21px;
    height: 21px;
    display: block;
}

#lt3-chatbot-launcher .lt3-cb-launcher-label {
    line-height: 1.1;
    position: relative;
    z-index: 2;
}

#lt3-chatbot.lt3-cb-open #lt3-chatbot-launcher { display: none; }

/* ---------- Panel ---------- */
#lt3-chatbot-panel {
    display: none;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: calc(100vh - 80px);
    background: #fffdf6;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(14, 79, 138, 0.30), 0 4px 12px rgba(0, 0, 0, 0.12);
    flex-direction: column;
    border: 1px solid #ece3cc;
}

#lt3-chatbot.lt3-cb-open #lt3-chatbot-panel { display: flex; }

/* ---------- Header ---------- */
.lt3-cb-header {
    background: linear-gradient(135deg, #0E4F8A 0%, #103a6b 60%, #0a2c52 100%);
    padding: 18px 18px 16px;
    border-bottom: 2px solid #c9a961;
    position: relative;
    flex-shrink: 0;
}

.lt3-cb-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lt3-cb-header__title {
    color: #fff;
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.2;
}

.lt3-cb-header__kicker {
    display: block;
    color: #c9a961;
    font-family: 'Lato', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.lt3-cb-close {
    appearance: none;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.lt3-cb-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ---------- Messages ---------- */
.lt3-cb-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 16px;
    background: #fbfaf5;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.lt3-cb-messages::-webkit-scrollbar { width: 8px; }
.lt3-cb-messages::-webkit-scrollbar-track { background: transparent; }
.lt3-cb-messages::-webkit-scrollbar-thumb { background: rgba(14, 79, 138, 0.18); border-radius: 4px; }
.lt3-cb-messages::-webkit-scrollbar-thumb:hover { background: rgba(14, 79, 138, 0.30); }

.lt3-cb-msg {
    max-width: 88%;
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.97rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.lt3-cb-msg--assistant {
    background: #fffdf6;
    border: 1px solid #ece3cc;
    border-left: 3px solid #c9a961;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.lt3-cb-msg--user {
    background: linear-gradient(135deg, #0E4F8A 0%, #103a6b 100%);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.lt3-cb-msg--system {
    background: #fff8e7;
    border: 1px solid #ece3cc;
    color: #6b6b6b;
    align-self: center;
    font-size: 0.85rem;
    font-style: italic;
    max-width: 95%;
    text-align: center;
}

.lt3-cb-msg--error {
    background: #fdecec;
    border: 1px solid #f3c0c0;
    border-left: 3px solid #c0392b;
    color: #6f1c14;
    align-self: flex-start;
    font-size: 0.9rem;
}

.lt3-cb-msg__role {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
    opacity: 0.7;
}

/* ---------- Typing indicator ---------- */
.lt3-cb-typing {
    display: inline-flex;
    gap: 4px;
    padding: 4px 0 2px;
}
.lt3-cb-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c9a961;
    animation: lt3-cb-blink 1.2s infinite ease-in-out;
}
.lt3-cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.lt3-cb-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes lt3-cb-blink {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ---------- Quick replies ---------- */
.lt3-cb-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 6px;
}
.lt3-cb-quick button {
    appearance: none;
    background: #fffdf6;
    border: 1.5px solid #c9a961;
    color: #0E4F8A;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.lt3-cb-quick button:hover {
    background: #0E4F8A;
    color: #fff;
}

/* ---------- Input area ---------- */
.lt3-cb-input {
    border-top: 1px solid #ece3cc;
    background: #fffdf6;
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.lt3-cb-input textarea {
    flex: 1 1 auto;
    appearance: none;
    border: 1.5px solid #ece3cc;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.97rem;
    font-family: inherit;
    color: #1f2937;
    background: #ffffff;
    resize: none;
    max-height: 120px;
    min-height: 42px;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lt3-cb-input textarea:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}

.lt3-cb-send {
    appearance: none;
    border: none;
    background: linear-gradient(135deg, #0E4F8A 0%, #103a6b 100%);
    color: #c9a961;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.lt3-cb-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(14, 79, 138, 0.28);
}
.lt3-cb-send:disabled {
    background: #cccccc;
    color: #888;
    cursor: not-allowed;
}
.lt3-cb-send svg { width: 20px; height: 20px; }

/* ---------- Footer note ---------- */
.lt3-cb-footer {
    background: #fffdf6;
    border-top: 1px solid #ece3cc;
    padding: 8px 14px;
    font-size: 0.72rem;
    color: #6b7280;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}
.lt3-cb-footer b { color: #0E4F8A; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    #lt3-chatbot { bottom: 14px; right: 14px; left: 14px; }
    #lt3-chatbot-launcher {
        width: 100%;
        justify-content: center;
        padding: 16px 18px;
    }
    #lt3-chatbot-panel {
        width: 100%;
        height: calc(100vh - 28px);
        max-height: calc(100vh - 28px);
    }
}
