/* ── Chat Widget ────────────────────────────────────────────── */
#chat-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  border: none;
  background: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  overflow: visible;
}
#chat-toggle svg {
  width: 100%;
  height: 100%;
  transition: transform 0.2s;
  animation: chat-toggle-breathe 3s ease-in-out infinite;
}
#chat-toggle:hover svg { transform: scale(1.08); }

@keyframes chat-toggle-breathe {
  0%, 100% { filter: drop-shadow(0 4px 14px rgba(26, 75, 140, 0.45)); }
  50%       { filter: drop-shadow(0 6px 22px rgba(26, 75, 140, 0.72)) drop-shadow(0 0 10px rgba(0, 151, 167, 0.32)); }
}

@media (prefers-reduced-motion: reduce) {
  #chat-toggle svg { animation: none; filter: drop-shadow(0 4px 14px rgba(26, 75, 140, 0.45)); }
}

#chat-panel {
  display: none;
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 9999;
  width: 300px;
  height: 450px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  flex-direction: column;
  overflow: hidden;
}
#chat-panel.chat-open { display: flex; }

@media (max-width: 400px) {
  #chat-panel {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    bottom: 5.5rem;
    height: 70vh;
    max-height: 500px;
  }
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #1A4B8C 0%, #0097A7 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
}
#chat-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
#chat-header-logo {
  height: 26px;
  width: auto;
  display: block;
}
#chat-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background-color: #ffffff;
  background-image:
    linear-gradient(rgba(255,255,255,0.87), rgba(255,255,255,0.87)),
    url('../images/logo.png');
  background-size: 100% 100%, 72%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble--user {
  align-self: flex-end;
  background: #1A4B8C;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.chat-bubble--assistant {
  align-self: flex-start;
  background: #EAF4F7;
  color: #222222;
  border-bottom-left-radius: 4px;
  max-width: 95%;
}
.chat-bubble--thinking { opacity: 0.6; font-style: italic; }

.chat-bubble--assistant p {
  margin: 0 0 0.4rem;
}
.chat-bubble--assistant p:last-child {
  margin-bottom: 0;
}
.chat-bubble--assistant ul {
  margin: 0.25rem 0 0.4rem 1rem;
  padding: 0;
  list-style: disc;
}
.chat-bubble--assistant li {
  margin-bottom: 0.2rem;
}
.chat-bubble--assistant strong {
  font-weight: 700;
}

#chat-form {
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid rgba(0, 151, 167, 0.2);
  gap: 0.4rem;
}
#chat-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cccccc;
  border-radius: 20px;
  font-size: 1rem;
  outline: none;
  text-size-adjust: 100%;
}
#chat-input:focus { border-color: var(--color-teal, #0097A7); }
#chat-form button[type="submit"] {
  background: #E55A1C;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}
