/* ============================================
   chat-widget.css — JDV Chat Widget
   JDV Labs | jdvlabs.tech
   Built: July 2026
   Shared across ALL pages (JDV Labs + BGE)
   Uses --widget-* namespace — no bleed
   ============================================ */

/* ----------------------------------------
   WIDGET VARIABLES (isolated namespace)
   ---------------------------------------- */
:root {
  --widget-gold:       #C89A2A;
  --widget-gold-30:    rgba(200, 154, 42, 0.30);
  --widget-bg:         #0D1B3E;
  --widget-panel-bg:   #0F1A2E;
  --widget-text:       #F1F5F9;
  --widget-text-sub:   #94A3B8;
  --widget-border:     rgba(255, 255, 255, 0.08);
  --widget-radius:     12px;
  --widget-size:       64px;
}

/* ----------------------------------------
   CHAT TRIGGER BUTTON
   ---------------------------------------- */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.chat-widget__trigger {
  width: var(--widget-size);
  height: var(--widget-size);
  border-radius: 50%;
  background: var(--widget-bg);
  border: 2px solid var(--widget-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(200, 154, 42, 0);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.chat-widget__trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(200, 154, 42, 0.25);
}

.chat-widget__trigger svg {
  width: 28px;
  height: 28px;
  color: var(--widget-gold);
  flex-shrink: 0;
}

/* Hover tooltip */
.chat-widget__trigger::after {
  content: "Chat with us →";
  position: absolute;
  right: calc(var(--widget-size) + 10px);
  bottom: 50%;
  transform: translateY(50%);
  background: var(--widget-bg);
  color: var(--widget-text);
  border: 1px solid var(--widget-gold-30);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chat-widget__trigger:hover::after {
  opacity: 1;
}

/* ----------------------------------------
   CHAT PANEL
   ---------------------------------------- */
.chat-widget__panel {
  position: fixed;
  bottom: calc(var(--widget-size) + 32px);
  right: 24px;
  width: 340px;
  background: var(--widget-panel-bg);
  border: 1px solid var(--widget-gold-30);
  border-radius: var(--widget-radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-widget__panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Panel header */
.chat-widget__header {
  background: var(--widget-bg);
  border-bottom: 1px solid var(--widget-gold-30);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-widget__header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-widget__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(200, 154, 42, 0.12);
  border: 1px solid var(--widget-gold-30);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-widget__avatar svg {
  width: 18px;
  height: 18px;
  color: var(--widget-gold);
}

.chat-widget__title {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--widget-text);
  line-height: 1.2;
}

.chat-widget__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--widget-text-sub);
  display: block;
  margin-top: 1px;
}

.chat-widget__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--widget-text-sub);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.chat-widget__close:hover {
  color: var(--widget-text);
  background: rgba(255, 255, 255, 0.05);
}

.chat-widget__close svg {
  width: 16px;
  height: 16px;
}

/* Panel body */
.chat-widget__body {
  padding: 16px;
}

.chat-widget__intro {
  margin-bottom: 16px;
}

.chat-widget__intro h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--widget-text);
  margin-bottom: 4px;
}

.chat-widget__intro p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--widget-text-sub);
  line-height: 1.55;
}

/* Panel form */
.chat-widget__form .form-row {
  margin-bottom: 10px;
}

.chat-widget__form label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: var(--widget-text-sub);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}

.chat-widget__form input,
.chat-widget__form textarea {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--widget-border);
  border-radius: 6px;
  color: var(--widget-text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
}

.chat-widget__form input::placeholder,
.chat-widget__form textarea::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

.chat-widget__form input:focus,
.chat-widget__form textarea:focus {
  border-color: var(--widget-gold-30);
}

.chat-widget__form textarea {
  resize: none;
  height: 72px;
}

.chat-widget__submit {
  width: 100%;
  padding: 10px 16px;
  background: var(--widget-gold);
  color: #0D1B3E;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  margin-top: 12px;
  min-height: 40px;
}

.chat-widget__submit:hover {
  background: #D4A93A;
  transform: translateY(-1px);
}

.chat-widget__submit:active {
  transform: translateY(0);
}

.chat-widget__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Success state */
.chat-widget__success {
  padding: 20px 16px;
  text-align: center;
  display: none;
}

.chat-widget__success.is-visible {
  display: block;
}

.chat-widget__success-icon {
  width: 40px;
  height: 40px;
  background: rgba(200, 154, 42, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.chat-widget__success-icon svg {
  width: 20px;
  height: 20px;
  color: var(--widget-gold);
}

.chat-widget__success h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--widget-text);
  margin-bottom: 6px;
}

.chat-widget__success p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--widget-text-sub);
  line-height: 1.5;
}

/* ----------------------------------------
   MOBILE ADJUSTMENTS
   ---------------------------------------- */
@media (max-width: 400px) {
  .chat-widget__panel {
    width: calc(100vw - 32px);
    right: 16px;
  }

  .chat-widget {
    right: 16px;
    bottom: 16px;
  }

  .chat-widget__trigger {
    width: 52px;
    height: 52px;
  }

  .chat-widget__trigger::after {
    display: none;
  }
}
