/* ============================================================
   INNOVA BLACK® — CHATBOT VALERIA v2.0
   Widget de captura de leads conversacional
   ============================================================ */

/* --- Bubble trigger (closed state) --- */
.vbot-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #C8A44E;
  border: none;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.vbot-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(0,0,0,.45);
}
.vbot-bubble-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}
.vbot-bubble-initials {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #060606;
  letter-spacing: .5px;
}

/* --- Notification badge --- */
.vbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E53935;
  color: #fff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.vbot-badge.show { display: flex; }

/* --- Proactive preview bubble --- */
.vbot-preview {
  position: fixed;
  bottom: 96px;
  right: 28px;
  max-width: 280px;
  background: #161616;
  color: #F0ECE6;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 14px 18px;
  border-radius: 16px 16px 4px 16px;
  border: 1px solid rgba(240,236,230,.06);
  box-shadow: 0 4px 24px rgba(0,0,0,.45);
  z-index: 9998;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
  cursor: pointer;
}
.vbot-preview.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.vbot-preview-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: rgba(240,236,230,.4);
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

/* --- Chat window --- */
.vbot-window {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 56px);
  background: #0C0C0C;
  border-radius: 20px;
  border: 1px solid rgba(240,236,230,.06);
  box-shadow: 0 12px 48px rgba(0,0,0,.6);
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(.96);
  transition: opacity .3s ease-out, transform .3s ease-out;
}
.vbot-window.open {
  display: flex;
}
.vbot-window.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Header --- */
.vbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(240,236,230,.06);
  flex-shrink: 0;
  background: #0C0C0C;
}
.vbot-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #C8A44E;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vbot-header-avatar-text {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #060606;
}
.vbot-header-info {
  flex: 1;
  min-width: 0;
}
.vbot-header-name {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #F0ECE6;
  margin: 0;
}
.vbot-header-sub {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  color: rgba(240,236,230,.45);
  margin: 2px 0 0;
}
.vbot-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.vbot-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  animation: vbot-pulse 2s ease-in-out infinite;
}
@keyframes vbot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.vbot-status-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(240,236,230,.25);
}
.vbot-close {
  background: none;
  border: none;
  color: rgba(240,236,230,.4);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.vbot-close:hover {
  color: #F0ECE6;
  background: rgba(240,236,230,.06);
}

/* --- Messages area --- */
.vbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240,236,230,.08) transparent;
  -webkit-overflow-scrolling: touch;
}
.vbot-messages::-webkit-scrollbar { width: 4px; }
.vbot-messages::-webkit-scrollbar-track { background: transparent; }
.vbot-messages::-webkit-scrollbar-thumb { background: rgba(240,236,230,.08); border-radius: 4px; }

/* --- Message bubbles --- */
.vbot-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  animation: vbot-fadein .3s ease-out;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
@keyframes vbot-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.vbot-msg.bot {
  background: #161616;
  color: #F0ECE6;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.vbot-msg.user {
  background: #C8A44E;
  color: #060606;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* --- Typing indicator --- */
.vbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #161616;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  animation: vbot-fadein .2s ease-out;
}
.vbot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(240,236,230,.4);
  animation: vbot-bounce .6s ease-in-out infinite;
}
.vbot-typing-dot:nth-child(2) { animation-delay: .15s; }
.vbot-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes vbot-bounce {
  0%, 100% { transform: translateY(0); opacity: .4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* --- Option buttons --- */
.vbot-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  animation: vbot-fadein .3s ease-out;
}
.vbot-opt {
  background: transparent;
  border: 1px solid rgba(200,164,78,.25);
  color: #DAB95F;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.vbot-opt:hover {
  background: rgba(200,164,78,.08);
  border-color: rgba(200,164,78,.4);
}
.vbot-opt:active {
  background: rgba(200,164,78,.15);
}

/* --- Input area --- */
.vbot-input-area {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(240,236,230,.06);
  flex-shrink: 0;
  background: #0C0C0C;
}
.vbot-input-area.active { display: flex; }
.vbot-input {
  flex: 1;
  background: #161616;
  border: 1px solid rgba(240,236,230,.08);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  color: #F0ECE6;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.vbot-input::placeholder {
  color: rgba(240,236,230,.25);
}
.vbot-input:focus {
  border-color: rgba(200,164,78,.35);
}
.vbot-send {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: #C8A44E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.vbot-send:hover { background: #DAB95F; }
.vbot-send svg {
  width: 16px;
  height: 16px;
  fill: #060606;
}

/* --- CTA button inside chat --- */
.vbot-cta {
  display: inline-block;
  background: #C8A44E;
  color: #060606;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
  margin-top: 4px;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.vbot-cta:hover { background: #DAB95F; }

/* --- Powered by --- */
.vbot-powered {
  text-align: center;
  padding: 6px;
  flex-shrink: 0;
}
.vbot-powered span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: rgba(240,236,230,.12);
  letter-spacing: .5px;
}

/* ============================================================
   MOBILE — Full-screen experience
   ============================================================ */
@media (max-width: 600px) {
  .vbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .vbot-header {
    padding: 14px 16px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }
  .vbot-messages {
    padding: 16px;
  }
  .vbot-input-area {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .vbot-msg {
    max-width: 88%;
    font-size: 15px;
  }
  .vbot-opt {
    font-size: 14px;
    padding: 12px 16px;
  }
  .vbot-bubble {
    bottom: 20px;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
  }
  .vbot-bubble-initials {
    font-size: 16px;
  }
  .vbot-preview {
    bottom: 84px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    left: 16px;
    max-width: none;
  }
  .vbot-close {
    font-size: 24px;
    padding: 8px 12px;
  }
  .vbot-input {
    font-size: 16px;
    padding: 12px 14px;
  }
  .vbot-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  .vbot-send svg {
    width: 18px;
    height: 18px;
  }
  .vbot-cta {
    font-size: 15px;
    padding: 14px 20px;
  }
}

/* Handle mobile keyboard — when focused input, shrink messages */
@media (max-width: 600px) {
  .vbot-window:has(.vbot-input:focus) .vbot-messages {
    flex: 1;
    min-height: 0;
  }
}
