/* ===== Chat: variables y reset corto ===== */
.owt7-grok-chat {
  --chat-bg: #0f172a; /* fondo tarjeta */
  --chat-head-bg: #111827; /* cabecera */
  --chat-head-fg: #e5e7eb;
  --bubble-assistant-bg: #111827; /* burbuja asistente */
  --bubble-user-bg: #2563eb; /* burbuja usuario */
  --bubble-fg: #f3f4f6;
  --muted: #9ca3af;
  --ring: rgba(37, 99, 235, 0.25);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.18);
  --gap: 12px;
}

/* ===== Contenedor ===== */
.owt7-grok-chat {
  width: 100%;
  margin: 24px auto;
  background: linear-gradient(180deg, #0b1220 0%, var(--chat-bg) 100%);
  border: 1px solid #111827;
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  color: #e5e7eb;
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

/* ===== Cabecera ===== */
.owt7-grok-chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--chat-head-bg), #0b0f1a);
  border-bottom: 1px solid #1f2937;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.owt7-grok-chat__head::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111827;
  box-shadow: inset 0 0 0 2px #1f2937, 0 0 0 3px rgba(255, 255, 255, 0.02);
  margin-right: 4px;
  background-image: radial-gradient(
      circle at 35% 35%,
      #60a5fa 8%,
      transparent 10%
    ),
    radial-gradient(circle at 65% 65%, #a78bfa 10%, transparent 12%);
}

/* ===== Cuerpo (scroll) ===== */
.owt7-grok-chat__body {
  height: min(20vh, 200px);
  overflow: auto;
  padding: 18px 14px;
  display: grid;
  gap: var(--gap);
  scroll-behavior: smooth;
}

/* ===== Mensajes ===== */
.owt7-msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: flex-end;
  animation: msgIn 0.18s ease-out both;
}
@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.owt7-msg.owt7-user {
  grid-template-columns: 1fr 36px;
}
.owt7-msg.owt7-user .owt7-bubble {
  justify-self: end;
  background: var(--bubble-user-bg);
}
.owt7-msg.owt7-user .owt7-avatar {
  order: 2;
}

/* Avatar */
.owt7-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0b1020;
  border: 1px solid #1f2937;
  display: grid;
  place-items: center;
  color: #93c5fd;
  font-size: 18px;
}

/* Burbuja */
.owt7-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bubble-assistant-bg);
  color: var(--bubble-fg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.04);
  word-wrap: break-word;
  white-space: pre-wrap;
}
.owt7-bubble p {
  margin: 0 0 6px;
}
.owt7-bubble p:last-child {
  margin-bottom: 0;
}

/* Meta (hora, etc.) opcional */
.owt7-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* “Escribiendo…” */
.owt7-typing .owt7-bubble {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.owt7-dots {
  width: 30px;
  height: 10px;
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
}
.owt7-dots i {
  width: 6px;
  height: 6px;
  background: #9ca3af;
  border-radius: 999px;
  opacity: 0.6;
  animation: blink 1.2s infinite ease-in-out;
}
.owt7-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.owt7-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes blink {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-2px);
    opacity: 1;
  }
}

/* ===== Input bar ===== */
.owt7-grok-chat__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #1f2937;
  background: linear-gradient(0deg, #0b1220, #0a0f1b);
}
#owt7-grok-chat-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: #0b1020;
  color: #e5e7eb;
  outline: none;
  box-shadow: none;
}
#owt7-grok-chat-input:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 4px var(--ring);
}
.owt7-grok-chat__form button {
  padding: 0 14px;
  border: 1px solid #1e3a8a;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  border-radius: 12px;
  font-weight: 600;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.owt7-grok-chat__form button:hover {
  filter: brightness(1.04);
}
.owt7-grok-chat__form button:active {
  transform: translateY(1px);
}
.owt7-grok-chat__form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .owt7-bubble {
    max-width: 92%;
  }
}
