/* 7 Waves Media Co. — Chatbot Widget Styles
   Matches site design system: off-white bg, gold accent, Jost font.
   If your real CSS variables differ from the ones below (check css/style.css),
   swap the hex values here to match — search for "EDIT COLORS" below. */

:root {
  /* --- EDIT COLORS: replace with your actual site variables if they differ --- */
  --glc-bg: #f6f5f0;
  --glc-bg-panel: #efeee7;
  --glc-gold: #d19102;
  --glc-text: #141414;
  --glc-text-dim: #5c5a54;
  --glc-border: rgba(209, 145, 2, 0.3);
}

#glc-chatbot * {
  box-sizing: border-box;
  font-family: 'Jost', sans-serif;
}

/* Floating toggle button */
#glc-chatbot-toggle {
  position: fixed;
  bottom: 40px;
  right: 24px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--glc-gold);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 9998;
  transition: transform 0.2s ease;
  /* Always-on gentle glow so the button reads as "alive" and gets noticed,
     independent of the one-time teaser pulse below. */
  animation: glc-toggle-glow 2.6s ease-in-out infinite;
}

#glc-chatbot-toggle:hover {
  transform: scale(1.06);
}

#glc-chatbot-toggle svg {
  width: 34px;
  height: 34px;
  fill: #0d0d0d;
}

@keyframes glc-toggle-glow {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(209, 145, 2, 0.55);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 12px rgba(209, 145, 2, 0);
  }
}

/* Once someone's hovered (or tapped) the button, js/chatbot-widget.js adds
   this class to stop the idle glow for good -- they know it's there now. */
#glc-chatbot-toggle.glc-glow-off {
  animation: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Pulsing ring around the button to catch the eye while the teaser bubble is up */
#glc-chatbot-toggle.glc-pulse::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--glc-gold);
  opacity: 0.6;
  animation: glc-pulse-ring 1.8s ease-out infinite;
}

@keyframes glc-pulse-ring {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Teaser speech bubble that pops up next to the button */
#glc-chatbot-teaser {
  position: fixed;
  bottom: 112px;
  right: 24px;
  max-width: 240px;
  background: var(--glc-bg-panel);
  border: 1px solid var(--glc-border);
  border-radius: 14px;
  padding: 13px 30px 13px 15px;
  color: var(--glc-text);
  font-size: 14.5px;
  line-height: 1.5;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: 9997;
  opacity: 0;
  transform: translateY(10px) scale(0.85);
  transform-origin: bottom right;
  pointer-events: none;
}

/* A little overshoot ("pop") instead of a plain fade — scales past 100%
   then settles back, so it visibly catches the eye when it appears. */
@keyframes glc-teaser-pop {
  0% { opacity: 0; transform: translateY(10px) scale(0.85); }
  55% { opacity: 1; transform: translateY(-3px) scale(1.05); }
  80% { transform: translateY(0) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

#glc-chatbot-teaser.glc-show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: glc-teaser-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#glc-chatbot-teaser::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 30px;
  width: 14px;
  height: 14px;
  background: var(--glc-bg-panel);
  border-right: 1px solid var(--glc-border);
  border-bottom: 1px solid var(--glc-border);
  transform: rotate(45deg);
}

#glc-chatbot-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--glc-text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

#glc-chatbot-teaser-close:hover {
  color: var(--glc-gold);
}

/* Chat panel */
#glc-chatbot-panel {
  position: fixed;
  bottom: 112px;
  right: 24px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 460px;
  max-height: calc(100vh - 140px);
  background: var(--glc-bg-panel);
  border: 1px solid var(--glc-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#glc-chatbot-panel.glc-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#glc-chatbot-header {
  background: var(--glc-bg);
  padding: 14px 16px;
  border-bottom: 1px solid var(--glc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

#glc-chatbot-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#glc-chatbot-header h3 {
  margin: 0;
  color: var(--glc-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#glc-chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#glc-chatbot-clear {
  background: none;
  border: 1px solid var(--glc-border);
  border-radius: 7px;
  color: var(--glc-text-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 6px 10px;
  white-space: nowrap;
}

#glc-chatbot-clear:hover {
  color: var(--glc-gold);
  border-color: var(--glc-gold);
}

#glc-chatbot-close {
  background: none;
  border: none;
  color: var(--glc-text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

#glc-chatbot-close:hover {
  color: var(--glc-gold);
}

#glc-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glc-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.5;
}

.glc-msg-bot {
  align-self: flex-start;
  background: #e5e3da;
  color: var(--glc-text);
  border-bottom-left-radius: 3px;
}

.glc-msg-user {
  align-self: flex-end;
  background: var(--glc-gold);
  color: #0d0d0d;
  border-bottom-right-radius: 3px;
}

.glc-msg-bot a {
  color: var(--glc-gold);
}

#glc-chatbot-typing {
  align-self: flex-start;
  color: var(--glc-text-dim);
  font-size: 12px;
  font-style: italic;
  padding: 0 4px;
}

/* Persistent trigger for the call scheduler, sitting between the message
   list and the text input so it's always reachable without cluttering the
   header actions. */
#glc-chatbot-schedule-btn {
  flex-shrink: 0;
  margin: 0 14px 10px;
  background: var(--glc-text);
  border: 1px solid var(--glc-text);
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  padding: 9px 12px;
  text-align: center;
}

