/* pantalla chats — lista de conversaciones */

.chats-screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 12px;
}
.chats-screen--embedded {
  padding: 16px 12px 10px;
}

/* ---- Header ------------------------------------------------ */
.chats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 14px;
  flex: 0 0 auto;
}
.chats-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.chats-newbtn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transition: transform .12s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.chats-newbtn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.chats-newbtn:hover { background: var(--glass-strong); border-color: var(--edge-hi); }
.chats-newbtn:active { transform: scale(.97); }
.chats-newbtn:focus-visible { outline: 2px solid var(--edge-hi); outline-offset: 2px; }

/* ---- Search -------------------------------------------------- */
.chats-search {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 14px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.chats-search:focus-within {
  background: var(--glass-strong);
  border-color: var(--edge-hi);
}
.chats-search-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke: var(--ink-faint);
  fill: none;
  stroke-width: 1.6;
}
.chats-search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
}
.chats-search-input::placeholder { color: var(--ink-faint); }
.chats-search-input::-webkit-search-cancel-button { cursor: pointer; }

/* ---- List ------------------------------------------------- */
.chats-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.chats-noresults {
  margin: 24px 8px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1.5;
}

.chats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease);
}
.chats-row:hover { background: var(--glass); }
.chats-row:active { transform: scale(.97); }
.chats-row:focus-visible { outline: 2px solid var(--edge-hi); outline-offset: -2px; }
.chats-row--active {
  background: var(--glass-strong);
  border-color: var(--edge-hi);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.chats-row-avatar {
  --sz: 48px;
  position: relative;
}
.chats-verified {
  position: absolute;
  right: -3px;
  top: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
/* La lucecita de "en línea": abajo a la derecha, con GLOW real */
.chats-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ok);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 10px 2px rgba(87, 217, 163, .55);
}

.chats-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chats-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.chats-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}
.chats-row-time {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-faint);
}
.chats-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chats-row-msg {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.chats-typing {
  color: var(--accent);
  font-style: italic;
}
@media (prefers-reduced-motion: no-preference) {
  .chats-typing { animation: chats-typing-pulse 1.6s ease-in-out infinite; }
}
@keyframes chats-typing-pulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}
.chats-row-badge { flex: 0 0 auto; }

/* ---- New chat modal ---------------------------------------- */
.chats-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 5, 8, .48);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@media (min-width: 900px) {
  .chats-modal-backdrop { align-items: center; }
}
.chats-modal {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) {
  .chats-modal { margin-bottom: 0; }
}
.chats-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chats-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}
.chats-modal-close {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--edge);
  color: var(--ink-dim);
  cursor: pointer;
  transition: background .18s var(--ease), transform .12s var(--ease);
}
.chats-modal-close svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.chats-modal-close:hover { background: var(--glass-strong); color: var(--ink); }
.chats-modal-close:active { transform: scale(.97); }
.chats-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chats-modal-action {
  justify-content: flex-start;
  width: 100%;
}
.chats-modal-action svg {
  width: 19px;
  height: 19px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
  flex: 0 0 auto;
}

/* ---- Empty state (desktop pane-main, sin chat abierto) ------ */
.chats-empty-shell {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.chats-empty-card {
  width: min(100%, 380px);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.chats-empty-logo {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--accent-soft);
  border: 1px solid var(--edge-hi);
  box-shadow: 0 0 60px 6px var(--accent-soft);
}
/* Entrada única, sin loop infinito: una animación perpetua fuerza recomposición
   permanente de los vidrios y traba la app en equipos sin GPU. */
@media (prefers-reduced-motion: no-preference) {
  .chats-empty-logo { animation: chats-empty-float .8s var(--ease) both; }
}
@keyframes chats-empty-float {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.chats-empty-title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}
.chats-empty-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 14px;
}

/* ---- Contacto bloqueado en la lista ------------------------ */
.chats-row--blocked { opacity: .55; }
.chats-row--blocked .chats-row-avatar { filter: grayscale(1); }
.chats-blocked-tag { font-size: 12px; }
.chats-row-menu { position: fixed; z-index: 90; }

/* ---- Aviso para activar las notificaciones -------------------- */
.push-aviso {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 14px 12px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid var(--glass-line, rgba(255, 255, 255, .14));
  animation: pushAvisoIn .45s ease-out;
}

.push-aviso-icono {
  font-size: 1.35rem;
  flex: 0 0 auto;
}

.push-aviso-txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.push-aviso-txt b {
  font-size: .92rem;
}

.push-aviso-txt span {
  font-size: .78rem;
  line-height: 1.4;
  color: var(--txt-2, rgba(255, 255, 255, .62));
}

.push-aviso-btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  font-size: .82rem;
}

.push-aviso-x {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--txt-2, rgba(255, 255, 255, .5));
  font-size: .8rem;
  cursor: pointer;
}

.push-aviso-x:hover {
  background: var(--glass-2, rgba(255, 255, 255, .08));
}

@keyframes pushAvisoIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 420px) {
  .push-aviso { flex-wrap: wrap; }
  .push-aviso-btn { width: 100%; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .push-aviso { animation: none; }
}
