/* chat.css — «Pregúntale a la Ley» (chat/chat.js). Mobile first, tema claro. */
.lc-fab, .lc-panel {
  --lc-rojo: #C8102E;
  --lc-navy: #1F3A5F;
  --lc-ink: #14202f;
  --lc-muted: #5b6676;
  --lc-paper: #ffffff;
  --lc-soft: #f4f6f9;
  --lc-rule: #dde2ea;
  --lc-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
  font-family: var(--lc-font);
}
.lc-fab *, .lc-panel * { box-sizing: border-box; }
.lc-fab[hidden], .lc-panel[hidden] { display: none !important; }

/* Botón flotante. En móvil va por encima del mini reproductor de audio (centrado abajo). */
.lc-fab {
  position: fixed; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  color: #fff; background: var(--lc-rojo); cursor: pointer;
  box-shadow: 0 8px 24px rgba(31, 58, 95, .32);
  transition: transform .15s ease, box-shadow .15s ease;
}
.lc-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(31, 58, 95, .38); }
.lc-fab-ico { font: 700 24px/1 Georgia, "Times New Roman", serif; }
.lc-fab-txt { display: none; font: 600 15px/1 var(--lc-font); }
.lc-fab:focus-visible, .lc-panel :focus-visible { outline: 3px solid var(--lc-navy); outline-offset: 2px; }

/* Panel: hoja inferior en móvil */
.lc-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  display: flex; flex-direction: column;
  height: min(86dvh, 720px); max-height: 86vh;
  background: var(--lc-paper); color: var(--lc-ink);
  border-radius: 18px 18px 0 0; border: 1px solid var(--lc-rule); border-bottom: 0;
  box-shadow: 0 -12px 40px rgba(20, 32, 47, .25);
  font-size: 15px; line-height: 1.5;
  animation: lc-sube .22s ease both;
}
@keyframes lc-sube { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.lc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 10px 16px; background: var(--lc-navy); color: #fff;
  border-radius: 18px 18px 0 0; border-bottom: 3px solid var(--lc-rojo);
}
.lc-head > div { min-width: 0; }
.lc-tit { margin: 0; font: 700 17px/1.2 var(--lc-font); color: #fff; }
.lc-sub { margin: 2px 0 0; font-size: 12px; opacity: .8; }
.lc-x {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: transparent; color: #fff; font: 400 24px/1 var(--lc-font); cursor: pointer;
}
.lc-x:hover { background: rgba(255, 255, 255, .12); }
.lc-head .lc-x:focus-visible { outline-color: #fff; }
.lc-aviso {
  margin: 0; padding: 7px 16px; font-size: 12px; line-height: 1.35; color: var(--lc-muted);
  background: var(--lc-soft); border-bottom: 1px solid var(--lc-rule);
}

.lc-log { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.lc-msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; overflow-wrap: anywhere; }
.lc-bot { align-self: flex-start; background: var(--lc-soft); border: 1px solid var(--lc-rule); border-bottom-left-radius: 4px; }
.lc-user { align-self: flex-end; background: var(--lc-navy); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.lc-md p { margin: 0 0 6px; }
.lc-md p:last-child { margin-bottom: 0; }
.lc-md ul, .lc-md ol { margin: 4px 0 6px; padding-left: 20px; }
.lc-md li { margin: 2px 0; }
.lc-md strong { color: var(--lc-navy); }
.lc-md a, .lc-src a, .lc-frag a { color: var(--lc-rojo); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.lc-src { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--lc-rule); font-size: 13px; line-height: 1.4; color: var(--lc-muted); }
.lc-src-tit { display: block; font-weight: 600; color: var(--lc-ink); margin-bottom: 2px; }
.lc-src ul { margin: 0; padding-left: 18px; }
.lc-nota { font-size: 13px; color: var(--lc-muted); }
.lc-frag { margin: 8px 0 0; padding: 8px 10px; background: #fff; border-left: 3px solid var(--lc-rojo); border-radius: 6px; font-size: 13.5px; }
.lc-frag p { margin: 4px 0; }

.lc-sug { display: flex; flex-wrap: wrap; gap: 8px; }
.lc-chip {
  padding: 8px 12px; min-height: 40px; border-radius: 999px; cursor: pointer; text-align: left;
  font: 500 14px/1.25 var(--lc-font); color: var(--lc-navy); background: #fff; border: 1.5px solid var(--lc-navy);
}
.lc-chip:hover { background: var(--lc-navy); color: #fff; }

.lc-form {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--lc-rule); background: var(--lc-paper);
}
.lc-q {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 12px;
  font: 16px/1.35 var(--lc-font); color: var(--lc-ink); background: #fff;
  border: 1.5px solid var(--lc-rule); border-radius: 12px;
}
.lc-q:focus { border-color: var(--lc-navy); outline: none; box-shadow: 0 0 0 3px rgba(31, 58, 95, .15); }
.lc-send {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; cursor: pointer;
  color: #fff; background: var(--lc-rojo); font-size: 18px;
}
.lc-send:disabled { opacity: .5; cursor: wait; }

.lc-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.lc-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--lc-navy); opacity: .3; animation: lc-pulso 1s infinite ease-in-out; }
.lc-dots span:nth-child(2) { animation-delay: .15s; }
.lc-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes lc-pulso { 50% { opacity: 1; transform: translateY(-2px); } }

html.lc-abierto { overflow: hidden; }

/* Escritorio: tarjeta flotante abajo a la derecha */
@media (min-width: 720px) {
  .lc-fab {
    bottom: 24px; right: 24px; width: auto; height: 52px; padding: 0 20px 0 14px; border-radius: 999px;
  }
  .lc-fab-txt { display: inline; }
  .lc-panel {
    left: auto; right: 24px; bottom: 24px; width: 400px; height: min(640px, calc(100vh - 48px));
    border-radius: 16px; border-bottom: 1px solid var(--lc-rule);
    box-shadow: 0 18px 50px rgba(20, 32, 47, .28);
  }
  .lc-head { border-radius: 16px 16px 0 0; }
  .lc-form { border-radius: 0 0 16px 16px; }
  html.lc-abierto { overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .lc-fab, .lc-panel, .lc-dots span { animation: none !important; transition: none !important; }
  .lc-fab:hover { transform: none; }
}
