/* DRVX free FAQ chat widget */
.drvx-chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9000;
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 50%;
  background: var(--brand, #f97316);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
}

.drvx-chat-fab__icon {
  width: 1.6rem;
  height: 1.6rem;
}

.drvx-chat-fab:hover {
  transform: scale(1.05);
  background: var(--brand-dark, #ea580c);
}

.drvx-chat-fab[aria-expanded="true"] {
  background: #374151;
}

.drvx-chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 9001;
  display: flex;
  flex-direction: column;
  width: min(22rem, calc(100vw - 2rem));
  height: min(32rem, calc(100dvh - 7rem));
  max-height: min(32rem, calc(100dvh - 7rem));
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.drvx-chat-panel[hidden] {
  display: none !important;
}

.drvx-chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #0f0f0f;
  color: #fff;
}

.drvx-chat-panel__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.drvx-chat-panel__badge {
  font-size: 0.6875rem;
  font-weight: 500;
  opacity: 0.85;
}

.drvx-chat-panel__close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.85;
}

.drvx-chat-panel__close:hover {
  opacity: 1;
}

.drvx-chat-tabs {
  display: flex;
  gap: 0;
  background: #1f2937;
  padding: 0 0.5rem;
}

.drvx-chat-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.35rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}

.drvx-chat-tab#drvx-chat-tab-message {
  flex: 1.2;
}

.drvx-chat-tab:hover {
  color: #e5e7eb;
}

.drvx-chat-tab--active {
  color: #fff;
  border-bottom-color: var(--brand, #f97316);
}

.drvx-chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.drvx-chat-view[hidden] {
  display: none !important;
}

.drvx-chat-view--live {
  background: #f9fafb;
}

.drvx-chat-live {
  padding: 1rem 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.drvx-chat-live__intro {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #111827;
}

.drvx-chat-live__hours {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.drvx-chat-live__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drvx-chat-live__divider {
  height: 1px;
  background: #e5e7eb;
  margin: 1rem 0;
}

.drvx-chat-live-form__title {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #111827;
}

.drvx-chat-live-form__field {
  display: block;
  margin-bottom: 0.6rem;
}

.drvx-chat-live-form__field span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.drvx-chat-live-form__field input,
.drvx-chat-live-form__field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.875rem;
  background: #fff;
}

.drvx-chat-live-form__field textarea {
  resize: vertical;
}

.drvx-chat-turnstile {
  display: flex;
  justify-content: center;
  margin: 0.75rem 0 0.25rem;
}

.drvx-chat-turnstile .cf-turnstile {
  transform: scale(0.95);
  transform-origin: center;
}

.drvx-chat-live-form__field input:focus,
.drvx-chat-live-form__field textarea:focus {
  outline: 2px solid var(--brand, #f97316);
  outline-offset: 0;
  border-color: transparent;
}

.drvx-chat-live-form__error {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  color: #b91c1c;
}

.drvx-chat-live-form__submit {
  width: 100%;
  border: none;
  border-radius: 0.5rem;
  background: var(--brand, #f97316);
  color: #fff;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
}

.drvx-chat-live-form__submit:hover:not(:disabled) {
  background: var(--brand-dark, #ea580c);
}

.drvx-chat-live-form__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.drvx-chat-hp {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.drvx-chat-live-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.drvx-chat-live-btn--web {
  background: #0f0f0f;
  color: #fff;
}

.drvx-chat-live-btn--web:hover {
  background: #374151;
}

.drvx-chat-live-btn--whatsapp {
  background: #25d366;
  color: #fff;
}

.drvx-chat-live-btn--viber {
  background: #7360f2;
  color: #fff;
}

.drvx-chat-live-btn--telegram {
  background: #0088cc;
  color: #fff;
}

.drvx-chat-live-btn--whatsapp:hover,
.drvx-chat-live-btn--viber:hover,
.drvx-chat-live-btn--telegram:hover {
  filter: brightness(1.05);
}

.drvx-chat-live__email {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.drvx-chat-live__email a {
  color: var(--brand-dark, #ea580c);
}

.drvx-chat-live__fallback {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0;
}

.drvx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #f9fafb;
}

.drvx-chat-msg {
  max-width: 92%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.drvx-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #111827;
}

.drvx-chat-msg--user {
  align-self: flex-end;
  background: var(--brand, #f97316);
  color: #fff;
}

.drvx-chat-msg--typing {
  opacity: 0.7;
  font-style: italic;
}

.drvx-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.75rem 0.5rem;
  background: #f9fafb;
}

.drvx-chat-suggestion {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.6875rem;
  cursor: pointer;
  color: #374151;
}

.drvx-chat-suggestion:hover {
  border-color: var(--brand, #f97316);
  color: var(--brand-dark, #ea580c);
}

.drvx-chat-suggestion--live {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.drvx-chat-suggestion--live:hover {
  border-color: #22c55e;
  color: #14532d;
}

.drvx-chat-suggestion--message {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.drvx-chat-suggestion--message:hover {
  border-color: var(--brand, #f97316);
  color: #7c2d12;
}

.drvx-chat-form {
  display: flex;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.drvx-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.875rem;
  font-family: inherit;
}

.drvx-chat-input:focus {
  outline: 2px solid var(--brand, #f97316);
  outline-offset: 0;
  border-color: transparent;
}

.drvx-chat-send {
  border: none;
  border-radius: 0.5rem;
  background: var(--brand, #f97316);
  color: #fff;
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.drvx-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.drvx-chat-send:hover:not(:disabled) {
  background: var(--brand-dark, #ea580c);
}

@media (max-width: 480px) {
  .drvx-chat-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    /* Anchor to the visible viewport top/bottom so the window always fits the
       screen (no manual resize needed). Bottom sits above the FAB. */
    top: max(0.5rem, env(safe-area-inset-top));
    bottom: calc(4.5rem + env(safe-area-inset-bottom));
    height: auto;
    max-height: none;
  }

  .drvx-chat-fab {
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
  }
}
