/**
 * BSS UK AI Chat Widget — Styles
 * ================================
 * BSS saffron (#E8720C) and navy (#1A1033) colour scheme.
 * Mobile-friendly, accessible, minimal.
 */

/* ── Floating toggle button ──────────────────────────────────────────────── */
#bss-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #E8720C;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232, 114, 12, 0.45);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#bss-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 114, 12, 0.55);
}

#bss-chat-toggle:focus {
  outline: 3px solid #1A1033;
  outline-offset: 2px;
}

/* ── Chat window ─────────────────────────────────────────────────────────── */
#bss-chat-window {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 9998;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  animation: bss-slide-up 0.2s ease;
}

@keyframes bss-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#bss-chat-header {
  background: #1A1033;
  color: #ffffff;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

#bss-chat-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

#bss-chat-close:hover { opacity: 1; }

/* ── Messages ────────────────────────────────────────────────────────────── */
#bss-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F9F7FF;
}

.bss-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.bss-message p {
  margin: 0;
}

.bss-message a {
  color: #E8720C;
  word-break: break-all;
}

/* Bot messages (left-aligned, light background) */
.bss-message-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #1A1033;
  border: 1px solid #E8E0F0;
  border-bottom-left-radius: 4px;
}

/* User messages (right-aligned, saffron) */
.bss-message-user {
  align-self: flex-end;
  background: #E8720C;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────────────────────── */
.bss-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.bss-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: bss-bounce 1.2s ease infinite;
}

.bss-typing span:nth-child(2) { animation-delay: 0.2s; }
.bss-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bss-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ── Input area ──────────────────────────────────────────────────────────── */
#bss-chat-input-area {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #E8E0F0;
  gap: 8px;
  flex-shrink: 0;
  background: #ffffff;
}

#bss-chat-input {
  flex: 1;
  border: 1px solid #D1D5DB;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #F9F7FF;
  color: #1A1033;
  transition: border-color 0.15s;
}

#bss-chat-input:focus {
  border-color: #E8720C;
}

#bss-chat-input:disabled {
  opacity: 0.6;
}

#bss-chat-send {
  background: #E8720C;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#bss-chat-send:hover { background: #C65A00; }
#bss-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
#bss-chat-footer {
  font-size: 10.5px;
  color: #9CA3AF;
  text-align: center;
  padding: 6px;
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid #F3F0F8;
}

#bss-chat-footer a {
  color: #E8720C;
  text-decoration: none;
}

/* ── Mobile adjustments ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #bss-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    height: 70vh;
  }

  #bss-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
