/* Vadalo AI Sales Assistant — chat widget styles
   Uses the site's own CSS variables (defined in assets/css/global.css'
   :root) so it inherits the real brand palette/fonts automatically.
   Loads deferred, alongside chat-widget.js — never render-blocking. */

#vv-chat-launcher {
  position: fixed;
  bottom: 24px;
  left: 20px; /* moved to the left side — the right side is already used by the
                 WhatsApp float, back-to-top button, and (on the homepage) the
                 hero slider's own navigation arrows */
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-forest, #1a3a2a), var(--clr-forest-mid, #224d38));
  box-shadow: var(--shadow-lg, 0 16px 48px rgba(26,58,42,.2));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9989;
  border: none;
  transition: transform .2s var(--ease-out, ease);
  color: var(--clr-cream, #f8f4ec);
}
#vv-chat-launcher:hover { transform: scale(1.08); }
#vv-chat-launcher svg { width: 26px; height: 26px; }
#vv-chat-launcher .vv-badge {
  position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--clr-gold, #c9a84c);
  border: 2px solid #fff;
}
@media (max-width: 600px) {
  /* The site's own mobile bottom bar (#mob-lang-bar: WhatsApp/Get Quote/EN)
     is fixed at bottom:0, full-width, 56px tall (+ safe-area inset for
     notched phones), with the maximum possible z-index — it sits above
     everything by design. The widget must clear it vertically, not just
     visually stack under a lower z-index. */
  #vv-chat-launcher {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 14px);
    left: 14px; width: 50px; height: 50px;
  }
  #vv-chat-launcher svg { width: 22px; height: 22px; }
}

#vv-chat-panel {
  position: fixed;
  bottom: 96px;
  left: 20px;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--clr-warm-white, #fffef9);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-xl, 0 32px 80px rgba(26,58,42,.2));
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9995;
  font-family: var(--font-body, 'Plus Jakarta Sans', Inter, sans-serif);
  border: 1px solid var(--clr-border-light, #ede8d8);
}
#vv-chat-panel.vv-open { display: flex; animation: vv-panel-in .25s var(--ease-out, ease) both; }
@keyframes vv-panel-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

#vv-chat-header {
  background:
    linear-gradient(135deg, rgba(15,35,24,.5), rgba(34,77,56,.4)),
    url('/assets/images/chat-header-fabric.jpg') center / cover no-repeat;
  color: var(--clr-cream, #f8f4ec);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,.7), 0 1px 2px rgba(0,0,0,.8);
}
#vv-chat-header-title { display: flex; align-items: center; gap: 10px; }
#vv-chat-header-title .vv-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #00e676;
  box-shadow: 0 0 0 0 rgba(0,230,118,.6); animation: vv-dot-pulse 1.8s ease infinite;
}
@keyframes vv-dot-pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
#vv-chat-header-title .vv-name { font-family: var(--font-ui, inherit); font-weight: 600; font-size: .92rem; }
#vv-chat-header-title .vv-status { font-size: .68rem; opacity: .75; display: block; }
#vv-chat-close {
  background: transparent; border: none; color: inherit; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; opacity: .85;
}
#vv-chat-close:hover { background: rgba(255,255,255,.12); opacity: 1; }

