/* chat.css */

/* Estilos generales */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f0f5e1; /* Fondo claro verde */
    overflow-y: auto;
}
* {
    box-sizing: border-box;
}

.personal-info-form .pet-management {
    display: none;
    margin-bottom: 16px;
}

.personal-info-form .pet-management-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.personal-info-form .pet-actions {
    display: flex;
    gap: 8px;
}

.personal-info-form .pet-action {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background-color: #9ccd7f;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.personal-info-form .pet-action:hover {
    background-color: #89ba6c;
}

.personal-info-form .pet-action.delete {
    background-color: #db4c4c;
}

.personal-info-form .pet-action.delete:hover {
    background-color: #c43d3d;
}

.personal-info-form .pet-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.personal-info-form .pet-management-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.personal-info-form .pet-management-row select {
    flex: 1 1 auto;
    width: 100%;
}


/* Encabezado */
header {
    padding: 0;
    text-align: center;
    height: 70px; /* Aumentamos la altura a 85px */
    display: flex;
    align-items: center;
    justify-content: center;
}
header img {
    max-width: 350px;
    max-height: 60px;
    height: auto;
    object-fit: contain;
}
hr {
    border-top: 1px solid #a3d197; /* Verde suave */
    margin: 0;
}

/* Contenedor del chat */
.chat-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 70vh; /* Altura fija */
    padding: 10px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    margin: 10px auto 30px auto; /* Agregamos margen inferior */
    max-width: 800px;
}

/* ======================================================= */
/* === INICIO DE CAMBIOS - MEJORA DE INTERFAZ DEL CHAT === */
/* ======================================================= */

/* Ventana del chat - MODIFICADO para usar Flexbox */
#chatWindow {
    flex-grow: 1;
    padding: 10px;
    background-color: #eef7e5; /* Fondo verde claro */
    overflow-y: auto;
    border-radius: 10px;
    margin-bottom: 5px;
    display: flex; /* Usamos flexbox para alinear las burbujas */
    flex-direction: column; /* Apilamos los mensajes verticalmente */
    gap: 10px; /* Espacio entre burbujas */
}

/* Mensajes - MODIFICADO para ser burbujas */
.message {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 80%; /* Las burbujas no ocupan todo el ancho */
    word-break: break-word;
    line-height: 1.4;
    font-size: 16px;
}

/* Burbuja del usuario */
.message.user {
    background-color: #9ccd7f; /* Verde medio */
    color: #fff; /* Texto blanco */
    border-bottom-right-radius: 5px; /* Esquina menos redondeada */
    align-self: flex-end; /* Alineado a la derecha */
    text-align: left; /* El texto dentro de la burbuja se alinea a la izquierda */
}

/* Burbuja del bot - MODIFICADO */
.message.bot {
    background-color: transparent; /* Sin fondo de color */
    color: #444; /* Texto oscuro */
    border: 1.5px solid #a3d197; /* Borde con el color verde suave de la marca */
    border-bottom-left-radius: 5px; /* Esquina menos redondeada */
    align-self: flex-start; /* Alineado a la izquierda */
    text-align: left;
}

/* Estilos para el contenido formateado dentro de la burbuja del bot */
.message.bot p {
    margin: 0 0 10px 0;
}
.message.bot p:last-child {
    margin-bottom: 0;
}

.message.bot ul {
    padding-left: 20px;
    margin: 10px 0 0 0;
}

.message.bot li {
    margin-bottom: 5px;
}

/* Negritas resaltadas en el color de la marca */
.message.bot strong {
    color: #508944;
    font-weight: 700;
}

/* Indicador de "Escribiendo..." */
#typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px; /* Espacio entre el logo y los puntos */
    padding: 12px 18px;
}

#typing-indicator img {
    width: 30px; /* Tamaño del logo */
    height: 30px;
}

#typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #b0b0b0;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite ease-in-out;
}