#glc-chatbot-schedule-btn:hover {
  background: #000000;
  border-color: #000000;
}

/* Scheduler widget (day picker -> time slots -> name/email -> confirm),
   shared by the chat panel and the standalone embed on contact.html
   (see js/call-scheduler.js). */
.glc-call-scheduler {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Inside the chat panel it's wrapped in a .glc-msg bubble, which already
   supplies width/padding/background -- only widen it a bit there. */
.glc-msg.glc-call-scheduler {
  max-width: 92%;
  width: 92%;
}

/* Standalone on a page (contact.html), there's no .glc-msg bubble around
   it, so it needs its own card chrome. */
.glc-call-scheduler:not(.glc-msg) {
  max-width: 420px;
  background: var(--glc-bg-panel);
  border: 1px solid var(--glc-border);
  border-radius: 14px;
  padding: 22px;
  gap: 10px;
}

.glc-scheduler-label {
  margin: 0;
  font-size: 12.5px;
  color: var(--glc-text-dim);
}

.glc-scheduler-day-select {
  width: 100%;
  background: var(--glc-bg);
  border: 1px solid var(--glc-border);
  border-radius: 8px;
  color: var(--glc-text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.glc-scheduler-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.glc-scheduler-loading {
  margin: 2px 0;
  font-size: 13px;
  color: var(--glc-text-dim);
  font-style: italic;
}

.glc-scheduler-tz-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--glc-text-dim);
  opacity: 0.8;
}

.glc-scheduler-slot {
  background: var(--glc-bg);
  border: 1px solid var(--glc-border);
  border-radius: 7px;
  color: var(--glc-text);
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
  font-family: inherit;
}

.glc-scheduler-slot:hover {
  border-color: var(--glc-gold);
}

.glc-scheduler-slot-selected {
  background: var(--glc-gold);
  border-color: var(--glc-gold);
  color: #0d0d0d;
  font-weight: 600;
}

.glc-scheduler-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.glc-scheduler-form input,
.glc-scheduler-form textarea {
  background: var(--glc-bg);
  border: 1px solid var(--glc-border);
  border-radius: 8px;
  color: var(--glc-text);
  padding: 8px 10px;
  font-size: 16px; /* iOS zoom-on-focus fix, same reasoning as the main chat input */
  font-family: inherit;
  outline: none;
  resize: vertical;
}

.glc-scheduler-form input:focus,
.glc-scheduler-form textarea:focus {
  border-color: var(--glc-gold);
}

.glc-scheduler-form button[type="submit"] {
  background: var(--glc-gold);
  color: #0d0d0d;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
}

.glc-scheduler-form button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: default;
}

.glc-scheduler-status {
  font-size: 12.5px;
  color: var(--glc-text-dim);
  min-height: 1em;
}

.glc-scheduler-status-error {
  color: #ff6b6b;
}

.glc-scheduler-confirm {
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--glc-border);
  border-radius: 12px;
  background: rgba(209, 145, 2, 0.06);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  color: var(--glc-text-dim);
}

.glc-scheduler-confirm a {
  color: var(--glc-gold);
  text-decoration: underline;
  font-weight: 600;
}

.glc-scheduler-add-to-cal {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--glc-text-dim);
}

.glc-scheduler-add-to-cal a {
  color: var(--glc-gold);
  text-decoration: none;
  font-weight: 600;
}

#glc-chatbot-form {
  display: flex;
  border-top: 1px solid var(--glc-border);
  padding: 10px;
  gap: 8px;
}

#glc-chatbot-input {
  flex: 1;
  background: var(--glc-bg);
  border: 1px solid var(--glc-border);
  border-radius: 8px;
  color: var(--glc-text);
  padding: 9px 11px;
  /* 16px, not smaller — iOS Safari auto-zooms the whole page on focus for
     any input under 16px. This is the fix, not a design choice. */
  font-size: 16px;
  outline: none;
}

#glc-chatbot-input:focus {
  border-color: var(--glc-gold);
}

#glc-chatbot-send {
  background: var(--glc-text);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

#glc-chatbot-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Mobile: the chat panel takes over the full screen instead of floating as
   a small card — same idea as a native app's chat view. The toggle button
   and teaser bubble sit behind it (lower z-index) so they're covered once
   it's open, no extra hiding logic needed.
   Note: top/bottom/height below are the closed-keyboard defaults. Once the
   panel is open, chatbot-widget.js watches window.visualViewport and sets
   inline height/top on #glc-chatbot-panel so the input + send button stay
   above the on-screen keyboard instead of being covered by it (per CSS
   rules, an explicit inline top+height overrides this bottom:0). */
@media (max-width: 640px) {
  #glc-chatbot-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    transform: translateY(8px);
  }

  #glc-chatbot-panel.glc-open {
    transform: translateY(0);
  }

  #glc-chatbot-header {
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
  }

  #glc-chatbot-header h3 {
    font-size: 16px;
  }

  #glc-chatbot-messages {
    padding: 16px;
  }

  #glc-chatbot-form {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  #glc-chatbot-toggle {
    right: 16px;
  }

  #glc-chatbot-teaser {
    right: 16px;
    max-width: calc(100vw - 90px);
  }
}
