/* ==========================================================================
   JAVIA WEB CONCIERGE V1 — PUBLIC WIDGET STYLESHEET
   Brand: Obsidian (#090B0D), Copper Ember (#C8794A), Deep Teal (#2FA89A)
   ========================================================================== */

:root {
  --jvc-brand: #C8794A;
  --jvc-brand-hover: #D68B5E;
  --jvc-brand-glow: rgba(200, 121, 74, 0.25);
  --jvc-bg: #0D1115;
  --jvc-surface: #141A20;
  --jvc-surface-2: #1A222A;
  --jvc-border: rgba(255, 255, 255, 0.1);
  --jvc-border-copper: rgba(200, 121, 74, 0.4);
  --jvc-text: #F5F7F8;
  --jvc-text-muted: #8E9BA4;
  --jvc-teal: #2FA89A;
  --jvc-teal-glow: rgba(47, 168, 154, 0.2);
  --jvc-online: #10B981;
}

/* Floating Launcher Button */
.jvc-launcher {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--jvc-bg);
  border: 2px solid var(--jvc-brand);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 20px var(--jvc-brand-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
  padding: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  outline: none;
}

.jvc-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), 0 0 28px rgba(200, 121, 74, 0.45);
}

.jvc-launcher:focus-visible {
  outline: 2px solid var(--jvc-brand-hover);
  outline-offset: 4px;
}

.jvc-launcher-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 58% center;
  display: block;
}

/* Online Indicator Badge */
.jvc-online-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  background-color: var(--jvc-online);
  border: 2.5px solid var(--jvc-bg);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.jvc-online-badge::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--jvc-online);
  animation: jvcPulse 2.4s infinite ease-out;
}

