/* Burbuja del chat de Destápalo (chat.js). Base del globo del Dr. Guzmán con los colores de la casa (identidad/DESTAPALO.md):
   burdeos para lo que se pulsa, crema y rosa para los mensajes, dorado solo en el foco. */
.chat-globo { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; min-height: 56px; border-radius: 999px; padding: 6px 20px 6px 12px;
  display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: center; text-align: left; cursor: pointer;
  background: var(--burdeos); color: var(--crema); border: 2px solid var(--crema); font: 700 1rem/1.2 "Figtree", system-ui, sans-serif; box-shadow: 0 4px 14px rgb(0 0 0 / .2); }
.chat-globo-icono { grid-row: span 2; font-size: 24px; }
.chat-globo small { font-weight: 400; font-size: .875rem; opacity: .9; }
.chat-panel { position: fixed; right: 16px; bottom: 16px; z-index: 61; width: min(400px, calc(100vw - 32px)); height: min(680px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background: var(--blanco); color: var(--tinta); border-radius: 14px; box-shadow: 0 8px 30px rgb(0 0 0 / .25); overflow: hidden; font: 400 16px/1.5 "Figtree", system-ui, sans-serif; padding: 0; }
.chat-panel[hidden], .chat-globo[hidden] { display: none; }
.chat-globo:focus-visible, .chat-panel button:focus-visible, .chat-panel a:focus-visible, .chat-panel textarea:focus-visible { outline: 3px solid var(--dorado); outline-offset: 2px; }
.chat-cabecera { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 6px 14px; background: var(--burdeos); color: var(--crema); }
.chat-cabecera h2 { font-size: 1.1rem; margin: 0; color: var(--crema); }
.chat-cerrar { border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--crema); min-width: 44px; min-height: 44px; }
.chat-cuerpo { flex: 1; overflow-y: auto; padding: 12px 14px; }
.chat-cuerpo p { margin: 0 0 .7em; max-width: none; } .chat-cuerpo p:last-child { margin-bottom: 0; }
.chat-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; margin: 0 0 8px; overflow-wrap: anywhere; }
.chat-bot { background: var(--crema); }
.chat-yo { background: var(--rosa); margin-left: auto; }
.chat-cuerpo a { color: var(--burdeos); font-weight: 600; }
.chat-foto { display: block; margin-bottom: 6px; } .chat-foto img { display: block; width: 100%; max-width: 220px; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--blanco); }
.chat-ver { display: inline-flex; align-items: center; min-height: 40px; }
.chat-entrada { margin-block: auto; } .chat-cuerpo:has(.chat-entrada) { display: flex; flex-direction: column; }
.chat-casilla { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: .95rem; }
.chat-casilla input { margin-top: 1px; flex: none; width: 24px; height: 24px; accent-color: var(--burdeos); }
.chat-aviso { font-size: .875rem; margin-bottom: 10px; }
.chat-aviso[hidden] { display: block; visibility: hidden; } /* al marcar la casilla el aviso se oculta pero conserva su sitio: el botón Empezar no salta */
.chat-empezar, .chat-form button { background: var(--burdeos); color: var(--blanco); font: 700 1rem "Figtree", system-ui, sans-serif; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px; }
.chat-empezar { width: 100%; }
.chat-empezar:disabled, .chat-form button:disabled { background: #E8DCCB; color: var(--tinta-2); cursor: not-allowed; }
.chat-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.chat-menu button, .chat-opcion { font: .875rem "Figtree", system-ui, sans-serif; min-height: 40px; padding: 5px 12px; border-radius: 999px; border: 1px solid #E8DCCB; background: var(--blanco); color: var(--tinta); cursor: pointer; }
.chat-form { display: flex; gap: 6px; padding: 8px 14px; }
.chat-form textarea { flex: 1; resize: none; font: 16px/1.4 "Figtree", system-ui, sans-serif; padding: 6px 8px; border: 1px solid #E8DCCB; border-radius: 8px; } /* 16 px: iOS no amplía al escribir */
.chat-panel:has(.chat-entrada) .chat-form { display: none; }
.chat-pie { font-size: .875rem; margin: 0; padding: 4px 14px 12px; color: var(--tinta-2); max-width: none; }
.chat-pie p { margin: 0; max-width: none; }
.chat-pie a { color: var(--burdeos); display: inline-block; padding-block: 8px; }
body:has(.chat-globo) .pie { padding-bottom: 88px; } /* la pastilla no tapa la última línea del pie */
body:has(#cookies:not([hidden])) .chat-globo { display: none; } /* primero se decide el aviso de cookies: la pastilla taparía sus botones */
@media (max-width: 640px) {
  .chat-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .chat-globo { min-height: 48px; padding: 4px 14px 4px 10px; column-gap: 6px; font-size: 15px; }
  .chat-globo-icono { grid-row: auto; font-size: 18px; }
  .chat-globo small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } /* solo para el lector: el «(IA)» se ve en la cabecera del panel */
  .chat-msg { max-width: 92%; } .chat-bot { max-width: 100%; }
}
