:root {
  --primary-color: #D3AF34;
  --secondary-color: #0A192F;
  --text-light: #fff;
  --user-bg: #dcf8c6;
  --bot-bg: #f0f0f0;
}

/* Floating Button */
#chat-toggle-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: var(--secondary-color);
  color: var(--text-light);
  font-size: 12px;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: background-color 0.3s ease;
}
.chat-button {
  position: fixed;
  bottom: 25px;
  right: 25px;
  display: flex;
  align-items: center;
  background-color: var(--primary-color, #007BFF);
  color: #fff;
  border-radius: 0px;
  padding: 25px 25px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
}



.chat-icon {
  width: 30px;
  height: 30px;
  margin-right: 0px;
}

.chat-message {
  font-size: 14px;
  line-height: 1.4;
  font-family: Arial, sans-serif;
}

.chat-button-hover {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color, #007BFF);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 1000;
  transition: background 0.3s ease;
}

#chat-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--secondary-color);
  color: white;
  font-size: 24px;
  padding: 14px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 1000;
  transition: background-color 0.3s ease;
}
#chat-toggle-btn:hover .chat-tooltip {
  visibility: visible;
  opacity: 1;
}
#chat-toggle-btn:hover {
  background-color: var(--bot-bg);
}

.chat-button-hover:hover {
  background-color: #0056b3;
}
.chat-tooltip {
  position: absolute;
  right: 70px;
  bottom: 40;
  background-color: #fff;
  color: #333;
  padding: 10px 14px;
  border-radius: 10px;  
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  width: max-content;
  max-width: 250px;
  font-family: Arial, sans-serif;
}

.chat-button-hover:hover .chat-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* Hidden state still just hides the container */


/* Chat Container */
#chat-container {
  position: fixed;
  bottom: 90px;
  right: 25px;
  width: 350px;
  height: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);

  /* NEW: flex so header + window share the 500px height */
  display: flex;
  flex-direction: column;
	overflow: hidden;
  z-index: 999;
}

/* Header */
#chat-header {
  display: flex;
  align-items: center;
  padding: 10px;
  background: var(--bot-bg);
  border-bottom: 1px solid var(--primary-color);
}
.chat-logo { width:40px; height:40px; border-radius:50%; margin-right:8px; }
.chat-caption { flex:1; font-weight:500; }
#chat-close-btn { background:none; border:none; font-size:20px; cursor:pointer; }

/* Chat Window (beneath the header) */
.chat-window {
  /* NEW: take up all remaining vertical space */
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat Log: scrollable region */
#chat-log {
  /* NEW: fill its parent .chat-window */
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 1em;
  background: #fff;
}
.loader {
  width:24px; height:24px; margin:8px auto;
  border:3px solid #ccc; border-top:3px solid var(--primary-color);
  border-radius:50%; animation:spin 1s linear infinite;
}

/* Form */
#chat-form {
  display:flex; gap:8px; padding:8px; border-top:1px solid #eee;
}
#chat-input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--primary-color);
  border-radius: 5px;
  resize: none;           
  min-height: 40px;
  max-height: 120px;       
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.4;
}

#chat-input:focus {
  border-color: var(--secondary-color); 
  outline: none;
}
#chat-form button {
  padding:8px 12px; background:var(--secondary-color);
  color:#fff; border:none; border-radius:4px; cursor:pointer;
}

/* Bubbles */
.message-wrapper {
  display:flex; align-items:flex-end; margin:8px 0;
}
.message-wrapper.user { justify-content:flex-end; }
.message-wrapper.bot  { justify-content:flex-start; }
.chat-bubble {
  max-width:80%; padding:8px 12px; border-radius:16px; position:relative;
  line-height:1.4; word-wrap:break-word;
}

.chat-bubble.user { background:var(--primary-color); color:#fff; border-radius:16px 16px 0 16px; }

.chat-bubble.assistant { background:var(--secondary-color); color:#fff; border-radius:16px 16px 16px 0; }
.avatar {
  width:32px; height:32px; border-radius:50%; margin:0 8px;
}

.chat-bubble.assistant .message-text {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.chat-bubble.assistant.collapsed .message-text {
  max-height: 6.0em; /* Collapse to about 4 lines */
}

/* Button always visible */
.show-more-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.6em;
  background: #eee;
  border: none;
  padding: 2px 5px;
  border-radius: 6px;
  cursor: pointer;
}

.show-more-btn:hover {
  background-color: #ddd;
}

/* Animations */
@keyframes spin { to { transform:rotate(360deg); } }

#chat-container.chat-hidden {
  display: none !important;
}