/* Ventana de demostracion de Kutmut: replica funcional de la interfaz real de
   la aplicacion con datos de ejemplo. Paleta del producto, no del sitio. */

.kd {
  --a-fondo: #0b141a;
  --a-top: #182229;
  --a-panel: #202c33;
  --a-alto: #2a3942;
  --a-borde: #222d34;
  --a-tinta: #e9edef;
  --a-suave: #8696a0;
  --a-verde: #00a884;
  --a-burbuja: #005c4b;

  position: relative;
  background: var(--a-fondo);
  border: 1px solid #e3e8ea;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(16, 36, 43, .18);
  overflow: hidden;
  color: var(--a-tinta);
  display: flex; flex-direction: column;
  height: min(78vh, 760px);
  min-height: 560px;
  text-align: left;
}

.kd-iframe { flex: 1; border: 0; width: 100%; display: block; background: #0b141a; }

/* Marco con la captura real: altura natural de la imagen */
.kd-suelto { height: auto; min-height: 0; }
.kd-img { display: block; width: 100%; height: auto; }

/* Carrusel de capturas reales en el hero */
.kd-carrusel { position: relative; }
.kd-carrusel .kd-img { display: none; }
.kd-carrusel .kd-img.sel { display: block; }
.kd-flecha { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(11, 20, 26, .72); color: #e9edef; font-size: 24px; line-height: 1; cursor: pointer; transition: background .12s; padding: 0 0 4px; }
.kd-flecha:hover { background: #00a884; }
.kd-ant { left: 12px; }
.kd-sig { right: 12px; }
.k-puntos { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.k-punto { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #e3e8ea; background: #e3e8ea; cursor: pointer; padding: 0; transition: background .12s; }
.k-punto:hover { background: #5c7079; border-color: #5c7079; }
.k-punto.sel { background: #00a884; border-color: #00a884; }

.kd-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Barra de titulo ---- */
.kd-titulo { display: flex; align-items: center; gap: 10px; background: var(--a-top); padding: 0 14px; height: 38px; flex-shrink: 0; border-bottom: 1px solid var(--a-borde); }
.kd-nombre { font-size: 13px; font-weight: 800; letter-spacing: -.3px; color: var(--a-tinta); }
.kd-nombre span { color: var(--a-verde); }
.kd-tag { font-size: 11px; font-weight: 700; color: #062e25; background: var(--a-verde); border-radius: 999px; padding: 2px 9px; }
.kd-controles { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.kd-controles i { display: block; width: 10px; height: 10px; position: relative; opacity: .55; }
.kd-min::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 2px solid var(--a-suave); }
.kd-max::before { content: ''; position: absolute; inset: 0; border: 2px solid var(--a-suave); }
.kd-cerrar::before, .kd-cerrar::after { content: ''; position: absolute; left: -1px; right: -1px; top: 4px; border-top: 2px solid var(--a-suave); }
.kd-cerrar::before { transform: rotate(45deg); }
.kd-cerrar::after { transform: rotate(-45deg); }

/* ---- Pestanas de plataformas ---- */
.kd-plats { display: flex; gap: 6px; align-items: center; background: var(--a-top); padding: 0 10px; height: 42px; flex-shrink: 0; border-bottom: 1px solid var(--a-borde); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.kd-plats::-webkit-scrollbar { display: none; }
.kd-plat { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; background: transparent; border: none; cursor: pointer; color: var(--a-suave); font-family: inherit; font-size: 13px; padding: 6px 13px; border-radius: 999px; }
.kd-plat:hover { background: var(--a-panel); color: var(--a-tinta); }
.kd-plat.sel { color: #fff; font-weight: 600; background: var(--a-panel); }
.kd-plat .pd { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kd-plat .pc { background: var(--a-alto); color: var(--a-suave); border-radius: 9px; font-size: 10.5px; padding: 1px 6px; min-width: 18px; text-align: center; }
.kd-plat .pc:empty { display: none; }
.kd-plat.sel .pc { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---- Cuerpo ---- */
.kd-cuerpo { flex: 1; display: flex; min-height: 0; position: relative; }

/* Pestana para plegar el carril, como en la aplicacion */
.kd-plegar { position: absolute; left: 72px; top: 50%; transform: translateY(-50%); width: 14px; height: 56px; background: var(--a-panel); border: none; color: var(--a-suave); border-radius: 0 7px 7px 0; cursor: pointer; z-index: 5; opacity: .55; font-size: 12px; line-height: 1; padding: 0; transition: left .18s ease, opacity .15s; }
.kd-plegar:hover { opacity: 1; color: var(--a-verde); }
.kd.plegado .kd-plegar { left: 0; }

.kd-lateral { width: 72px; background: var(--a-panel); display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 12px 0; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; transition: width .18s ease, padding .18s ease; }
.kd-lateral::-webkit-scrollbar { display: none; }
.kd.plegado .kd-lateral { width: 0; padding: 0; }
.kd-acc { position: relative; width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; border: none; cursor: pointer; font-family: inherit; font-size: 15px; font-weight: 600; color: #fff; display: flex; align-items: center; justify-content: center; opacity: .55; transition: opacity .15s, transform .1s, box-shadow .15s; }
.kd-acc:hover { opacity: .85; }
.kd-acc.sel { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 3px var(--a-verde); }
.kd-noleidos { position: absolute; top: -4px; right: -4px; background: var(--a-verde); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 4px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--a-panel); }
.kd-noleidos:empty { display: none; }
.kd-etiq { font-size: 9px; color: var(--a-suave); max-width: 64px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -5px; flex-shrink: 0; }
.kd-mas { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; border: 2px dashed var(--a-suave); background: transparent; color: var(--a-suave); font-size: 22px; cursor: pointer; margin-top: 2px; transition: border-color .15s, color .15s; }
.kd-mas:hover { border-color: var(--a-verde); color: var(--a-verde); }

/* ---- Lista de conversaciones de la cuenta ---- */
.kd-lista { width: 250px; background: #111b21; border-right: 1px solid var(--a-borde); display: flex; flex-direction: column; flex-shrink: 0; min-height: 0; }
.kd-lista-cab { height: 52px; padding: 0 16px; display: flex; align-items: center; font-weight: 600; font-size: 14px; color: var(--a-tinta); background: var(--a-panel); border-bottom: 1px solid var(--a-borde); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-lista-in { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3b4a54 transparent; }
.kd-cta { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; background: transparent; border: none; border-bottom: 1px solid rgba(34, 45, 52, .55); cursor: pointer; font-family: inherit; text-align: left; }
.kd-cta:hover { background: var(--a-panel); }
.kd-cta.sel { background: var(--a-alto); }
.kd-cta-avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kd-cta-main { flex: 1; min-width: 0; }
.kd-cta-nombre { display: block; font-size: 13.5px; font-weight: 600; color: var(--a-tinta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-cta-tira { display: block; font-size: 12px; color: var(--a-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-cta .kd-noleidos { position: static; border: none; flex-shrink: 0; }

/* ---- Conversacion ---- */
.kd-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--a-fondo); }
.kd-cab { display: flex; align-items: center; gap: 10px; background: var(--a-panel); padding: 0 16px; height: 52px; flex-shrink: 0; border-bottom: 1px solid var(--a-borde); }
.kd-cab-avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kd-cab-quien { min-width: 0; }
.kd-cab-nombre { display: block; font-size: 14px; font-weight: 600; color: var(--a-tinta); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-cab-donde { display: block; font-size: 11.5px; color: var(--a-suave); line-height: 1.25; }
.kd-mensajes { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; scrollbar-color: #3b4a54 transparent; }
.kd-mensajes::-webkit-scrollbar { width: 5px; }
.kd-mensajes::-webkit-scrollbar-thumb { background: #3b4a54; border-radius: 3px; }
.kd-msg { max-width: 70%; padding: 8px 12px; border-radius: 9px; font-size: 14px; line-height: 1.45; color: var(--a-tinta); overflow-wrap: break-word; }
.kd-msg.ellos { background: var(--a-panel); align-self: flex-start; border-top-left-radius: 2px; }
.kd-msg.yo { background: var(--a-burbuja); align-self: flex-end; border-top-right-radius: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .kd-msg.nuevo { animation: kd-entra .18s ease-out; }
  @keyframes kd-entra { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}

/* ---- Campo de escritura ---- */
.kd-escribir { display: flex; gap: 9px; align-items: center; background: var(--a-top); padding: 10px 12px; flex-shrink: 0; border-top: 1px solid var(--a-borde); margin: 0; }
.kd-escribir input { flex: 1; min-width: 0; background: var(--a-alto); border: none; border-radius: 999px; padding: 10px 16px; color: var(--a-tinta); font-family: inherit; font-size: 14px; outline: none; }
.kd-escribir input::placeholder { color: var(--a-suave); }
.kd-escribir input:focus { box-shadow: 0 0 0 1px var(--a-verde); }
.kd-enviar { background: var(--a-verde); color: #fff; border: none; border-radius: 999px; padding: 10px 20px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: filter .12s; }
.kd-enviar:hover { filter: brightness(1.1); }

/* ---- Plataforma sin cuentas ---- */
.kd-vacio { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--a-suave); padding: 24px; text-align: center; }
.kd-vacio .pd-grande { width: 42px; height: 42px; border-radius: 50%; }
.kd-vacio h4 { margin: 0; font-size: 17px; font-weight: 500; color: var(--a-tinta); }
.kd-vacio p { margin: 0; font-size: 13.5px; max-width: 40ch; }
.kd-vacio-btn { background: var(--a-verde); color: #fff; border: none; border-radius: 999px; padding: 11px 24px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: filter .12s; }
.kd-vacio-btn:hover { filter: brightness(1.1); }

/* ---- Modal de nueva cuenta, como el de la aplicacion ---- */
.kd-modal-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); display: none; align-items: center; justify-content: center; z-index: 10; }
.kd-modal-bg.open { display: flex; }
.kd-modal { background: var(--a-panel); border-radius: 12px; padding: 22px; width: 300px; max-width: 90%; display: flex; flex-direction: column; gap: 13px; margin: 0; }
.kd-modal h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--a-tinta); }
.kd-modal input { background: var(--a-alto); border: none; border-radius: 9px; padding: 10px 12px; color: var(--a-tinta); font-family: inherit; font-size: 14px; outline: none; }
.kd-modal input:focus { box-shadow: 0 0 0 1px var(--a-verde); }
.kd-modal-fila { display: flex; gap: 10px; justify-content: flex-end; }
.kd-m-ok { background: var(--a-verde); color: #fff; border: none; border-radius: 999px; padding: 8px 18px; font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.kd-m-ok:hover { filter: brightness(1.1); }
.kd-m-no { background: transparent; color: var(--a-verde); border: none; border-radius: 999px; padding: 8px 14px; font-family: inherit; font-size: 14px; cursor: pointer; }

.kd-lista[hidden], .kd-vacio[hidden] { display: none; }

/* ---- Movil ---- */
@media (max-width: 900px) {
  .kd-lista { display: none; }
}
@media (max-width: 700px) {
  .kd { height: 480px; min-height: 440px; }
  .kd-lateral { width: 60px; }
  .kd-acc { width: 42px; height: 42px; font-size: 13px; }
  .kd-mas { width: 42px; height: 42px; font-size: 19px; }
  .kd-etiq { max-width: 54px; }
  .kd-msg { max-width: 85%; }
  .kd-plat { padding: 6px 10px; }
  .kd-plegar { display: none; }
}
