/* =======================
   Botón flotante del chatbot
======================= */
#chatbot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #ff7979;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    font-size: 28px;
    transition: background 0.2s;
}

    #chatbot-fab:hover {
        background: #f55;
    }

/* =======================
   Ventana del chatbot
======================= */
#chatbot-window {
    display: none; /* Oculto por defecto */
    flex-direction: column;
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    max-width: 95vw;
    height: 80vh;
    max-height: 80vh;
    min-height: 350px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    z-index: 10000;
    overflow: hidden;
}

/* =======================
   Header del chatbot
======================= */
#chatbot-header {
    background: #f55; /* Toyota red */
    color: #fff;
    padding: 12px 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 2;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    white-space: nowrap;
}

    /* Ícono e título */
    #chatbot-header img.chatbot-header-img {
        display: inline-block;
        vertical-align: middle;
        margin-right: 3px;
        width: 20px;
        height: 20px;
        background-color: #eee;
        border-radius: 15px;
    }

    #chatbot-header span {
        display: inline-block;
        vertical-align: middle;
        font-weight: bold;
        font-size: 14px;
    }

/* Botones del header */
#chatbot-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

#chatbot-back-to-start {
    position: absolute;
    right: 40px;
    top: 8px;
    background: #fff;
    color: #007bff;
    border: 1px solid #007bff;
    border-radius: 16px;
    padding: 2px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 2;
}

    #chatbot-back-to-start:hover {
        background: #007bff;
        color: #fff;
    }

/* =======================
   Cuerpo del chatbot
======================= */
#chatbot-body {
    flex: 1 1 0 !important;
    flex-grow: 1 !important;
    min-height: 0 !important;
    max-height: calc(80vh - 56px) !important; /* Header aprox 56px */
    padding: 8px 12px 32px 12px !important; /* padding extra para input */
    overflow-y: auto !important;
    background: #f7f7f9;
    display: flex;
    flex-direction: column;
}

#chatbot-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* =======================
   Burbuja de chat
======================= */
.chat-bubble {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 18px;
    max-width: 80%;
    margin-bottom: 2px;
    font-size: 12px;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

    .chat-bubble.bot {
        align-self: flex-start;
        background: #f1f0f0;
        color: #222;
        border-bottom-left-radius: 4px;
        margin-right: 40px;
    }

    .chat-bubble.user {
        align-self: flex-end;
        background: #d1e7ff;
        color: #0d3a6a;
        border-bottom-right-radius: 4px;
        margin-left: 40px;
    }

/* =======================
   Opciones y input
======================= */
#chatbot-options {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#chatbot-input-group {
    display: flex;
    margin-top: 8px;
}

#chatbot-input {
    flex: 1;
    border-radius: 18px 0 0 18px;
    border: 1px solid #ccc;
    padding: 6px 12px;
    outline: none;
}

#chatbot-send {
    border-radius: 0 18px 18px 0;
}

/* =======================
   Botones y formularios
======================= */
.btn-chatbot {
    border-radius: 0;
    transition: all 0.3s ease-in-out;
    padding: 8px;
    font-family: inherit;
    color: #fff !important;
    border-color: #f55 !important;
    background-color: #f55 !important;
}

.chatbot-form {
    margin-top: 10px;
}

.form-group-chat {
    margin-bottom: 10px;
}

.form-control-chat {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 18px;
    font-size: 12px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
    color: #333;
}

    .form-control-chat:focus {
        outline: none;
        border-color: #f55;
        background-color: #fff;
        box-shadow: 0 0 5px rgba(255, 85, 85, 0.2);
    }

.input-error {
    border: 2px solid #f55;
    background-color: #fff0f0;
}

.grecaptcha-badge {
    width: 70px !important;
    overflow: hidden !important;
    transition: width 0.3s ease;
    left: 0 !important;
    right: auto !important;
}

    .grecaptcha-badge:hover {
        width: 256px !important;
    }

#chatbot-tooltip {
    position: absolute;
    bottom: 10px;
    right: 70px;
    background-color: #f55;
    color: #fafafa;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

#chatbot-fab:hover #chatbot-tooltip,
#chatbot-fab.show-tooltip #chatbot-tooltip {
    opacity: 1;
    transform: translateY(0);
}
