/* Estilos del chat. Archivo aparte porque lo usan index.html (paciente) y
   profesional.html: si estuviera copiado en cada <style>, las dos vistas se irian
   separando con el tiempo. Usa los mismos tokens (--primary, --radius-card, etc.) que
   ya define cada pagina. */

.chat-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
    min-height: 420px;
}

/* --- Columna de conversaciones --- */
.chat-lista {
    background: white;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    overflow-y: auto;
    padding: 10px;
}
.chat-conv {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.chat-conv:hover { background: #F8FAFC; }
.chat-conv.activa { background: var(--primary-light); }
.chat-conv-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; font-weight: 700; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
}
.chat-conv-texto { flex: 1; min-width: 0; }
.chat-conv-nombre { font-size: 0.85rem; font-weight: 700; color: var(--text-dark); }
.chat-conv-ultimo {
    font-size: 0.75rem; color: var(--text-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-badge {
    background: var(--primary); color: white; font-size: 0.68rem; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* --- Hilo --- */
.chat-hilo {
    background: white;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-hilo-header {
    padding: 16px 22px;
    border-bottom: 1px solid #F1F5F9;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.chat-hilo-nombre { font-size: 0.95rem; font-weight: 700; color: var(--primary-dark); }
.chat-estado-conexion { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); }
.chat-estado-conexion.en-vivo { color: var(--success); }

.chat-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-msg { max-width: 72%; display: flex; flex-direction: column; gap: 3px; }
.chat-msg.mio { align-self: flex-end; align-items: flex-end; }
.chat-msg.suyo { align-self: flex-start; }
.chat-burbuja {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-msg.mio .chat-burbuja { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-msg.suyo .chat-burbuja { background: #F1F5F9; color: var(--text-dark); border-bottom-left-radius: 4px; }
.chat-hora { font-size: 0.65rem; color: var(--text-muted); }
.chat-dia {
    align-self: center;
    font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
    background: #F8FAFC; padding: 4px 14px; border-radius: 20px; margin: 6px 0;
}

.chat-form {
    display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid #F1F5F9;
}
.chat-form textarea {
    flex: 1; resize: none; min-height: 44px; max-height: 120px;
    padding: 12px 16px; border-radius: 14px; border: 1.5px solid #E2E8F0;
    font-family: inherit; font-size: 0.85rem; outline: none; color: var(--text-dark);
}
.chat-form textarea:focus { border-color: var(--primary); }
.chat-enviar {
    background: var(--primary); color: white; border: none; border-radius: 14px;
    width: 46px; flex-shrink: 0; cursor: pointer; font-size: 1rem;
}
.chat-enviar:hover { background: var(--primary-dark); }
.chat-enviar:disabled { background: #CBD5E1; cursor: not-allowed; }

.chat-vacio {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 30px; gap: 8px;
}

@media (max-width: 900px) {
    .chat-layout { grid-template-columns: 1fr; height: auto; }
    .chat-lista { max-height: 240px; }
    .chat-hilo { height: 70vh; }
}
