/* Chatbot Trigger Button */
.chatbot-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #002e60;
  color: white;
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chatbot-trigger:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc3545;
  border: 2px solid white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  line-height: 1;
}

.tooltip {
  position: absolute;
  bottom: 65px;
  right: 0;
  background: #1e3a8a;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chatbot-trigger:hover .tooltip {
  display: block;
}

.chatbot-loading {
  position: fixed;
  bottom: 85px;
  right: 20px;
  background: #002e60;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  z-index: 1000;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hidden {
  display: none !important;
}

/* Modal */
.chatbot-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: flex-end;
  align-items: flex-end;
  z-index: 1001;
  padding: 20px;
}

.chatbot-modal:not(.hidden) {
  display: flex;
}

.chatbot-container {
  /* width: 390px; */
  width: min(100%, 390px);
  max-width: 100%;
  /* max-height: 80vh; */
  max-height: min(90vh, 600px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.chatbot-modal:not(.hidden) .chatbot-container {
  transform: translateY(0);
  opacity: 1;
}

/* Header */
.chatbot-header {
  background: #002e60;
  padding: 14px 16px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.chatbot-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.2px;
}

#chatbot-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

#chatbot-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

.books-section {
  padding: 10px 0;
}

.books-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.book-item {
  width: 150px;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.book-thumb img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.book-info h4 {
  margin-top: 6px;
  font-size: 14px;
}

/* Action Buttons */
.action-buttons-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0px 0;
  padding: 0 0px;
  margin-top: 7px;
}

.chat-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  min-height: 65px;
  word-break: keep-all;
}

.chat-action-btn:hover {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.chat-action-btn i,
.chat-action-btn svg {
  width: 18px;
  height: 18px;
  color: #475569;
}

.chat-action-btn:hover i,
.chat-action-btn:hover svg {
  color: #1d4ed8;
}

button.chat-action-btn.back_reset {
    flex-direction: row;
    min-height: inherit;
    padding: 10px;
    border-radius: 6px;
}
/* Messages */
.messages-container {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f8fafc;
  min-height: 120px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.message {
  display: flex;
  margin-bottom: 16px;
  max-width: 100%;
  flex-direction: column;
}

.bot-message {
  align-items: flex-start;
}

.user-message {
  align-items: end;
  justify-content: flex-end;
  flex-direction: column;
  text-align: right;
}

.message-content {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;

}

.welcome-message {
  margin-bottom: 15px;
}

.message-content p {
  white-space: pre-line;
}

.bot-message .message-content {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
.suggestions-header {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
    padding: 2px 8px;
  position: sticky;
  top: 0;
  background: #f9f9f9;
}
.user-message .message-content {
  background: #002e60;
  color: white;
  border-bottom-right-radius: 4px;
  text-align: left;
}

.message-content ul {
  margin: 8px 0 4px;
  padding-left: 0;
}
a.view-all-link {
    margin-top: 5px;
    display: inline-block;
}
.floating-reset {
  position: absolute;
  bottom: 80px; /* above input field */
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  justify-content: center;
}
.floating-reset.hidden {
  display: none;
}
.floating-reset .chat-action-btn {
  background: #00a0e3;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.message-content ul li {
  display: flex;
  border-bottom: solid 1px #ddd;
  padding-bottom: 6px;
  margin-bottom: 6px;
    line-height: 1.3;
    flex-wrap: wrap;
}
.message-content ul li span.source {
    margin-left: 4px;
    font-size: 12px;
    color: gray;
    display: inline-block;
}
ul.books_listing li {
    flex-wrap: nowrap;
}
.message-content a {
  color: #002e60;
  text-decoration: underline;
  font-weight: 500;
}

.message-content a:hover {
  color: #001f40;
}

.message-timestamp {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  opacity: 0.8;
}

.bot-message .message-timestamp {
  align-self: flex-start;
  margin-left: 16px;
}

.user-message .message-timestamp {
  align-self: flex-end;
  margin-right: 16px;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  padding: 0 16px 12px;
}

.typing-indicator:not(.hidden) {
  display: block;
}

.typing-dots {
  display: flex;
  gap: 4px;
  justify-content: flex-start;
}

.dot {
  width: 6px;
  height: 6px;
  background: #002e60;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  60%,
  100% {
    opacity: 0.2;
  }

  30% {
    opacity: 1;
  }
}

/* Suggestions Dropdown */

.suggestions-container {
 background: white;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 8px 8px;
  /* box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); */
  box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 0;
  font-size: 13px;
  z-index: 50;
      position: absolute;
    bottom: 45px;
}
.suggestions-header {
 font-size: 11px;
  color: #64748b;
  padding: 4px 12px;
  font-weight: 600;
}
.suggestions-container.hidden {
  display: none;
}
.suggestion-btn {
 display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  transition: background-color 0.2s;
}
.suggestion-btn:hover {
  background-color: #f0f9ff;
}
.suggestion-btn:last-child {
  border-bottom: none;
}
#reset-chat-btn {
  opacity: 0.8;    background: none;
    outline: none;
    border: 0;
    cursor: pointer;
}
#reset-chat-btn:hover {
  opacity: 1;
  color: #002e60;
}
.suggestions-container {
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.suggestion-btn i,
.suggestion-btn svg {
  width: 16px;
  height: 16px;
  color: #64748b;
}

/* Input Area */
.input-container {
  padding: 12px;
   flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
  background: white;
  border-radius: 0 0 16px 16px;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  background: #f8fafc;
}

.message-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.send-button {
  background: #002e60;
  color: white;
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s;
}

.send-button:hover:not(:disabled) {
  background: #001f40;
}

.send-button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

.input-footer {
  text-align: center;
  margin-top: 10px;
}

.input-footer p {
  margin: 0;
  font-size: 11px;
  color: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
  .chatbot-modal {
    padding: 15px;
  }

  .chatbot-container {
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 14px;
  }

  .action-buttons-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .chatbot-trigger {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .notification-badge {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .action-buttons-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }

  .messages-container {
    min-height: 220px;
    max-height: 280px;
    padding: 12px;
  }

  .message-content {
    max-width: 90%;
    font-size: 13px;
    padding: 10px 14px; 
  }

  #suggestions-container {
           width: calc(100% - 0px);
        margin: 0;
  }
  




}

@media (max-height: 500px) {
  .chatbot-header h3 {
    font-size: 14px;
  }
  .quick-actions {
    padding: 4px 8px;
    gap: 4px;
  }
  .quick-action-btn {
    padding: 6px 4px;
    font-size: 11px;
    min-height: 50px;
  }
  .messages-container {
    max-height: calc(100vh - 200px); /* even tighter */
  }
  .input-footer {
    font-size: 10px;
  }
  #reset-chat-btn {
    font-size: 11px;
  }
}

/* Hide quick actions (as per your original) */
.quick-actions {
  display: none !important;
}