/* Orqo Chat Widget — v1.6.0 · orqo.io */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=Figtree:wght@300;400;500;600&family=DM+Mono:wght@300;400&display=swap');

/* ── Token system ── */
:root {
  --orqo-ink-00:   #060908;
  --orqo-ink-01:   #0B100D;
  --orqo-ink-02:   #111812;
  --orqo-ink-03:   #1D2920;
  --orqo-ink-04:   #2E4038;
  --orqo-mid-05:   #7A9488;
  --orqo-lit-07:   #E9EDE9;
  --orqo-lit-08:   #F5F5F2;
  --orqo-acc:      #2CB978;
  --orqo-acc-dark: #1A8A55;
  --orqo-acc-glow: rgba(44,185,120,0.15);

  /* Overrideable by admin settings */
  --orqo-primary:       var(--orqo-acc);
  --orqo-primary-dark:  var(--orqo-acc-dark);
  --orqo-radius:        16px;
  --orqo-shadow:        0 16px 48px rgba(6,9,8,0.55), 0 4px 16px rgba(6,9,8,0.35);
  --orqo-z:             2147483647;
  --orqo-window-opacity:1;
}

/* ── Container ── */
.orqo-chat-container {
  position: fixed !important;
  bottom: 24px;
  right: 24px;
  z-index: var(--orqo-z) !important;
  pointer-events: auto !important;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  isolation: isolate;
}

/* Positions */
.orqo-pos-bottom-right  { bottom: 24px; right: 24px; left: auto; top: auto; }
.orqo-pos-bottom-left   { bottom: 24px; left: 24px;  right: auto; top: auto; }
.orqo-pos-bottom-center { bottom: 24px; left: 50%; transform: translateX(-50%); right: auto; top: auto; }
.orqo-pos-top-right     { top: 24px; right: 24px; bottom: auto; left: auto; }
.orqo-pos-top-left      { top: 24px; left: 24px;  bottom: auto; right: auto; }
.orqo-pos-top-center    { top: 24px; left: 50%; transform: translateX(-50%); bottom: auto; right: auto; }

.orqo-pos-top-right  .orqo-chat-window,
.orqo-pos-top-left   .orqo-chat-window,
.orqo-pos-top-center .orqo-chat-window  { bottom: auto; top: 60px; }
.orqo-pos-bottom-left .orqo-chat-window,
.orqo-pos-top-left    .orqo-chat-window { right: auto; left: 0; }
.orqo-pos-bottom-center .orqo-chat-window,
.orqo-pos-top-center    .orqo-chat-window { left: 50%; right: auto; transform: translateX(-50%); }

/* ── Toggle button — NOTCH isotipo ── */
.orqo-chat-toggle {
  pointer-events: auto !important;
  height: 52px;
  padding: 0 20px 0 14px;
  border-radius: 999px;
  background: var(--orqo-ink-00);
  color: var(--orqo-lit-08);
  border: 1px solid var(--orqo-ink-04);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 24px rgba(6,9,8,0.6), 0 0 0 1px rgba(44,185,120,0.12);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  outline: none;
  white-space: nowrap;
}
.orqo-chat-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--orqo-acc);
  box-shadow: 0 8px 32px rgba(6,9,8,0.65), 0 0 0 1px rgba(44,185,120,0.35), 0 0 20px rgba(44,185,120,0.12);
}
.orqo-chat-toggle:focus-visible {
  outline: 2px solid var(--orqo-acc);
  outline-offset: 3px;
}

/* NOTCH isotipo inside toggle */
.orqo-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}
.orqo-toggle-icon svg { display: block; }
.orqo-icon-small  .orqo-toggle-icon { width: 22px; height: 22px; }
.orqo-icon-medium .orqo-toggle-icon { width: 28px; height: 28px; }
.orqo-icon-large  .orqo-toggle-icon { width: 34px; height: 34px; }

/* Button sizes */
.orqo-btn-compact .orqo-chat-toggle { height: 40px; padding: 0 14px 0 10px; font-size: 12px; }
.orqo-btn-normal  .orqo-chat-toggle { height: 52px; padding: 0 20px 0 14px; font-size: 14px; }
.orqo-btn-large   .orqo-chat-toggle { height: 62px; padding: 0 24px 0 18px; font-size: 15px; }
.orqo-btn-compact .orqo-chat-toggle.is-open { width: 40px; padding: 0; }
.orqo-btn-large   .orqo-chat-toggle.is-open { width: 62px; padding: 0; }

.orqo-toggle-text {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--orqo-lit-08);
}
.orqo-chat-toggle.is-open {
  padding: 0;
  width: 52px;
  justify-content: center;
  border-color: var(--orqo-ink-03);
}
.orqo-chat-toggle.is-open .orqo-toggle-text,
.orqo-chat-toggle.is-open .orqo-toggle-icon { display: none; }

