/* ============================================================
   Awesome Walls – Website Chatbot Widget
   ============================================================
   ⚠️  BRAND COLOURS ARE PLACEHOLDERS.
   The values below are a reasonable guess for a climbing brand,
   not Awesome Walls' real palette. Before this goes live, pull
   the actual hex values from the Divi/Elementor Theme
   Customizer > Global Colors (or sample the primary logo at
   /wp-content/uploads/2023/04/01.-Awesome-Walls-Primary-Logo-png.png)
   and swap them into --aw-primary / --aw-primary-dark / --aw-accent.
   Everything else keys off those three variables.
   ============================================================ */

:root {
  --aw-primary:        #1d2b3a;   /* placeholder — confirm against brand */
  --aw-primary-dark:   #131e29;   /* placeholder */
  --aw-accent:         #f26522;   /* placeholder — CTA / booking orange */
  --aw-accent-dark:    #d4541a;   /* placeholder */

  --aw-info-bg:        #fff4e8;
  --aw-info-border:    #f6d4b4;
  --aw-info-text:      #7a3d0d;

  --aw-bot-bg:         #f1f4f8;
  --aw-user-bg:        #1d2b3a;
  --aw-user-text:      #ffffff;

  --aw-radius:         16px;
  --aw-shadow:         0 8px 32px rgba(0,0,0,.18);
  --aw-font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --aw-widget-z:       9999;
  --aw-panel-w:        380px;
  --aw-panel-h:        580px;
}

/* ── Widget wrapper ───────────────────────────────────────── */
#aw-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--aw-widget-z);
  font-family: var(--aw-font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Toggle button ───────────────────────────────────────── */
#aw-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--aw-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(29,43,58,.45);
  transition: background .2s, transform .2s;
  position: relative;
  z-index: 1;
}
#aw-chat-toggle:hover { background: var(--aw-primary-dark); transform: scale(1.07); }
#aw-chat-toggle:focus-visible { outline: 3px solid var(--aw-accent); outline-offset: 3px; }
#aw-chat-toggle svg { width: 26px; height: 26px; }

#aw-chat-toggle .aw-icon-close { display: none; }
#aw-chat-widget.aw-open #aw-chat-toggle .aw-icon-open  { display: none; }
#aw-chat-widget.aw-open #aw-chat-toggle .aw-icon-close { display: flex; }

/* ── Panel ───────────────────────────────────────────────── */
#aw-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: var(--aw-panel-w);
  height: var(--aw-panel-h);
  max-height: calc(100dvh - 120px);
  background: #fff;
  border-radius: var(--aw-radius);
  box-shadow: var(--aw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aw-slide-up .25s ease;
}
#aw-chat-panel[hidden] { display: none; }

@keyframes aw-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* ── Header ──────────────────────────────────────────────── */
#aw-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--aw-primary);
  color: #fff;
  flex-shrink: 0;
}
.aw-chat-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.aw-chat-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.22);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.aw-chat-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.aw-chat-subtitle {
  font-size: 11px; opacity: .85; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#aw-chat-close {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
}
#aw-chat-close:hover { background: rgba(255,255,255,.15); }
#aw-chat-close:focus-visible { outline: 2px solid var(--aw-accent); }

/* ── Booking disclaimer bar ──────────────────────────────── */
/* Deliberately warm/amber rather than grey: this is the single
   most important thing for the visitor to register, and a grey
   bar reads as boilerplate and gets skipped. */
#aw-chat-disclaimer {
  background: var(--aw-info-bg);
  color: var(--aw-info-text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--aw-info-border);
  flex-shrink: 0;
}
#aw-chat-disclaimer svg { flex-shrink: 0; }

/* ── Messages ────────────────────────────────────────────── */
#aw-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#aw-chat-messages::-webkit-scrollbar { width: 5px; }
#aw-chat-messages::-webkit-scrollbar-track { background: transparent; }
#aw-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }

