/* ─── Chat Toggle Button ─── */
.chat-toggle {
  position: fixed;
  bottom: 84px;
  right: 20px;
  z-index: 10000;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #a30000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(163, 0, 0, 0.4);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(163, 0, 0, 0.55);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition:
    transform 0.3s,
    opacity 0.3s;
}

.chat-toggle .icon-close {
  position: absolute;
  transform: rotate(90deg);
  opacity: 0;
}

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

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

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.chat-toggle::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid #a30000;
  animation: pulse-ring 2s ease-out infinite;
}

.chat-toggle.active::before {
  animation: none;
  opacity: 0;
}

/* ─── Chat Panel ─── */
.chat-panel {
  position: fixed;
  bottom: 150px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  height: 550px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition:
    opacity 0.3s,
    transform 0.3s,
    visibility 0.3s;
}

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

/* ─── Header ─── */
.chat-header {
  background: #ffffff;
  padding: 0;
  flex-shrink: 0;
}

.chat-header-bar {
  height: 4px;
  background: #a30000;
  width: 100%;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #a30000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header-avatar svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.chat-header-text h3 {
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-header-text p {
  color: #666;
  font-size: 12px;
  margin-top: 2px;
}

.chat-header-text p .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ─── Messages Area ─── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}

.msg.bot {
  background: #f0f0f0;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  line-height: 1.6;
}

.msg.bot p {
  margin: 4px 0;
}

.msg.bot p:empty {
  display: none;
}

.msg.user {
  background: #a30000;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg.bot strong {
  color: #1a1a1a;
}

.msg.bot code {
  background: #e8e8e8;
  color: #c62828;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

.msg.bot ul {
  margin: 6px 0;
  padding-left: 20px;
}

.msg.bot li {
  margin: 3px 0;
  line-height: 1.5;
}

.msg.bot .typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.msg.bot .typing-dots span {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: dot-bounce 1.4s infinite ease-in-out;
}

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

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

/* ─── Suggested Questions ─── */
.suggestions {
  padding: 0 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.suggestions-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.suggestion-btn {
  width: 100%;
  text-align: left;
  background: #f5f5f5;
  color: #444;
  border: 1px solid #e0e0e0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.suggestion-btn:hover {
  background: #a30000;
  border-color: #a30000;
  color: #fff;
}

/* ─── Input Area ─── */
.chat-input {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 8px;
  border-top: 1px solid #e0e0e0;
  background: #ffffff;
  flex-shrink: 0;
}

.chat-input input {
  flex: 1;
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #333;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input input::placeholder {
  color: #999;
}

.chat-input input:focus {
  border-color: #a30000;
}

.chat-input button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #a30000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-input button:hover {
  background: #c00000;
}

.chat-input button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chat-input button svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .chat-panel {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 150px;
    border-radius: 12px;
  }

  .chat-toggle {
    bottom: 84px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}
