/* --- Contenedor Principal del Chat --- */
#tai-chat-container {
    max-width: 700px; /* Un poco más ancho para las 3 cartas */
    margin: 30px auto;
    border: 1px solid #4a3d6a;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Georgia', 'Times New Roman', serif;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 650px;
    background-color: #1c1824;
}

/* --- Área de Mensajes --- */
#tai-chat-messages {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    background-color: #1c1824;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#tai-chat-messages::-webkit-scrollbar { width: 8px; }
#tai-chat-messages::-webkit-scrollbar-track { background: #2a233d; }
#tai-chat-messages::-webkit-scrollbar-thumb { background-color: #6a5acd; border-radius: 10px; }

/* --- Mensajes Individuales --- */
.tai-message {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    max-width: 95%; /* Aumentamos el ancho de los mensajes de la IA */
    line-height: 1.6;
}

.tai-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 85%;
}

.tai-message-user .tai-message-text {
    background-color: #6a5acd;
    color: #f0f0f0;
    padding: 12px 18px;
    border-radius: 18px 18px 5px 18px;
}

.tai-message-ia {
    align-self: flex-start;
}

.tai-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #9d8de0;
    flex-shrink: 0;
    margin-top: 5px;
}

.tai-message-ia .tai-message-content {
    background-color: #2a233d;
    color: #d8d2ef;
    padding: 15px;
    border-radius: 5px 18px 18px 18px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    width: 100%; /* Para que ocupe todo el espacio del mensaje */
}

/* --- ESTILOS PARA LA TIRADA DE 3 CARTAS --- */
.tai-tarot-cards-wrapper {
    display: flex;
    justify-content: space-around; /* Espacio entre cartas */
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.tai-tarot-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-basis: 30%; /* Cada carta ocupa un tercio del espacio */
}

.tai-tarot-card-image {
    width: 90px; /* Reducimos el tamaño de la imagen */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tai-tarot-card-name {
    font-weight: bold;
    color: #e0d8ff;
    font-size: 0.9em; /* Reducimos el tamaño de la fuente */
    text-shadow: 1px 1px 3px #000;
    text-align: center;
}

/* --- Área de Entrada de Texto --- */
#tai-chat-input-area {
    display: flex;
    padding: 15px;
    gap: 10px;
    border-top: 1px solid #4a3d6a;
    background-color: #2a233d;
}

#tai-chat-input {
    flex-grow: 1;
    border: 1px solid #6a5acd;
    border-radius: 20px;
    padding: 10px 18px;
    font-size: 1em;
    outline: none;
    background-color: #1c1824;
    color: #f0f0f0;
    transition: border-color 0.3s;
}

#tai-chat-input:focus {
    border-color: #9d8de0;
}

#tai-chat-input::placeholder {
    color: #888;
}

#tai-send-button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background-color: #6a5acd;
    transition: background-color 0.2s;
    color: white;
    font-size: 24px;
    line-height: 44px;
    text-align: center;
    padding: 0;
}

#tai-send-button:hover {
    background-color: #8374d3;
}

#tai-send-button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* --- Responsive para Móviles --- */
@media (max-width: 600px) {
    .tai-tarot-cards-wrapper {
        flex-direction: column; /* Apila las cartas en vertical */
        align-items: center;
    }
}