/* ── OpenWebUI Chat v3 ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── Variables globales en :root para que funcionen en modal/burbuja ── */
:root {
  --owui-accent:       #1a3a6b;
  --owui-accent-dark:  #122a50;
  --owui-accent-light: #e8eef8;
  --owui-user-bg:      #1a3a6b;
  --owui-user-tx:      #ffffff;
  --owui-bot-bg:       #eef2fa;
  --owui-bot-tx:       #1a2a4a;
  --owui-bg:           #f4f7ff;
  --owui-surface:      #ffffff;
  --owui-border:       #dde4f0;
  --owui-text:         #1a2a4a;
  --owui-muted:        #7a8aaa;
  --owui-font:         'IBM Plex Mono', 'Share Tech Mono', 'Courier New', monospace;
}

/* ── Wrapper ─────────────────────────────────────────────────────── */
.owui-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--owui-bg);
  font-family: var(--owui-font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--owui-text);
}

/* ── Header ──────────────────────────────────────────────────────── */
.owui-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 20px;
  background: var(--owui-accent);
  color: #fff;
  flex-shrink: 0;
}
.owui-header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.owui-header-info { flex: 1; }
.owui-header-name {
  font-size: 14px; font-weight: 600;
  font-family: var(--owui-font);
  letter-spacing: .04em;
}
.owui-header-status {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; opacity: .82; margin-top: 2px;
  font-family: var(--owui-font);
}
.owui-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #86efac; flex-shrink: 0;
}
.owui-header-clear {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  border-radius: 8px; padding: 4px 10px; font-size: 11px;
  cursor: pointer; font-family: var(--owui-font);
  transition: background .15s; letter-spacing: .03em;
}
.owui-header-clear:hover { background: rgba(255,255,255,.3); }

/* ── Mensajes ────────────────────────────────────────────────────── */
.owui-messages {
  flex: 1; overflow-y: auto;
  padding: 18px 20px 10px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
  background: var(--owui-bg);
}
.owui-messages::-webkit-scrollbar { width: 4px; }
.owui-messages::-webkit-scrollbar-track { background: transparent; }
.owui-messages::-webkit-scrollbar-thumb { background: var(--owui-border); border-radius: 10px; }

.owui-msg { display: flex; flex-direction: column; max-width: 80%; animation: owui-in .2s ease; }
@keyframes owui-in { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
.owui-msg.user  { align-self: flex-end;   align-items: flex-end; }
.owui-msg.bot   { align-self: flex-start; align-items: flex-start; }

.owui-name {
  font-size: 10px; font-weight: 500;
  color: var(--owui-muted);
  margin-bottom: 3px; padding: 0 4px;
  letter-spacing: .08em; text-transform: uppercase;
  font-family: var(--owui-font);
}
.owui-bubble {
  padding: 10px 14px; border-radius: 14px;
  word-break: break-word; white-space: pre-wrap;
  font-size: 13.5px; line-height: 1.7;
  font-family: var(--owui-font);
}
.owui-msg.user .owui-bubble {
  background: var(--owui-user-bg) !important;
  color: #ffffff !important;
  border-bottom-right-radius: 4px;
}
.owui-msg.bot .owui-bubble {
  background: var(--owui-bot-bg) !important;
  color: #1a2a4a !important;
  border-bottom-left-radius: 4px;
}
.owui-time {
  font-size: 10px; color: var(--owui-muted);
  margin-top: 3px; padding: 0 4px; opacity: .65;
  font-family: var(--owui-font);
}

/* ── Typing ──────────────────────────────────────────────────────── */
.owui-typing { display: flex; gap: 4px; padding: 12px 14px; }
.owui-typing span {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--owui-muted);
  animation: owui-bounce 1.1s infinite;
}
.owui-typing span:nth-child(2) { animation-delay: .17s; }
.owui-typing span:nth-child(3) { animation-delay: .34s; }
@keyframes owui-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-6px);opacity:1} }

.owui-dateline {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; color: var(--owui-muted);
  margin: 2px 0 4px; letter-spacing: .05em;
  font-family: var(--owui-font);
}
.owui-dateline::before, .owui-dateline::after { content:''; flex:1; height:1px; background:var(--owui-border); }

/* ── Footer / input ──────────────────────────────────────────────── */
.owui-footer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--owui-border);
  background: var(--owui-surface) !important;
  flex-shrink: 0;
}

