/* RESET UNIVERSAL: Crucial para evitar desfases */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --white: #ffffff;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: transparent; 
    height: 100vh;
    width: 100%;
    overflow: hidden; /* Evita que el body tenga scroll propio */
    display: flex;
}

.chat-container { 
    width: 100%; 
    height: 100vh; 
    background: var(--white); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
}

/* HEADER: Ajustado para no ocupar demasiado espacio vertical */
.chat-header { 
    background: var(--primary-color); 
    color: var(--white); 
    padding: 10px 15px; 
    display: flex; 
    align-items: center; 
    gap: 12px;
    flex-shrink: 0; /* Evita que el header se aplaste */
}

#avatar-img { 
    width: 45px; 
    height: 45px; 
    border-radius: 50%; 
    border: 2px solid var(--white); 
    background: #eee; 
    object-fit: cover; 
    object-position: center; 
}

.avatar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Evita que el avatar se aplaste en pantallas pequeñas */
}

.header-info { display: flex; flex-direction: column; }
.agent-name { font-weight: bold; font-size: 0.95em; }
.agent-role { font-size: 0.75em; opacity: 0.8; }

/* CHAT BOX: El área que debe crecer */
.chat-box { 
    flex: 1; 
    padding: 15px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    background: #fdfdfd;
}

.message { 
    max-width: 85%; 
    padding: 8px 12px; 
    border-radius: 12px; 
    font-size: 0.9em; 
    line-height: 1.4;
}

.message.bot { background: #e8f1f8; align-self: flex-start; border-bottom-left-radius: 2px; }
.message.user { background: var(--accent-color); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }

/* INPUT AREA: Ajuste fino para que no se corte */
.chat-input-area { 
    padding: 10px; 
    border-top: 1px solid #eee; 
    display: flex; 
    gap: 8px; 
    background: white;
    flex-shrink: 0;
}

input { 
    flex: 1; 
    border: 1px solid #ddd; 
    padding: 8px 12px; 
    border-radius: 20px; 
    outline: none;
    font-size: 0.9em;
}

button#send-btn { 
    background: var(--accent-color); 
    border: none; 
    width: 35px; 
    height: 35px; 
    border-radius: 50%; 
    fill: white; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer;
}