/* Badge */
.orqo-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--orqo-acc);
  color: var(--orqo-ink-00);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--orqo-ink-00);
  animation: orqo-pulse 2s ease-in-out infinite;
}
@keyframes orqo-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(44,185,120,0.4); }
  50%       { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(44,185,120,0); }
}

/* ── Chat window ── */
.orqo-chat-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 368px;
  max-height: 560px;
  display: flex;
  flex-direction: column;
  background: var(--orqo-ink-01);
  border-radius: var(--orqo-radius);
  border: 1px solid var(--orqo-ink-03);
  box-shadow: var(--orqo-shadow);
  overflow: hidden;
  animation: orqo-slide-up 0.28s cubic-bezier(0.34,1.56,0.64,1);
  opacity: var(--orqo-window-opacity);
}
.orqo-chat-container.position-left .orqo-chat-window { right: auto; left: 0; }

@keyframes orqo-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.orqo-chat-header {
  background: var(--orqo-ink-00);
  border-bottom: 1px solid var(--orqo-ink-03);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.orqo-chat-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--orqo-ink-02);
  border: 1px solid var(--orqo-ink-03);
  flex-shrink: 0;
  font-size: 18px;
  overflow: hidden;
}
.orqo-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.orqo-chat-header-info { flex: 1; min-width: 0; }
.orqo-chat-bot-name {
  display: block;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--orqo-lit-08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.orqo-chat-status {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--orqo-mid-05);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.04em;
}
.orqo-status-dot {
  width: 6px;
  height: 6px;
  background: var(--orqo-acc);
  border-radius: 50%;
  display: inline-block;
  animation: orqo-blink 2.5s ease-in-out infinite;
}
@keyframes orqo-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.orqo-chat-minimize {
  background: none;
  border: none;
  color: var(--orqo-mid-05);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.orqo-chat-minimize:hover {
  background: var(--orqo-ink-02);
  color: var(--orqo-lit-08);
}

/* ── Messages area ── */
.orqo-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--orqo-ink-01);
  min-height: 200px;
  max-height: 340px;
}
.orqo-chat-messages::-webkit-scrollbar { width: 3px; }
.orqo-chat-messages::-webkit-scrollbar-track { background: transparent; }
.orqo-chat-messages::-webkit-scrollbar-thumb { background: var(--orqo-ink-04); border-radius: 2px; }

/* ── Bubbles ── */
.orqo-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: orqo-msg-in 0.18s ease;
}
@keyframes orqo-msg-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.orqo-msg.bot {
  background: var(--orqo-ink-02);
  color: var(--orqo-lit-07);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--orqo-ink-03);
}
.orqo-msg.user {
  background: var(--orqo-acc);
  color: var(--orqo-ink-00);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* ── Typing indicator ── */
.orqo-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--orqo-ink-02);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  border: 1px solid var(--orqo-ink-03);
}
.orqo-typing span {
  width: 6px;
  height: 6px;
  background: var(--orqo-mid-05);
  border-radius: 50%;
  animation: orqo-bounce 1.3s ease-in-out infinite;
}
.orqo-typing span:nth-child(2) { animation-delay: 0.18s; }
.orqo-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes orqo-bounce {
  0%, 60%, 100% { transform: translateY(0); background: var(--orqo-mid-05); }
  30%            { transform: translateY(-7px); background: var(--orqo-acc); }
}

/* ── Input area ── */
.orqo-chat-input-area {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--orqo-ink-03);
  background: var(--orqo-ink-00);
  flex-shrink: 0;
  gap: 6px;
}
.orqo-input-row {
  display: flex;
  align-items: center !important;
  gap: 8px;
}
.orqo-chat-input {
  flex: 1;
  border: 1px solid var(--orqo-ink-03);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: 'Figtree', sans-serif;
  resize: none;
  outline: none;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  color: var(--orqo-lit-07);
  background: var(--orqo-ink-01);
  transition: border-color 0.18s;
}
.orqo-chat-input:focus {
  border-color: var(--orqo-acc);
  box-shadow: 0 0 0 2px var(--orqo-acc-glow);
}
.orqo-chat-input::placeholder { color: var(--orqo-mid-05); }

/* Send button */
.orqo-chat-send {
  height: 38px;
  min-width: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--orqo-acc);
  color: var(--orqo-ink-00);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  align-self: center;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  outline: none;
  box-shadow: 0 2px 10px rgba(44,185,120,0.3);
}
.orqo-chat-send:hover:not(:disabled) {
  background: var(--orqo-acc-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(44,185,120,0.4);
}
.orqo-chat-send:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.orqo-chat-send:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.orqo-chat-send:focus-visible { outline: 2px solid var(--orqo-acc); outline-offset: 2px; }

/* ── Footer ── */
.orqo-chat-footer {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--orqo-mid-05);
  padding: 6px 12px 8px;
  border-top: 1px solid var(--orqo-ink-03);
  background: var(--orqo-ink-00);
  flex-shrink: 0;
  opacity: 0.6;
}
.orqo-chat-footer a {
  color: var(--orqo-acc);
  text-decoration: none;
}
.orqo-chat-footer a:hover { opacity: 0.8; }

