/* AutoRescue — widget de chat "Solicitar Demo". CSS self-contained (sin Tailwind). */
.ar-chat,
.ar-chat * {
  box-sizing: border-box;
}

.ar-chat {
  --ar-bg: #0a1a2f;
  --ar-panel: #0e2138;
  --ar-panel-2: #102640;
  --ar-line: rgba(255, 255, 255, 0.1);
  --ar-text: #ffffff;
  --ar-muted: rgba(255, 255, 255, 0.65);
  --ar-cyan: #1ee0ff;
  --ar-blue: #00a8e8;
  --ar-grad: linear-gradient(135deg, #1ee0ff, #00a8e8);
  position: fixed;
  z-index: 9999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Launcher flotante ---------- */
.ar-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #0a1a2f;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #1ee0ff, #00a8e8);
  box-shadow: 0 10px 30px rgba(30, 224, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.ar-launcher:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 38px rgba(30, 224, 255, 0.5);
}
.ar-launcher svg {
  width: 20px;
  height: 20px;
}
.ar-launcher[hidden] {
  display: none;
}

/* ---------- Panel ---------- */
.ar-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10000;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ar-bg);
  border: 1px solid var(--ar-line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.ar-panel.ar-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.ar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(180deg, rgba(30, 224, 255, 0.14), rgba(16, 38, 64, 0));
  border-bottom: 1px solid var(--ar-line);
}
.ar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #0a1a2f;
  background: var(--ar-grad);
  flex-shrink: 0;
}
.ar-avatar svg {
  width: 20px;
  height: 20px;
}
.ar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}
.ar-title b {
  color: var(--ar-text);
  font-size: 15px;
}
.ar-title span {
  color: var(--ar-muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00ff88;
  box-shadow: 0 0 8px #00ff88;
}
.ar-close {
  background: transparent;
  border: 0;
  color: var(--ar-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
}
.ar-close:hover {
  color: var(--ar-text);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Mensajes ---------- */
.ar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.ar-msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ar-pop 0.18s ease;
}
@keyframes ar-pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.ar-msg.ar-bot {
  align-self: flex-start;
  background: var(--ar-panel-2);
  color: var(--ar-text);
  border: 1px solid var(--ar-line);
  border-bottom-left-radius: 5px;
}
.ar-msg.ar-user {
  align-self: flex-end;
  background: var(--ar-grad);
  color: #06121f;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}
.ar-msg.ar-success {
  align-self: stretch;
  max-width: 100%;
  text-align: center;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.4);
  color: #aef9d3;
}
.ar-msg.ar-error {
  align-self: stretch;
  max-width: 100%;
  background: rgba(255, 68, 68, 0.12);
  border: 1px solid rgba(255, 68, 68, 0.4);
  color: #ffc9c9;
}

/* indicador de "escribiendo" */
.ar-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.ar-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ar-cyan);
  opacity: 0.5;
  animation: ar-blink 1.2s infinite ease-in-out;
}
.ar-typing i:nth-child(2) {
  animation-delay: 0.2s;
}
.ar-typing i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ar-blink {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---------- Composer ---------- */
.ar-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  border-top: 1px solid var(--ar-line);
  background: rgba(255, 255, 255, 0.02);
}
.ar-input {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--ar-line);
  background: var(--ar-panel);
  color: var(--ar-text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.ar-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.ar-input:focus {
  border-color: rgba(30, 224, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(30, 224, 255, 0.15);
}
.ar-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #06121f;
  background: var(--ar-grad);
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.ar-send:hover:not(:disabled) {
  transform: scale(1.05);
}
.ar-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ar-send svg {
  width: 20px;
  height: 20px;
}
.ar-foot {
  padding: 0 12px 10px;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

/* ---------- Formulario de contacto ---------- */
.ar-contact {
  height: auto;
  max-height: calc(100vh - 44px);
}
.ar-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px 20px;
  overflow-y: auto;
}
.ar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ar-field span {
  font-size: 13px;
  color: var(--ar-muted);
}
.ar-field input,
.ar-field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--ar-line);
  background: var(--ar-panel);
  color: var(--ar-text);
  font: inherit;
  font-size: 14px;
  outline: none;
  resize: vertical;
}
.ar-field input::placeholder,
.ar-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}
.ar-field input:focus,
.ar-field textarea:focus {
  border-color: rgba(30, 224, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(30, 224, 255, 0.15);
}
.ar-form-send {
  margin-top: 2px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #06121f;
  background: var(--ar-grad);
  transition: transform 0.1s ease, opacity 0.2s ease;
}
.ar-form-send:hover:not(:disabled) {
  transform: translateY(-1px);
}
.ar-form-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ar-form-status {
  font-size: 13px;
  line-height: 1.4;
  min-height: 1em;
  color: var(--ar-muted);
}
.ar-form-status.ok {
  color: #aef9d3;
}
.ar-form-status.err {
  color: #ffc9c9;
}

@media (max-width: 480px) {
  .ar-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .ar-launcher {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-panel,
  .ar-launcher,
  .ar-msg,
  .ar-typing i {
    transition: none;
    animation: none;
  }
}
