/* ============================================
   CHAT WIDGET STYLES
   ============================================ */

.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10001;
  font-family: 'Outfit', sans-serif;
}

.chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--alpine-blue) 0%, var(--pine) 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 500;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(0,0,0,0.25);
}

.chat-icon,
.chat-close-icon {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-close-icon {
  opacity: 0;
  transform: rotate(-90deg);
  font-size: 1.8rem;
}

.chat-widget.open .chat-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.chat-widget.open .chat-close-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

.chat-widget.open .chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  background: linear-gradient(135deg, var(--alpine-blue) 0%, var(--pine) 100%);
  color: white;
  padding: 1rem 1.25rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-minimize {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.2s ease;
}

.chat-minimize:hover {
  background: rgba(255,255,255,0.3);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 200px;
  max-height: 300px;
}

.chat-welcome {
  text-align: center;
  padding: 0.5rem 0;
}

.chat-bot-message,
.chat-user-message {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 0.9rem;
}

.chat-bot-message {
  background: var(--ice);
  color: var(--charcoal);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Lists in chat messages */
.chat-bot-message ul,
.chat-bot-message ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.chat-bot-message li {
  margin-bottom: 0.25rem;
}

.chat-bot-message li:last-child {
  margin-bottom: 0;
}

.chat-bot-message strong {
  font-weight: 600;
}

.chat-user-message {
  background: linear-gradient(135deg, var(--alpine-blue) 0%, var(--pine) 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Citations for web search results */
.chat-citations {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
}

.chat-citations-label {
  color: var(--slate);
  font-weight: 500;
}

.chat-citation-link {
  color: var(--alpine-blue);
  text-decoration: none;
  background: rgba(68, 107, 158, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  transition: background 0.2s ease;
}

.chat-citation-link:hover {
  background: rgba(68, 107, 158, 0.2);
  text-decoration: underline;
}

.chat-form {
  display: flex;
  padding: 0.75rem;
  gap: 0.5rem;
  border-top: 1px solid var(--ice);
  background: white;
}

.chat-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--ice);
  border-radius: 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.chat-form input:focus {
  outline: none;
  border-color: var(--alpine-blue);
}

.chat-form input:disabled {
  background: var(--ice);
  cursor: not-allowed;
}

.chat-form button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--alpine-blue) 0%, var(--pine) 100%);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-form button:hover:not(:disabled) {
  transform: scale(1.05);
}

.chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: var(--ice);
  border-radius: 12px;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--alpine-blue);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat widget responsive */
@media (max-width: 600px) {
  .chat-widget {
    bottom: 15px;
    right: 15px;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }

  .chat-panel {
    bottom: 60px;
    width: calc(100vw - 30px);
    max-height: 60vh;
  }

  .chat-messages {
    max-height: 40vh;
  }
}
