/* ==========================================================================
   Outreach Leap — Floating Chat Widget
   Pure CSS, no dependencies. Scoped under #ol-chat-widget-root.
   ========================================================================== */

#ol-chat-widget-root {
  --ol-navy: #075e54;
  --ol-gold: #d4af37;
  --ol-gold-light: #f4d03f;
  --ol-gold-gradient: linear-gradient(135deg, #d4af37, #f4d03f);
  --ol-green: #25d366;
  --ol-blue: #4a6cf7;
  --ol-border: #e5e7eb;
  --ol-text: #111827;
  --ol-muted: #6b7280;
  --ol-red: #ef4444;

  position: fixed;
  inset: auto 24px 24px auto;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ol-text);
  line-height: 1.4;
}

#ol-chat-widget-root * {
  box-sizing: border-box;
}

#ol-chat-widget-root button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------------- FAB ---------------- */

.ol-fab {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ol-green);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.ol-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 31, 61, 0.45);
}

.ol-fab:active {
  transform: translateY(0);
}

.ol-fab-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition: opacity 150ms ease, transform 150ms ease;
}

.ol-fab-icon svg {
  width: 26px;
  height: 26px;
}

.ol-fab-icon.ol-icon-close {
  opacity: 0;
  transform: scale(0.6) rotate(-45deg);
  pointer-events: none;
}

#ol-chat-widget-root.ol-is-open .ol-fab-icon.ol-icon-chat {
  opacity: 0;
  transform: scale(0.6) rotate(45deg);
  pointer-events: none;
}

#ol-chat-widget-root.ol-is-open .ol-fab-icon.ol-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
  pointer-events: auto;
}

.ol-notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ol-red);
  border: 2px solid #fff;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
}

.ol-notif-dot.ol-visible {
  opacity: 1;
  transform: scale(1);
}

/* ---------------- Greeting bubble ---------------- */

.ol-greeting {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 240px;
  background: #fff;
  border: 1px solid var(--ol-border);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 32px 12px 14px;
  font-size: 13px;
  color: var(--ol-text);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.ol-greeting.ol-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ol-greeting-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--ol-muted);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.ol-greeting-close:hover {
  background: #f3f4f6;
}

/* ---------------- Popup ---------------- */

.ol-popup {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--ol-border);
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.18);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

#ol-chat-widget-root.ol-is-open .ol-popup {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------------- Header ---------------- */

.ol-popup-header {
  background: var(--ol-navy);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.ol-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 4px;
}

.ol-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ol-header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ol-header-title {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.ol-header-tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.ol-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  transition: background 150ms ease;
}

.ol-popup-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------------- Body / screens ---------------- */

.ol-popup-body {
  position: relative;
  min-height: 260px;
}

.ol-screen {
  position: absolute;
  inset: 0;
  padding: 16px;
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  overflow-y: auto;
}

.ol-screen.ol-active {
  position: relative;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.ol-screen.ol-leaving-back {
  transform: translateX(-12px);
}

/* ---- Screen 1: options ---- */

.ol-greeting-text {
  font-size: 14px;
  color: var(--ol-text);
  margin: 0 0 14px;
}

.ol-option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--ol-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  text-align: left;
  transition: background 150ms ease;
}

.ol-option-btn:last-child {
  margin-bottom: 0;
}

.ol-option-btn:hover {
  background: #f9fafb;
}

.ol-option-btn.ol-option-whatsapp {
  border-left: 3px solid var(--ol-green);
}

.ol-option-btn.ol-option-email {
  border-left: 3px solid var(--ol-blue);
}

.ol-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ol-option-whatsapp .ol-option-icon {
  background: rgba(37, 211, 102, 0.12);
  color: var(--ol-green);
}

.ol-option-email .ol-option-icon {
  background: rgba(74, 108, 247, 0.12);
  color: var(--ol-blue);
}

.ol-option-icon svg {
  width: 18px;
  height: 18px;
}

.ol-option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ol-option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ol-text);
}

.ol-option-subtitle {
  font-size: 12px;
  color: var(--ol-muted);
}

/* ---- Screen 2: form ---- */

.ol-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--ol-muted);
  font-size: 12px;
  padding: 0;
  margin-bottom: 12px;
}

.ol-back-btn:hover {
  color: var(--ol-text);
}

.ol-back-btn svg {
  width: 14px;
  height: 14px;
}

.ol-form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ol-form-row .ol-field {
  flex: 1;
  min-width: 0;
}

.ol-field {
  margin-bottom: 10px;
}

.ol-field:last-of-type {
  margin-bottom: 0;
}

.ol-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ol-muted);
  margin-bottom: 4px;
}

.ol-input,
.ol-select,
.ol-textarea {
  width: 100%;
  border: 1px solid var(--ol-border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--ol-text);
  background: #fff;
  transition: border-color 150ms ease;
  font-family: inherit;
}

.ol-input:focus,
.ol-select:focus,
.ol-textarea:focus {
  outline: none;
  border-color: var(--ol-blue);
}

.ol-textarea {
  resize: vertical;
}

.ol-input.ol-invalid,
.ol-select.ol-invalid,
.ol-textarea.ol-invalid {
  border-color: var(--ol-red);
}

.ol-error-text {
  display: none;
  font-size: 11px;
  color: var(--ol-red);
  margin-top: 4px;
}

.ol-error-text.ol-visible {
  display: block;
}

.ol-submit-btn {
  width: 100%;
  background: var(--ol-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3);
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.ol-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.4);
}

.ol-submit-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.ol-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  display: none;
  animation: ol-spin 700ms linear infinite;
}

.ol-submit-btn.ol-loading .ol-spinner {
  display: inline-block;
}

.ol-submit-btn.ol-loading .ol-submit-label {
  display: none;
}

@keyframes ol-spin {
  to {
    transform: rotate(360deg);
  }
}

.ol-form-error {
  display: none;
  font-size: 12px;
  color: var(--ol-red);
  margin-top: 10px;
  text-align: center;
}

.ol-form-error.ol-visible {
  display: block;
}

/* ---- Screen 3: success ---- */

.ol-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding-top: 24px;
}

.ol-success-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ol-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.ol-success-icon svg {
  width: 16px;
  height: 16px;
}

.ol-success-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ol-text);
  margin: 0 0 6px;
}

.ol-success-subtext {
  font-size: 13px;
  color: var(--ol-muted);
  margin: 0 0 18px;
}

.ol-success-link {
  font-size: 13px;
  color: var(--ol-blue);
  background: none;
  border: none;
  text-decoration: underline;
  padding: 0;
}

.ol-success-link:hover {
  color: var(--ol-navy);
}

/* ---------------- Mobile ---------------- */

@media (max-width: 480px) {
  .ol-popup,
  .ol-greeting {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    right: 16px;
    bottom: 80px;
  }
}