/* INPUT — colores siempre fijos, nunca heredan el acento */
.owui-input {
  flex: 1;
  border: 1.5px solid var(--owui-border);
  border-radius: 11px;
  padding: 9px 13px;
  font-size: 13px;
  font-family: var(--owui-font) !important;
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  color: #1a2a4a !important;
  background: #ffffff !important;
  -webkit-text-fill-color: #1a2a4a !important;
  transition: border-color .18s, box-shadow .18s;
}
.owui-input:focus {
  border-color: var(--owui-accent);
  box-shadow: 0 0 0 3px var(--owui-accent-light);
  color: #1a2a4a !important;
  background: #ffffff !important;
  -webkit-text-fill-color: #1a2a4a !important;
}
.owui-input::placeholder {
  color: #7a8aaa !important;
  opacity: 1 !important;
  -webkit-text-fill-color: #7a8aaa !important;
}

.owui-send {
  width: 38px; height: 38px; border: none; border-radius: 10px;
  background: var(--owui-accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s, transform .1s, opacity .15s;
}
.owui-send:hover:not(:disabled)  { background: var(--owui-accent-dark); transform: scale(1.04); }
.owui-send:active:not(:disabled) { transform: scale(.96); }
.owui-send:disabled { opacity: .4; cursor: default; }
.owui-send svg { width: 16px; height: 16px; }

.owui-error {
  font-size: 12px; color: #c0392b; background: #fdf0ef;
  border: 1px solid #f5c6c2; border-radius: 9px;
  padding: 6px 12px; text-align: center;
  font-family: var(--owui-font);
}

/* ══════════════════════════════════════════════════════════════════
   BURBUJA FLOTANTE — [owui_bubble]
   ══════════════════════════════════════════════════════════════════ */
#owui-bubble-btn {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--owui-accent);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(26,58,107,.35);
  z-index: 9998;
  transition: transform .2s, box-shadow .2s;
  font-size: 24px; line-height: 1;
}
#owui-bubble-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(26,58,107,.45); }

#owui-bubble-panel {
  position: fixed;
  bottom: 96px; right: 28px;
  width: 360px;
  max-width: calc(100vw - 40px);
  border-radius: 18px;
  box-shadow: 0 8px 48px rgba(26,58,107,.18);
  border: 1px solid var(--owui-border);
  z-index: 9999;
  overflow: hidden;
  transform: scale(.92) translateY(12px);
  opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), opacity .18s ease;
}
#owui-bubble-panel.open { transform: scale(1) translateY(0); opacity: 1; pointer-events: all; }

/* ══════════════════════════════════════════════════════════════════
   MODAL CENTRADO — [owui_chat]
   ══════════════════════════════════════════════════════════════════ */
#owui-modal-trigger {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 24px;
  background: var(--owui-accent);
  color: #fff; border: none; border-radius: 12px;
  font-family: var(--owui-font) !important;
  font-size: 14px; font-weight: 600; letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(26,58,107,.28);
  transition: background .15s, transform .12s;
  margin: 8px 0;
}
#owui-modal-trigger:hover { background: var(--owui-accent-dark); transform: translateY(-1px); }
#owui-modal-trigger svg { width: 17px; height: 17px; flex-shrink: 0; }

#owui-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,50,.5);
  backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
#owui-modal-overlay.open { opacity: 1; pointer-events: all; }

#owui-modal-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(.96);
  width: min(680px, 94vw);
  height: min(620px, 88vh);
  z-index: 99999;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(10,20,50,.32);
  opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.4,.64,1), opacity .2s ease;
  display: flex; flex-direction: column;
}
#owui-modal-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: all;
}
#owui-modal-panel .owui-wrap { height: 100% !important; }

.owui-modal-close {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
.owui-modal-close:hover { background: rgba(255,255,255,.35); }

/* Contenedor shortcode invisible */
#owui-chat, #owui-bubble-root { display: block; width: 0; height: 0; overflow: hidden; }

@media (max-width: 480px) {
  #owui-modal-panel { width:100vw; height:100dvh; top:0; left:0; transform:translateY(20px); border-radius:0; }
  #owui-modal-panel.open { transform:translateY(0); }
  #owui-bubble-panel { right:12px; bottom:84px; width:calc(100vw - 24px); }
  #owui-bubble-btn   { bottom:16px; right:16px; width:52px; height:52px; font-size:21px; }
}

/* ── Auto-grow: el wrap y los mensajes crecen con el contenido ─── */
.owui-auto-grow {
  height: auto !important;
  min-height: 0 !important;
}
.owui-auto-grow .owui-messages {
  height: auto;
  min-height: 80px;
  overflow: hidden;
  transition: height .25s ease;
}

/* owui-inline: contenedor visible en flujo normal de pagina */
#owui-inline {
  display: block;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 28px rgba(26,58,107,.12);
  border: 1px solid var(--owui-border);
}
#owui-inline .owui-wrap { border-radius: 0; border: none; box-shadow: none; }