/* ── Quick replies ── */
.orqo-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 6px;
  align-self: flex-start;
  width: 100%;
  animation: orqo-msg-in 0.18s ease;
}
.orqo-qr-btn {
  background: transparent;
  color: var(--orqo-acc);
  border: 1px solid rgba(44,185,120,0.35);
  border-radius: 18px;
  padding: 5px 13px;
  font-size: 12px;
  font-family: 'Figtree', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.orqo-qr-btn:hover {
  background: var(--orqo-acc-glow);
  border-color: var(--orqo-acc);
}

/* ── Pre-chat form ── */
.orqo-prechat-wrap {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--orqo-ink-01);
}
.orqo-prechat-inner { width: 100%; }
.orqo-prechat-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.025em;
  color: var(--orqo-lit-08);
  margin: 0 0 6px;
}
.orqo-prechat-subtitle {
  font-size: 13px;
  color: var(--orqo-mid-05);
  margin: 0 0 18px;
  line-height: 1.6;
}
.orqo-prechat-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.orqo-pc-input {
  width: 100%;
  border: 1px solid var(--orqo-ink-03);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: 'Figtree', sans-serif;
  outline: none;
  color: var(--orqo-lit-07);
  background: var(--orqo-ink-00);
  transition: border-color 0.18s;
  box-sizing: border-box;
}
.orqo-pc-input:focus {
  border-color: var(--orqo-acc);
  box-shadow: 0 0 0 2px var(--orqo-acc-glow);
}
.orqo-pc-input::placeholder { color: var(--orqo-mid-05); }
.orqo-pc-btn {
  width: 100%;
  padding: 11px 0;
  background: var(--orqo-acc);
  color: var(--orqo-ink-00);
  border: none;
  border-radius: 10px;
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
.orqo-pc-btn:hover:not(:disabled) {
  background: var(--orqo-acc-dark);
  transform: translateY(-1px);
}
.orqo-pc-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.orqo-pc-skip {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--orqo-mid-05);
  text-decoration: none;
  transition: color 0.15s;
}
.orqo-pc-skip:hover { color: var(--orqo-acc); }

/* ── Super-agent button ── */
.orqo-super-btn {
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--orqo-mid-05);
  border: 1px solid var(--orqo-ink-03);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center !important;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  outline: none;
}
.orqo-super-btn:hover {
  background: var(--orqo-acc-glow);
  border-color: var(--orqo-acc);
  color: var(--orqo-acc);
}
.orqo-super-btn.is-active {
  background: var(--orqo-acc-glow);
  border-color: var(--orqo-acc);
  color: var(--orqo-acc);
  box-shadow: 0 0 0 2px rgba(44,185,120,0.15);
}

/* ── Attach button ── */
.orqo-attach-btn {
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--orqo-mid-05);
  border: 1px solid var(--orqo-ink-03);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center !important;
  transition: background 0.18s, border-color 0.18s;
  outline: none;
}
.orqo-attach-btn:hover {
  background: var(--orqo-ink-02);
  border-color: var(--orqo-acc);
  color: var(--orqo-acc);
}

/* ── Image preview ── */
.orqo-image-preview { width: 100%; }
.orqo-img-thumb { position: relative; display: inline-block; }
.orqo-img-thumb img {
  height: 60px;
  width: auto;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--orqo-ink-03);
  object-fit: cover;
  display: block;
}
.orqo-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #c62828;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

/* ── Mobile fullscreen ── */
.orqo-mobile-fullscreen {
  bottom: 0 !important; right: 0 !important;
  left: 0 !important;   top: 0 !important;
  width: 100% !important; height: 100dvh !important;
  height: 100vh !important; transform: none !important;
}
.orqo-mobile-fullscreen .orqo-chat-window {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  right: 0 !important; bottom: 0 !important;
  width: 100% !important;
  max-height: 100dvh !important; max-height: 100vh !important;
  height: 100% !important;
  border-radius: 0 !important;
  animation: none !important;
  display: flex !important;
  flex-direction: column !important;
}
.orqo-mobile-fullscreen .orqo-chat-messages {
  max-height: none !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

/* ── Responsive ── */
@media (max-width: 420px) {
  .orqo-chat-container { bottom: 16px; right: 16px; }
  .orqo-chat-window { width: calc(100vw - 32px); right: -8px; }
  .orqo-chat-container.position-left .orqo-chat-window { left: -8px; }
}