#vv-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--clr-ivory, #fdf9f2);
}
.vv-msg { max-width: 84%; font-size: .875rem; line-height: 1.55; }
.vv-msg-bubble { padding: 10px 14px; border-radius: var(--radius-md, 8px); word-wrap: break-word; white-space: pre-wrap; }
.vv-msg--user { align-self: flex-end; }
.vv-msg--user .vv-msg-bubble { background: var(--clr-forest, #1a3a2a); color: var(--clr-cream, #f8f4ec); border-bottom-right-radius: 2px; }
.vv-msg--bot { align-self: flex-start; }
.vv-msg--bot .vv-msg-bubble { background: #fff; color: var(--clr-text, #2a2a2a); border: 1px solid var(--clr-border-light, #ede8d8); border-bottom-left-radius: 2px; }
.vv-msg-bubble a { color: var(--clr-forest, #1a3a2a); text-decoration: underline; font-weight: 600; word-break: break-all; }
.vv-msg--user .vv-msg-bubble a { color: var(--clr-cream, #f8f4ec); }
.vv-msg--system .vv-msg-bubble { background: rgba(201,168,76,.12); color: var(--clr-gold-dark, #a07830); font-size: .8rem; }

.vv-typing { align-self: flex-start; display: flex; gap: 4px; padding: 10px 14px; background: #fff; border: 1px solid var(--clr-border-light, #ede8d8); border-radius: var(--radius-md, 8px); border-bottom-left-radius: 2px; }
.vv-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--clr-sage, #5a8a6a); animation: vv-typing-bounce 1.2s infinite; }
.vv-typing span:nth-child(2) { animation-delay: .15s; }
.vv-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes vv-typing-bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.vv-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: var(--clr-ivory, #fdf9f2); flex-shrink: 0; }
.vv-chip {
  font-family: var(--font-ui, inherit); font-size: .72rem; font-weight: 600;
  background: #fff; border: 1px solid var(--clr-border, #d4c9a8); color: var(--clr-forest, #1a3a2a);
  padding: 6px 12px; border-radius: 100px; cursor: pointer; transition: .15s;
}
.vv-chip:hover { background: var(--clr-forest, #1a3a2a); color: var(--clr-cream, #f8f4ec); border-color: var(--clr-forest, #1a3a2a); }

.vv-products { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.vv-product-card { border: 1px solid var(--clr-border-light, #ede8d8); border-radius: var(--radius-sm, 4px); padding: 8px 10px; background: #fff; font-size: .8rem; }
.vv-product-card b { color: var(--clr-forest, #1a3a2a); }
.vv-product-card .vv-moq { color: var(--clr-text-muted, #666); font-size: .72rem; }

.vv-contact-card {
  align-self: stretch;
  background: #fff;
  border: 1px solid var(--clr-gold, #c9a84c);
  border-radius: var(--radius-md, 8px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vv-contact-card__title { font-size: .82rem; font-weight: 700; color: var(--clr-forest, #1a3a2a); margin-bottom: 2px; }
.vv-contact-card__row { display: flex; gap: 8px; }
.vv-contact-card__row input {
  flex: 1; min-width: 0; font-family: inherit; font-size: .8rem;
  padding: 8px 10px; border: 1px solid var(--clr-border, #d4c9a8); border-radius: var(--radius-sm, 4px);
  background: var(--clr-ivory, #fdf9f2); color: var(--clr-text, #2a2a2a);
}
.vv-contact-card__row input:focus { outline: 2px solid var(--clr-gold, #c9a84c); outline-offset: 1px; }
.vv-contact-card__error { font-size: .72rem; color: #c0392b; min-height: 1em; }
.vv-contact-card__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.vv-contact-card__skip {
  background: transparent; border: none; color: var(--clr-text-muted, #666);
  font-size: .78rem; cursor: pointer; padding: 8px 6px;
}
.vv-contact-card__submit {
  background: var(--clr-forest, #1a3a2a); color: #fff; border: none;
  font-family: var(--font-ui, inherit); font-weight: 600; font-size: .78rem;
  padding: 8px 16px; border-radius: 100px; cursor: pointer;
}
.vv-contact-card__submit:hover { background: var(--clr-forest-mid, #224d38); }
@media (max-width: 380px) {
  .vv-contact-card__row { flex-direction: column; }
}

.vv-summary-card {
  align-self: stretch;
  background: linear-gradient(135deg, rgba(201,168,76,.10), rgba(26,58,42,.06));
  border: 1px solid var(--clr-gold, #c9a84c);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vv-summary-card__title { font-size: .82rem; font-weight: 700; color: var(--clr-forest, #1a3a2a); margin-bottom: 4px; }
.vv-summary-card__row { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; padding: 2px 0; }
.vv-summary-card__label { color: var(--clr-text-muted, #666); }
.vv-summary-card__value { font-weight: 600; color: var(--clr-text, #2a2a2a); text-align: right; }

#vv-chat-inputbar {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 10px 12px; border-top: 1px solid var(--clr-border-light, #ede8d8);
  background: #fff; flex-shrink: 0;
}
#vv-attach-btn {
  background: transparent; border: none; color: var(--clr-forest, #1a3a2a);
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; opacity: .75; transition: .15s;
}
#vv-attach-btn:hover { opacity: 1; background: var(--clr-ivory, #fdf9f2); }
#vv-attach-preview { padding: 0 16px; background: #fff; flex-shrink: 0; }
#vv-attach-preview:empty { display: none; }
.vv-attach-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px;
  background: var(--clr-ivory, #fdf9f2); border: 1px solid var(--clr-border, #d4c9a8);
  border-radius: 100px; padding: 5px 6px 5px 12px; font-size: .78rem; color: var(--clr-text, #2a2a2a);
}
.vv-attach-chip button {
  background: rgba(0,0,0,.08); border: none; color: inherit; width: 18px; height: 18px;
  border-radius: 50%; font-size: .6rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.vv-attach-sent {
  margin-top: 6px; font-size: .74rem; opacity: .85;
  background: rgba(255,255,255,.15); border-radius: 100px; padding: 3px 10px; display: inline-block;
}
#vv-chat-input {
  flex: 1; resize: none; max-height: 80px; min-height: 20px;
  font-family: inherit; font-size: .875rem; padding: 8px 10px;
  border: 1px solid var(--clr-border, #d4c9a8); border-radius: var(--radius-sm, 4px);
  background: var(--clr-ivory, #fdf9f2); color: var(--clr-text, #2a2a2a);
}
#vv-chat-input:focus { outline: 2px solid var(--clr-gold, #c9a84c); outline-offset: 1px; }
#vv-chat-send {
  background: var(--clr-forest, #1a3a2a); color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: .15s;
}
#vv-chat-send:hover:not(:disabled) { background: var(--clr-forest-mid, #224d38); }
#vv-chat-send:disabled { opacity: .5; cursor: not-allowed; }

.vv-footer-note { font-size: .65rem; color: var(--clr-text-muted, #666); text-align: center; padding: 4px 0 8px; background: #fff; }
.vv-footer-note a { color: var(--clr-forest, #1a3a2a); text-decoration: underline; }

.vv-handoff-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  background: #25d366; color: #fff; font-size: .78rem; font-weight: 600;
  padding: 7px 12px; border-radius: 100px; text-decoration: none;
}

@media (max-width: 600px) {
  #vv-chat-panel {
    left: 12px;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 66px);
    width: calc(100vw - 24px);
    height: calc(100vh - 56px - env(safe-area-inset-bottom, 0px) - 140px);
  }
}
