/* css/mi-espacio.css — página personal (chat + colaboraciones).
   Se carga DESPUÉS de style.css y solo agrega lo propio de la app,
   usando la paleta del sitio: acento #4d4f4c, bordes #eee, panel #f6f6f6. */

/* ---------- puerta de entrada ---------- */
.gate-acciones { margin-top: 1.5rem; }
#gate-caido { color: #999; font-style: italic; }
#dev-box { max-width: 340px; margin: 1.5rem auto 0; }
#dev-box .dev-nota { color: #aaa; font-size: 0.8rem; margin: 0 0 0.5rem; }
#dev-box .u {
  display: block; width: 100%; padding: 0.6rem; margin: 0.4rem 0;
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  color: #333; cursor: pointer; font-size: 0.95rem; font-family: Arial, sans-serif;
}
#dev-box .u:hover { border-color: #4d4f4c; }
#dev-box input {
  width: 100%; padding: 0.6rem; margin-top: 0.75rem; box-sizing: border-box;
  border: 1px solid #ddd; border-radius: 8px; font-size: 0.95rem;
  font-family: Arial, sans-serif;
}

/* ---------- barra de usuario ---------- */
.barra-usuario {
  display: flex; align-items: center; gap: 0.4rem;
  max-width: 1100px; margin: 0 auto; padding: 0.75rem 1rem 0;
}
.barra-usuario #quien { color: #666; font-size: 0.9rem; margin-right: auto; }
.barra-usuario button {
  background: none; border: 1px solid #ddd; color: #888; border-radius: 9999px;
  padding: 0.3rem 0.9rem; cursor: pointer; font-size: 0.85rem;
  font-family: Arial, sans-serif;
}
.barra-usuario button:hover { border-color: #4d4f4c; color: #333; }

/* ---------- layout ---------- */
.espacio-grid {
  display: grid; grid-template-columns: 1fr 320px; gap: 14px;
  max-width: 1100px; margin: 0 auto; padding: 14px 1rem 1.5rem;
}
.panel-app { background: #fff; border: 1px solid #eee; border-radius: 10px; }

/* ---------- chat ---------- */
#chat { display: flex; flex-direction: column; height: calc(100vh - 190px); min-height: 420px; }
#mensajes {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg {
  max-width: 78%; padding: 9px 14px 10px; border-radius: 16px;
  line-height: 1.45; font-size: 0.95rem; white-space: pre-wrap;
}
.msg::before {
  display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px;
  margin-bottom: 3px; opacity: 0.8;
}
/* TÚ: derecha, acento del sitio */
.yo { align-self: flex-end; background: #4d4f4c; color: #fff; border-bottom-right-radius: 4px; }
.yo::before { content: "TÚ"; text-align: right; color: #d8d8d5; }
/* Agente: izquierda, panel suave */
.agente {
  align-self: flex-start; background: #f6f6f6; color: #333;
  border: 1px solid #eee; border-left: 3px solid #4d4f4c; border-bottom-left-radius: 4px;
}
.agente::before { content: "🚀 L0V3"; color: #4d4f4c; }
.propuesta {
  align-self: flex-start; background: #fff; color: #333;
  border: 1px solid #4d4f4c; border-radius: 16px;
}
.propuesta::before { content: "🚀 L0V3 · propuesta"; color: #4d4f4c; }
.propuesta .acciones { margin-top: 10px; display: flex; gap: 8px; }
.propuesta button {
  padding: 0.4rem 1.1rem; border-radius: 9999px; border: none; cursor: pointer;
  font-weight: 600; font-size: 0.85rem; font-family: Arial, sans-serif;
}
.propuesta .si { background: #4d4f4c; color: #fff; }
.propuesta .no { background: #eee; color: #555; }
.pensando { opacity: 0.55; font-style: italic; }
#entrada { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eee; align-items: center; }
#entrada input[type="text"], #entrada #texto {
  flex: 1; padding: 0.65rem; border: 1px solid #ddd; border-radius: 10px;
  font-size: 0.95rem; font-family: Arial, sans-serif; min-width: 0;
}
#entrada button {
  padding: 0.55rem 1.2rem; background: #4d4f4c; color: #fff; border: none;
  border-radius: 9999px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif;
}
#mic { background: #eee !important; color: #333; font-size: 1.1rem; user-select: none; }
#mic.grabando { background: #c0392b !important; color: #fff; animation: pulso 1s infinite; }
@keyframes pulso { 50% { opacity: 0.6; } }
#voz-toggle {
  display: flex; align-items: center; gap: 4px; font-size: 0.8rem;
  color: #888; cursor: pointer; padding: 0 4px;
}

/* ---------- panel lateral ---------- */
#lateral {
  padding: 14px 16px; font-size: 0.85rem; color: #555;
  height: calc(100vh - 190px); min-height: 420px;
  display: flex; flex-direction: column; overflow: hidden;
}
#lateral h3 {
  color: #333; font-size: 0.8rem; letter-spacing: 1px; margin: 12px 0 5px;
  text-transform: uppercase; flex-shrink: 0;
}
#lateral h3 small { color: #aaa; font-weight: 400; text-transform: none; letter-spacing: 0; }
#lateral h3:first-child { margin-top: 0; }
#lateral ul {
  list-style: none; margin: 0; padding: 0 4px 0 0;
  overflow-y: auto; flex: 1 1 0; min-height: 46px;
}
#lateral li { padding: 5px 0; border-bottom: 1px dashed #e5e5e5; }
.badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 9999px;
  background: #eee; color: #555; margin-left: 6px;
}
.b-coordinando, .b-cerrada { background: #dcefe0; color: #1c4d2a; }
.b-rechazada, .b-expirada { background: #f5dcdc; color: #4d1c1c; }
#p-colabs li.abrible { cursor: pointer; }
#p-colabs li.abrible:hover { color: #000; }

/* ---------- modal del hilo de coordinación ---------- */
#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none;
  align-items: center; justify-content: center; z-index: 100;
}
#hilo {
  width: min(480px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  background: #fff; border: 1px solid #ccc; border-radius: 12px; overflow: hidden;
}
#hilo-head { padding: 14px 16px; border-bottom: 1px solid #eee; }
#hilo-head b { color: #333; }
#hilo-head small { color: #888; display: block; margin-top: 3px; }
#hilo-msgs {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
#hilo-msgs .m {
  max-width: 80%; padding: 8px 13px 9px; border-radius: 14px;
  font-size: 0.9rem; white-space: pre-wrap;
}
#hilo-msgs .m::before {
  display: block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  margin-bottom: 2px; opacity: 0.8;
}
#hilo-msgs .m.mio { align-self: flex-end; background: #4d4f4c; color: #fff; border-bottom-right-radius: 4px; }
#hilo-msgs .m.mio::before { content: "TÚ"; text-align: right; color: #d8d8d5; }
#hilo-msgs .m.suyo {
  align-self: flex-start; background: #f6f6f6; color: #333;
  border: 1px solid #eee; border-left: 3px solid #4d4f4c; border-bottom-left-radius: 4px;
}
#hilo-msgs .m.suyo::before { content: attr(data-autor); color: #4d4f4c; }
#hilo-msgs .sys { align-self: center; font-size: 0.75rem; color: #999; font-style: italic; }
#hilo-in { display: flex; gap: 6px; padding: 12px; border-top: 1px solid #eee; }
#hilo-in input {
  flex: 1; padding: 0.6rem; border: 1px solid #ddd; border-radius: 8px;
  font-size: 0.9rem; font-family: Arial, sans-serif; min-width: 0;
}
#hilo-in button {
  padding: 0 16px; background: #4d4f4c; color: #fff; border: none;
  border-radius: 9999px; font-weight: 700; cursor: pointer; font-family: Arial, sans-serif;
}
#hilo-acc { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
#hilo-acc button {
  flex: 1; padding: 8px; border-radius: 9999px; border: 1px solid #ddd;
  background: none; color: #777; cursor: pointer; font-size: 0.8rem;
  font-family: Arial, sans-serif;
}
#hilo-acc button:hover { border-color: #4d4f4c; color: #333; }
#hilo-acc .cerrar:hover { border-color: #c0392b; color: #c0392b; }

/* ---------- responsive ---------- */
@media (max-width: 800px) {
  .espacio-grid { grid-template-columns: 1fr; }
  #chat { height: calc(100vh - 200px); min-height: 360px; }
  #lateral { height: auto; }
  #lateral ul { max-height: 32vh; flex: none; }
}
