/* Ask Fountain of Dignity — 24/7 website assistant (self-contained, no external services)
   Theme matches styles.css: royal blue --royal #1e40af / --royal-dark #173a8f */

#fod-assistant {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2c3436;
  line-height: 1.5;
}

/* ---------- Floating open button ---------- */
#fod-assist-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #1e40af;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0.8rem 1.3rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(23, 58, 143, 0.4);
}

#fod-assist-btn:hover { background: #173a8f; }
#fod-assist-btn:focus-visible { outline: 3px solid #b98a1e; outline-offset: 2px; }

/* ---------- Panel ---------- */
#fod-assist-panel {
  position: fixed;
  right: 20px;
  bottom: 86px;
  z-index: 99991;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 540px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border: 1px solid #d7dee9;
  border-radius: 14px;
  box-shadow: 0 14px 44px rgba(18, 63, 75, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#fod-assist-panel[hidden] { display: none !important; }

.fod-assist-header {
  background: linear-gradient(135deg, #1e40af, #173a8f);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.fod-assist-header strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 1.2;
}

.fod-assist-sub { display: block; font-size: 0.78rem; color: #c9d6f5; }

#fod-assist-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

#fod-assist-close:hover { background: rgba(255, 255, 255, 0.18); }
#fod-assist-close:focus-visible { outline: 3px solid #b98a1e; outline-offset: 1px; }

/* ---------- Message log ---------- */
#fod-assist-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem;
  background: #f6f8fc;
}

.fod-msg {
  max-width: 86%;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.55rem;
  border-radius: 12px;
  font-size: 0.93rem;
  overflow-wrap: break-word;
}

.fod-msg p { margin: 0 0 0.5rem; }
.fod-msg p:last-child { margin-bottom: 0; }
.fod-msg ul { margin: 0.25rem 0 0.5rem 1.1rem; padding: 0; }
.fod-msg li { margin-bottom: 0.3rem; }
.fod-msg a { color: #1e40af; text-decoration: underline; }

.fod-msg-bot {
  background: #fff;
  border: 1px solid #e0e6f0;
  border-bottom-left-radius: 4px;
  margin-right: auto;
}

.fod-msg-user {
  background: #1e40af;
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

/* ---------- Quick-reply chips ---------- */
.fod-assist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: #fff;
  border-top: 1px solid #e6ebf4;
}

.fod-chip {
  background: #fff;
  border: 1.5px solid #1e40af;
  color: #1e40af;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.fod-chip:hover { background: #1e40af; color: #fff; }
.fod-chip:focus-visible { outline: 3px solid #b98a1e; outline-offset: 1px; }

/* ---------- Input form ---------- */
#fod-assist-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem;
  background: #fff;
  border-top: 1px solid #e6ebf4;
}

#fod-assist-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid #b9c6dd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  color: #2c3436;
}

#fod-assist-input:focus { outline: 2px solid #1e40af; outline-offset: 0; border-color: #1e40af; }

#fod-assist-send {
  background: #1e40af;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

#fod-assist-send:hover { background: #173a8f; }
#fod-assist-send:focus-visible { outline: 3px solid #b98a1e; outline-offset: 1px; }

/* ---------- Disclaimer ---------- */
.fod-assist-disclaimer {
  margin: 0;
  padding: 0.45rem 0.9rem 0.6rem;
  background: #fff;
  font-size: 0.72rem;
  color: #5d6b6e;
  text-align: center;
}

/* ---------- Screen-reader only ---------- */
.fod-assist-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Small screens: panel goes full-width ---------- */
@media (max-width: 520px) {
  #fod-assist-btn { right: 14px; bottom: 14px; }
  #fod-assist-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    height: 82vh;
    max-height: 82vh;
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #fod-assist-btn, #fod-assist-panel { transition: none; }
}
