/* 🌑 Fondo general */
body {
    background: linear-gradient(135deg, #020617, #0f172a);
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    color: #e5e7eb;
}

/* 📦 Contenedor principal */
.chat-container {
    width: 100%;
    max-width: 600px;
    margin: auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
}

/* 🟨 Header */
.header {
    background: linear-gradient(90deg, #e8b723, #D4AF37);
    color: #020617;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ✅ CORREGIDO (fuera del header) */
.avatar-header {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-text {
    line-height: 1.2;
}

.header-text span {
    font-size: 12px;
    opacity: 0.8;
}

/* 💬 Área de chat */
#chat {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: stretch; /* 🔥 CLAVE */
}

/* 💬 Mensajes */
.msg {
    margin: 8px 0;
    padding: 12px 16px;
    border-radius: 16px;

    display: inline-block; /* 🔥 CLAVE */
    width: fit-content; /* 🔥 CLAVE */

    max-width: 80%;
    min-width: 120px;

    word-wrap: break-word;
    word-break: normal;
    white-space: pre-wrap;

    font-size: 14px;
    line-height: 1.5;
}

/* 👤 Usuario */
.user {
    background: linear-gradient(135deg, #b86b45, #b86b45);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* 🤖 Bot */
.bot {
    background: #1e293b;
    color: #e5e7eb;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* 🧾 Input área */
.input-area {
    display: flex;
    padding: 10px;
    background: #020617;
    border-top: 1px solid #1e293b;
    position: sticky;
    bottom: 0;
}

/* ✏️ Input */
input {
    flex: 1;
    width: 100%;
    min-width: 0; /* 🔥 CLAVE */

    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    outline: none;

    font-size: 15px;

    background: #1e293b;
    color: white;
}

/* 🔘 Botón */
button {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    border: none;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    color: white;
    cursor: pointer;

    white-space: nowrap; /* 🔥 CLAVE */
    flex-shrink: 0; /* 🔥 CLAVE */

    transition: all 0.2s ease;
}

button:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #c2410c, #9a3412);
}

/* 📱 Responsive */
@media (max-width: 600px) {

    .chat-container {
        max-width: 100%;
    }

    .msg {
        font-size: 13px;
        padding: 10px;
    }

}