.aw-msg { display: flex; max-width: 88%; }
.aw-msg--bot  { align-self: flex-start; }
.aw-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.aw-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.aw-msg--bot  .aw-bubble { background: var(--aw-bot-bg); color: #1f2937; border-bottom-left-radius: 4px; }
.aw-msg--user .aw-bubble { background: var(--aw-user-bg); color: var(--aw-user-text); border-bottom-right-radius: 4px; }

/* Links inside bot replies (booking pages, news pages) */
.aw-msg--bot .aw-bubble a { color: var(--aw-accent-dark); font-weight: 600; }
.aw-msg--bot .aw-bubble a:hover { text-decoration: none; }

/* Typing indicator */
.aw-msg--typing .aw-bubble {
  display: flex; align-items: center; gap: 5px; padding: 12px 16px;
}
.aw-msg--typing .aw-bubble span {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: aw-bounce 1.2s infinite;
}
.aw-msg--typing .aw-bubble span:nth-child(2) { animation-delay: .2s; }
.aw-msg--typing .aw-bubble span:nth-child(3) { animation-delay: .4s; }

@keyframes aw-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  #aw-chat-panel { animation: none; }
  .aw-msg--typing .aw-bubble span { animation: none; opacity: .6; }
  #aw-chat-toggle:hover { transform: none; }
}

/* ── Chip rows (centre picker + suggested questions) ─────── */
.aw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
  margin-top: -2px;
}
.aw-chip {
  background: #fff;
  border: 1.5px solid #d7dee8;
  color: var(--aw-primary);
  font-family: var(--aw-font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1.3;
}
.aw-chip:hover  { background: var(--aw-primary); border-color: var(--aw-primary); color: #fff; }
.aw-chip:focus-visible { outline: 2px solid var(--aw-accent); outline-offset: 2px; }
.aw-chips--gone { display: none; }

.aw-chips-label {
  font-size: 11.5px;
  color: #6b7280;
  align-self: flex-start;
  padding: 0 2px;
  margin-bottom: -4px;
}

/* ── Booking CTA (appears once a centre is known) ────────── */
#aw-chat-book-cta {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 12px 8px;
  padding: 11px 14px;
  background: var(--aw-accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  transition: background .18s;
  flex-shrink: 0;
}
#aw-chat-book-cta:hover  { background: var(--aw-accent-dark); color: #fff; }
#aw-chat-book-cta:focus-visible { outline: 3px solid var(--aw-primary); outline-offset: 2px; }
#aw-chat-widget.aw-has-centre #aw-chat-book-cta { display: flex; }
#aw-chat-book-cta svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Input area ──────────────────────────────────────────── */
#aw-chat-input-area {
  border-top: 1px solid #e5e7eb;
  padding: 10px 12px 8px;
  flex-shrink: 0;
  background: #fff;
}
#aw-chat-typing-hint {
  font-size: 11.5px;
  color: #9ca3af;
  margin-bottom: 6px;
  padding: 0 2px;
}
#aw-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #f3f4f6;
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  border: 1.5px solid transparent;
  transition: border-color .2s, background .2s;
}
#aw-chat-form:focus-within { border-color: var(--aw-primary); background: #fff; }

#aw-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-family: var(--aw-font);
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  min-height: 22px;
  max-height: 120px;
  outline: none;
  overflow-y: auto;
}
#aw-chat-input::placeholder { color: #9ca3af; }
#aw-chat-input:disabled { opacity: .5; cursor: not-allowed; }

#aw-chat-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--aw-primary);
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .2s, opacity .2s;
}
#aw-chat-send svg { width: 18px; height: 18px; }
#aw-chat-send:hover:not(:disabled) { background: var(--aw-primary-dark); }
#aw-chat-send:disabled { opacity: .4; cursor: not-allowed; }
#aw-chat-send:focus-visible { outline: 2px solid var(--aw-accent); outline-offset: 2px; }

#aw-chat-footer-note {
  font-size: 10.5px;
  color: #9ca3af;
  text-align: center;
  margin-top: 6px;
}
#aw-chat-footer-note a { color: #9ca3af; }

/* Disabled / config-error state */
#aw-chat-widget.aw-disabled #aw-chat-toggle { opacity: .5; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  #aw-chat-widget { bottom: 16px; right: 16px; left: 16px; }
  #aw-chat-panel {
    width: auto;
    left: 0; right: 0;
    bottom: 72px;
    height: calc(100dvh - 110px);
    max-height: none;
    border-radius: 16px;
  }
  .aw-chip { font-size: 13.5px; padding: 8px 14px; }
}