/**
 * Chatbot Widget Styles
 * All styles for the chatbot interface
 */

/* ========================================
   Bubble Text Styles
   ======================================== */

#bubble-text {
    position: absolute;
    right: 81px;
    bottom: 30px;
    border-radius: 10px;
    padding: 15px;
    width: 160px;
    font-size: 1.6em;
    text-align: center;
    display: none;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    word-wrap: break-word;
}

#bubble-text::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 10px solid var(--primary-color);
    border-right: 10px solid transparent;
    border-top: 10px solid transparent;
    border-bottom: 10px solid var(--primary-color);
    position: absolute;
    right: -10px;
    bottom: 0;
}

#close-bubble {
    position: absolute;
    left: -10px;
    top: -10px;
    cursor: pointer;
    font-size: 1.7em;
    background-color: red;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
    user-select: none;
}

#close-bubble::after {
    content: "";
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: -5px;
    right: -5px;
}

/* ========================================
   Chatbot Widget Icon
   ======================================== */

#chatbot-widget {
    font-family: 'Montserrat', sans-serif;
    position: fixed;
    bottom: 15px;
    right: 26px;
    z-index: 999999;
    cursor: pointer;
    width: 65px;
    height: 65px;
    border-radius: 100px;
    text-align: center;
    display: flex;
    align-items: center;
}

#chatbot-widget img {
    width: 65px;
    height: 65px;
    margin: 0 auto;
    display: block;
    background: white;
    border-radius: 100px;
}

/* ========================================
   Chatbot Window
   ======================================== */

#chatbot-window {
    display: none;
    z-index: 99999999;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    border-radius: 10px;
    overflow: hidden;
    transition: height 0.5s;
    background-color: #f8f9fa;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    height: 570px;
}

#chatHeader {
    background-color: #ffffff;
    color: black;
    font-weight: 600;
    padding: 10px;
    display: flex;
    justify-content: space-between;
}

#availability {
    font-size: 0.8em;
    color: #dcf8c6;
}

#chatContent {
    overflow: auto;
    padding: 10px;
    height: 105%;
    position: relative;
    padding-bottom: 50px;
}

#cerrar-chatbot-window::after {
    content: "";
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -10px;
    right: -10px;
}

/* ========================================
   Chat History & Messages
   ======================================== */

#chatHistory {
    overflow: auto;
    flex-grow: 1;
    max-height: 75%;
}

.bot-message-label {
    margin-bottom: 5px;
}

.bot-message {
    color: white;
    background-color: var(--background-color);
    padding: 10px;
    margin-bottom: 10px;
    margin-left: 10px;
    margin-right: 30px;
    border-radius: 5px;
    position: relative;
    overflow: visible;
    margin-top: 7px;
}

.bot-message::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid var(--background-color);
    border-top: 10px solid var(--background-color);
    border-bottom: 10px solid transparent;
    position: absolute;
    left: -10px;
    top: 0;
}

.user-message-label {
    text-align: right;
    margin-bottom: 5px;
}

.user-message {
    background-color: #e6e6e6;
    padding: 10px;
    margin-left: 30px;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    align-self: flex-start;
    position: relative;
}

.user-message::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 10px solid #e6e6e6;
    border-right: 10px solid transparent;
    border-top: 10px solid #e6e6e6;
    border-bottom: 10px solid transparent;
    position: absolute;
    right: -10px;
    top: 0;
}

/* ========================================
   Typing Indicator
   ======================================== */

.typing-indicator {
    padding: 10px;
    margin-bottom: 10px;
    margin-left: 10px;
    margin-right: 30px;
    border-radius: 5px;
    background-color: grey;
    position: relative;
    overflow: visible;
}

.dot {
    height: 10px;
    width: 10px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.5s infinite;
}

.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        background-color: #bbb;
    }
    50% {
        background-color: #ddd;
    }
    100% {
        background-color: #bbb;
    }
}

/* ========================================
   Chat Form & Input
   ======================================== */

#chatForm {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #ccc;
    position: absolute;
    bottom: 20%;
    width: 93%;
}

.chat-input {
    flex-grow: 1;
    margin-right: 10px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.chat-button {
    background-color: white;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    margin-top: 10px;
    margin-right: 20px;
}

/* Form Field Styles (Floating Labels) */
.form__group {
    position: relative;
    padding: 15px 0 0;
    width: 100%;
}

.form__field {
    font-family: inherit;
    width: 100%;
    border: 0;
    outline: 0;
    font-size: 1.3rem;
    padding: 7px 0;
    background: transparent;
    transition: border-color 0.2s;
}

.form__field::placeholder {
    color: transparent;
}

.form__field:placeholder-shown ~ .form__label {
    font-size: 1.3rem;
    cursor: text;
    top: 20px;
}

.form__label {
    position: absolute;
    top: 0;
    display: block;
    transition: 0.2s;
    font-size: 1rem;
    color: #9b9b9b;
}

.form__field:focus ~ .form__label {
    position: absolute;
    top: 0;
    display: none;
    transition: 0.2s;
    font-size: 1rem;
    color: #11998e;
    font-weight: 500;
}

.form__field:focus {
    padding-bottom: 6px;
    font-weight: 500;
    border-width: 3px;
}

.form__field:required,
.form__field:invalid {
    box-shadow: none;
}

/* ========================================
   Bot Options (Buttons)
   ======================================== */

.bot-options {
    margin-top: 10px;
}

.option {
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    color: #333;
    transition: background-color 0.3s;
    box-sizing: border-box;
}

.option:hover {
    background-color: #ddd;
}

/* Single-Row Style (one option per row) */
.bot-options.option-single .option {
    margin-bottom: 10px;
}

/* Two-Per-Row Style (two options per row) */
.bot-options.option-double {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bot-options.option-double .option {
    flex: 1 1 calc(50% - 10px);
}

/* ========================================
   Widget States
   ======================================== */

.chat-widget-open {
    height: 400px;
}

.chat-widget-closed {
    height: 50px;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media screen and (max-width: 400px) {
    #bubble-text {
        position: absolute;
        right: 81px;
        bottom: 0;
        border-radius: 10px;
        padding: 15px;
        width: 160px;
        font-size: 1.2em;
        text-align: center;
        display: none;
        background-color: var(--primary-color);
        color: white;
        font-weight: 600;
    }

    #bubble-text::after {
        content: "";
        width: 0;
        height: 0;
        border-left: 10px solid var(--primary-color);
        border-right: 10px solid transparent;
        border-top: 10px solid var(--primary-color);
        border-bottom: 10px solid transparent;
        position: absolute;
        right: -10px;
        top: 0;
    }
}

@media (max-width: 355px) {
    #chatbot-window {
        width: 90%;
    }
}