@keyframes jvcPulse {
  0% { transform: scale(1); opacity: 0.9; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Session Teaser Speech Balloon */
.jvc-teaser {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  max-width: 290px;
  background: rgba(20, 26, 32, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--jvc-border-copper);
  border-radius: 14px;
  padding: 12px 14px 12px 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  z-index: 9989;
  font-size: 13px;
  line-height: 1.45;
  color: var(--jvc-text);
  cursor: pointer;
  animation: jvcFadeSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.jvc-teaser:hover {
  border-color: var(--jvc-brand);
}

.jvc-teaser-close {
  background: transparent;
  border: none;
  color: var(--jvc-text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
}

.jvc-teaser-close:hover {
  color: #fff;
}

@keyframes jvcFadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Chat Dialog Container */
.jvc-dialog {
  display: none;
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  right: calc(24px + env(safe-area-inset-right, 0px));
  width: 384px;
  height: 600px;
  max-height: calc(100dvh - 120px);
  background: rgba(13, 17, 21, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--jvc-border);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(200, 121, 74, 0.15);
  z-index: 9995;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--jvc-text);
  animation: jvcFadeSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.jvc-dialog.is-open {
  display: flex;
}

/* Dialog Header */
.jvc-header {
  padding: 14px 16px;
  background: rgba(20, 26, 32, 0.85);
  border-bottom: 1px solid var(--jvc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.jvc-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.jvc-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 58% center;
  border: 1.5px solid var(--jvc-brand);
}

.jvc-header-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.jvc-header-subtitle {
  font-size: 11px;
  color: var(--jvc-teal);
  display: flex;
  align-items: center;
  gap: 4px;
}

.jvc-header-subtitle::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--jvc-online);
}

/* Language Selector Pills */
.jvc-lang-picker {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px;
}

.jvc-lang-btn {
  background: transparent;
  border: none;
  color: var(--jvc-text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.jvc-lang-btn:hover {
  color: #fff;
}

.jvc-lang-btn.is-active {
  background: var(--jvc-brand);
  color: #fff;
}

.jvc-btn-icon {
  background: transparent;
  border: none;
  color: var(--jvc-text-muted);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.jvc-btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Chat Messages Scroll Area */
.jvc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.jvc-message {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: jvcFadeSlide 0.25s ease-out;
}

.jvc-message.jvc-bot {
  align-self: flex-start;
}

.jvc-message.jvc-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.jvc-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.jvc-bot .jvc-bubble {
  background: var(--jvc-surface);
  border: 1px solid var(--jvc-border);
  color: var(--jvc-text);
  border-bottom-left-radius: 4px;
}

.jvc-user .jvc-bubble {
  background: linear-gradient(135deg, var(--jvc-brand) 0%, #A65D32 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Markdown styling inside bubble */
.jvc-bubble h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #fff;
}

.jvc-bubble p {
  margin: 0 0 6px 0;
}

.jvc-bubble p:last-child {
  margin-bottom: 0;
}

.jvc-bubble ul {
  margin: 4px 0 8px 18px;
  padding: 0;
}

.jvc-bubble li {
  margin-bottom: 4px;
}

.jvc-bubble a {
  color: var(--jvc-brand-hover);
  text-decoration: underline;
}

.jvc-bubble strong {
  color: #fff;
}

/* Quick Suggestion Chips */
.jvc-chips {
  padding: 0 16px 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.jvc-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--jvc-border);
  color: var(--jvc-text);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.jvc-chip:hover {
  background: rgba(200, 121, 74, 0.15);
  border-color: var(--jvc-border-copper);
  color: #fff;
}

/* Lead Capture Card embedded in chat */
.jvc-lead-card {
  background: var(--jvc-surface-2);
  border: 1px solid var(--jvc-border-copper);
  border-radius: 12px;
  padding: 14px;
  margin-top: 6px;
  width: 100%;
}

.jvc-lead-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.jvc-form-group {
  margin-bottom: 9px;
}

.jvc-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--jvc-text-muted);
  margin-bottom: 3px;
}

.jvc-input, .jvc-select, .jvc-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--jvc-border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: #fff;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.jvc-input:focus, .jvc-select:focus, .jvc-textarea:focus {
  border-color: var(--jvc-brand);
}

.jvc-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 12px 0;
  font-size: 11px;
  color: var(--jvc-text-muted);
  line-height: 1.35;
}

.jvc-consent-row input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
}

.jvc-consent-row a {
  color: var(--jvc-brand-hover);
  text-decoration: underline;
}

.jvc-btn-submit {
  width: 100%;
  background: var(--jvc-brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.jvc-btn-submit:hover {
  background: var(--jvc-brand-hover);
}

.jvc-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Input Footer Bar */
.jvc-footer {
  padding: 10px 14px 12px 14px;
  background: rgba(20, 26, 32, 0.95);
  border-top: 1px solid var(--jvc-border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.jvc-chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--jvc-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  color: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.jvc-chat-input:focus {
  border-color: var(--jvc-brand);
}

.jvc-send-btn {
  background: var(--jvc-brand);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

.jvc-send-btn:hover {
  background: var(--jvc-brand-hover);
  transform: scale(1.05);
}

.jvc-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Typing Indicator */
.jvc-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.jvc-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--jvc-text-muted);
  animation: jvcBounce 1.4s infinite ease-in-out both;
}

.jvc-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.jvc-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes jvcBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Mobile Responsive Adaptations */
@media (max-width: 640px) {
  .jvc-launcher {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 54px;
    height: 54px;
  }

  .jvc-teaser {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    max-width: calc(100vw - 32px);
  }

  .jvc-dialog {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 90dvh;
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .jvc-header {
    padding: 12px 14px;
  }

  .jvc-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* Viewport specific test sizes (360x640, 390x844, 412x915) */
@media (max-width: 412px) {
  .jvc-bubble {
    font-size: 13px;
  }
  .jvc-header-title {
    font-size: 13.5px;
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  .jvc-launcher,
  .jvc-teaser,
  .jvc-dialog,
  .jvc-message,
  .jvc-online-badge::after {
    animation: none !important;
    transition: none !important;
  }
}
