/* ==========================================================================
   Estilos para TenisData Chatbot v1.2 - Pantalla Grande
   ========================================================================== */

/* --- Contenedores Principales --- */

#chat-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    width: 60px;
    height: 60px;
    background-color: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s ease-in-out, background-color 0.2s ease;
}

#chat-bubble:hover {
    transform: scale(1.1);
    background-color: #ffec8b; /* Feedback visual al pasar el ratón */
}

#tenisdata-chat-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.7); /* Ligeramente más oscuro y corporativo */
    z-index: 1000;
    display: none; 
    align-items: center;
    justify-content: center;
    opacity: 0;
    /* MEJORA: Transición para el fondo oscuro */
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#tenisdata-chat-container.is-open {
    display: flex;
    opacity: 1;
}

/* --- Ventana del Chat --- */

#chat-window {
    width: 90%;
    max-width: 650px; /* Un poco más ancha */
    height: 85%;
    max-height: 750px; /* Un poco más alta */
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    /* MEJORA: Transición de entrada más suave */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

#tenisdata-chat-container.is-open #chat-window {
    transform: scale(1) translateY(0);
}

#chat-header {
    background-color: #1a1a1a;
    color: #ffd700;
    padding: 12px 15px;
    font-weight: bold;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; /* Fuente más legible */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
    position: relative;
    flex-shrink: 0; /* Evita que el header se encoja */
}

#chat-close-btn {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
#chat-close-btn:hover {
    opacity: 1;
}

/* --- Área de Mensajes --- */

#chat-messages {
    flex-grow: 1;
    padding: 20px; /* Más espacio */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* MEJORA: Para un scroll suave en navegadores que lo soporten */
    scroll-behavior: smooth;
}

.message {
    padding: 10px 18px; /* Un poco más de padding */
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word; /* Asegura que palabras largas no rompan el layout */
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 15px;
}

.bot-message {
    background-color: #E9E9EB;
    color: #000;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.user-message {
    background-color: #007AFF;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

/* --- Input de Usuario --- */

#chat-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: #f0f0f0;
    flex-shrink: 0; /* Evita que el input se encoja */
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    padding: 12px;
    border-radius: 20px;
    background-color: #fff;
    font-size: 15px;
    transition: border-color 0.2s;
}
#chat-input:focus {
    outline: none;
    border-color: #007AFF;
}

#chat-send {
    background: none;
    border: none;
    padding: 0 15px;
    font-weight: bold;
    color: #007AFF;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#chat-send:hover {
    opacity: 1;
}

/* --- Animación de "escribiendo..." --- */

.is-typing {
    padding: 14px 18px !important;
}
.is-typing .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #999; margin: 0 2px; animation: wave 1.3s linear infinite; }
.is-typing .dot:nth-child(2) { animation-delay: -1.1s; }
.is-typing .dot:nth-child(3) { animation-delay: -0.9s; }
@keyframes wave { 0%, 60%, 100% { transform: initial; } 30% { transform: translateY(-8px); } }

/* --- Media Query para Móviles --- */
@media (max-width: 768px) {
    #chat-window {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    #chat-bubble {
        /* Hacemos la burbuja un poco más pequeña en móviles */
        width: 55px;
        height: 55px;
    }
}