/* Retraso de la animación para cada punto */
#typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
#typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Animación de los puntos */
@keyframes typing-dot {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* =============================================== */
/* === FIN DE CAMBIOS - MEJORA DE UI DEL CHAT === */
/* =============================================== */


/* Contenedor de entrada */
.input-container {
    display: flex;
    align-items: center;
}

textarea {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #a3d197; /* Verde suave */
    border-radius: 5px;
    font-size: 16px;
    margin-right: 10px;
    height: auto;
    min-height: 30px;
    max-height: 100px;
    resize: none;
    overflow-y: hidden;
}

button {
    background-color: #9ccd7f; /* Verde */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

button.disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

button:hover:not(.disabled) {
    background-color: #8db46f; /* Verde más oscuro */
}

/* Disclaimer (Aviso legal) dentro de la burbuja del bot */
.disclaimer {
    font-size: 12px;
    color: #777;
    margin-top: 10px;
    display: block;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.error-message {
    color: red;
    font-weight: bold;
    align-self: center;
    background: #ffe0e0;
    border: 1px solid red;
}

.info-message {
    color: #6f8053; /* Verde grisáceo */
    font-weight: bold;
    align-self: center;
    background: transparent;
    border: none;
    padding: 5px;
}

/* Formulario de información personal (estilos originales) */
.personal-info-form {
    max-width: 800px;
    margin: 20px auto;
}

.personal-info-form details {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
    height: auto;
    overflow: hidden;
}

.personal-info-form summary {
    cursor: pointer;
    padding: 10px 20px;
    background-color: #9ccd7f; /* Verde */
    color: white;
    border-radius: 10px 10px 0 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.personal-info-form summary::after {
    content: '▼';
    font-size: 18px;
    transition: transform 0.3s;
}

.personal-info-form details[open] summary::after {
    transform: rotate(180deg);
}

.personal-info-form form {
    margin-top: 0;
    padding: 15px 20px 20px 20px;
}

.personal-info-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.personal-info-form input,
.personal-info-form select {
    margin-bottom: 15px;
    padding: 10px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.personal-info-form button {
    width: auto;
    padding: 10px 20px;
    margin: 20px auto 0 auto;
    display: block;
    background-color: #9ccd7f; /* Verde */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.personal-info-form button:hover {
    background-color: #8db46f; /* Verde más oscuro */
}

/* Enlace "Darse de baja" */
.unsubscribe-link {
    text-align: center;
    margin-top: 5px;
}

.unsubscribe-link a {
    font-size: 12px;
    color: #cccccc;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
}

.unsubscribe-link a:hover {
    color: #333333;
    cursor: pointer;
}

/* Mensaje de límite */
.limit-message-container {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

.limit-message-container p {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
}

.limit-message-container button {
    background-color: #9ccd7f; /* Verde */
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.limit-message-container button:hover {
    background-color: #8db46f; /* Verde más oscuro */
}

/* Ajuste para pantallas móviles */
@media (max-width: 768px) {
    header {
        height: 50px;
    }
    header img {
        max-width: 150px;
        height: auto;
    }

    .main-container {
        max-width: 95vw;
        margin: 0 auto;
    }

    .personal-info-form {
        max-width: 95vw;
        margin: 10px auto;
    }

    .chat-container {
        max-width: 95vw;
        margin: 10px auto 30px auto;
        max-height: none;
        height: calc(100vh - 200px); /* Ajuste de altura para móviles */
    }

    .message {
        max-width: 90%; /* Burbujas un poco más anchas en móvil */
        font-size: 14px;
    }

    #chatWindow {
        padding: 8px;
    }

    .personal-info-form summary {
        font-size: 16px;
        border-radius: 10px;
        margin: 0;
    }

    .personal-info-form button {
        font-size: 14px;
        padding: 8px 15px;
    }

    textarea {
        font-size: 14px;
    }

    button {
        font-size: 14px;
        padding: 8px 15px;
    }

    .personal-info-form details[open] {
        background-color: transparent;
        border: none;
        box-shadow: none;
    }

    .personal-info-form details {
        border: none;
        box-shadow: none;
    }

    .personal-info-form form {
        padding: 10px 0;
    }
}
