/* ========================================
   🎨 GIAO DIỆN CHUNG (PC + Mobile)
======================================== */
body {
  background: #f4f6f9;
  font-family: 'Segoe UI', sans-serif;
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: 13px; 
   background: url("/static/bg-chatbot.png") no-repeat center center fixed;
  background-size: cover;
}

.topbar {
  background: #0A5C36;
  color: white;
  padding: 10px 20px;
  display: flex;
  align-items: center;
}

.topbar-title {
  font-size: 24px;
  font-weight: bold;
  flex: 1;
}

.topbar-menu {
  font-size: 20px;
  cursor: pointer;
}

.chatbox {
	position: relative; /* Cho các dropdown bên trong không thoát khỏi */
  overflow: hidden;   /* Không cho tràn */
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0,0,0,0.1);
  box-sizing: border-box;
  padding-bottom: 48px; /* đủ chừa chỗ cho footer fixed */
  width: 100%;
  

}


.chat-header {
	background-color: #006600;
  color: white;
  padding: 10px 16px;
  border-bottom: 1px solid #ddd;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  
}
.header-grid {
  display: grid;
  grid-template-columns: 60px auto; /* Cột 1: logo – Cột 2: chữ */
  align-items: center;
  gap: 12px;
}

.header-col.logo-col {
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-icon {
  max-height: 48px;
  width: auto;
}

.text-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.text-col .line-1 {
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-col .line-2 {
  font-size: 13px;
}



.suggestion-bubble.used {
  pointer-events: none;
  opacity: 0.5;
}


.chat-header .left-info {
  display: flex;
  align-items: center;
  font-weight: bold;
}

.chat-header .right-icons button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  margin-left: 12px;
}

.chat-footer {
  text-align: center;
  font-size: 10px;
  padding: 8px;
  color: #fff;
  border-top: 1px solid #ddd;
  z-index: 1000; /* đảm bảo lớn hơn .chatbox hay .message-container */
  background-color: #2e7d32;
    position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

}
.chat-footer a {
  color: #c8e6c9;
}

.messages {
  flex: 1;
 background: url("/static/bg-chatbot.png") no-repeat center center;
  background-size: cover;  
  border-radius: 12px;
  overflow-y: auto;
  padding: 10px;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  text-align: center;
  margin-top: 8px;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  margin: 10px 0;
  color: #333;
}

.chat-message.bot { flex-direction: row; }
.chat-message.user { flex-direction: row-reverse; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 10px;
  object-fit: cover;
  display: inline-block;
}

.chat-message.bot .message-bubble {
  padding: 12px 16px;
  border-radius: 12px 12px 12px 0;
  max-width: 80%;
   background: linear-gradient(135deg, #e8f5e9, #f1f8e9); /* ✅ BỔ SUNG DÒNG NÀY */
  border-left: 4px solid #43a047;
  color: #1b4332;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.06);
  border: 1px solid #a5d6a7;
  text-align: justify;
  text-justify: inter-word;
}

.user .message-bubble {
  background-color: #1a73e8;
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  font-size: 13px;
  max-width: 80%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-align: justify;
  text-justify: inter-word;
}

.input-container {
  display: flex;
  align-items: center;
  background-color: #fff;
  margin-bottom: 40px; /* 👈 đủ để không bị footer đè lên */
  gap: 8px;
  margin-top: 10px;
  position: relative;
  padding: 10px;
  border-top: 1px solid #ddd;
  width:100%;
  box-sizing: border-box;
}

.input-container input {
  flex: 1;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.send-button button {
  background-color: #4CAF50;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.send-button img {
  width: 22px;
  height: 22px;
}
#suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-top: 4px;
  z-index: 5;
}

#suggestions .quick-reply {
  margin: 4px 0;
  background-color: #e0f7fa;
  border: 1px solid #00acc1;
  color: #006064;
  transition: background 0.2s;
}

#suggestions .quick-reply:hover {
  background-color: #b2ebf2;
}
.suggestions-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 250px;
}

.suggestion-bubble {
  background: linear-gradient(135deg, #b9e4c9, #a5d6a7) !important; /* Xanh lá nhẹ */
  border-left: 4px solid #43a047; /* Xanh lá đậm */
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  color: #1b4332;
  font-weight: 500;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
  transition: background 0.25s ease;
}

.suggestion-bubble:hover {
  background: linear-gradient(135deg, #e0f7e9, #d0f0dc) !important; /* Xanh đậm hơn khi hover */
}


/* Vị trí khung chứa các quick reply */
/* CSS */
#quickReplies {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  border-top: 1px solid #ddd;
  z-index: 10;
}

/* Nút quick reply */
#quickReplies .quick-reply {
  background: linear-gradient(to right, #43a047, #66bb6a)!important;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

#quickReplies .quick-reply:hover {
  background: linear-gradient(to right, #2e7d32, #43a047)!important;
  transform: translateY(-2px);
}




#selectNganh {
  margin: 10px;
  max-width: 100%;
  padding-left: 50px;
}

#selectNganh select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
}



#username {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 250px;
  text-align: center;
}

#startBtn {
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@keyframes blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
.dot-1 { animation: blink 1s infinite; }
.dot-2 { animation: blink 1s infinite 0.2s; }
.dot-3 { animation: blink 1s infinite 0.4s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

input.success, textarea.success, select.success {
  border: 2px solid #2ecc71 !important;
  background-color: #f0fff5;
}

input.error, textarea.error, select.error {
  border: 2px solid #e74c3c !important;
  background-color: #fff3f3;
  animation: shake 0.25s ease-in-out 2;
}

.status-icon {
	position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #ccc;
  pointer-events: none;
  
  float: right;
 
  margin-top: -30px;
  margin-right: 10px;
  
}
input.success + .status-icon,
textarea.success + .status-icon,
select.success + .status-icon {
  color: #2ecc71;
}
input.error + .status-icon,
textarea.error + .status-icon,
select.error + .status-icon {
  color: #e74c3c;
}

input::placeholder,
textarea::placeholder {
  color: #bbb;
  font-style: italic;
  opacity: 0.8;
  transition: all 0.3s ease;
}
input:focus::placeholder,
textarea:focus::placeholder {
  opacity: 0.4;
  transform: translateY(-1px);
}
.footer-credit {
  position: relative;
  z-index: 2; /* đảm bảo nó nổi lên trên */
}

.footer-link {
  color: #ccc;
  text-decoration: underline;
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
  position: relative;
}


.form-popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}


.form-popup-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 95%;
  max-width: 480px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.3);
  animation: fadeInUp 0.3s ease-out;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 95vh;
  overflow-y: auto;
}

.form-popup-box button.close-popup {
  position: absolute;
  top: 12px;
  right: 22px;
  background: none;
  border: none;
  font-size: 20px;
  color: #888;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.form-popup-box button.close-popup:hover {
  transform: rotate(90deg);
  color: #e74c3c;
}

.form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-wrapper input,
.form-wrapper select,
.form-wrapper textarea {
	display: block;

  margin-bottom: 12px;

  font-size: 14px;



  
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;

  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-wrapper input:focus,
.form-wrapper select:focus,
.form-wrapper textarea:focus {
  border-color: #1a73e8;
  outline: none;
  box-shadow: 0 0 5px rgba(26,115,232,0.3);
}

.form-wrapper .submit-btn {
  background: #1a73e8;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.form-wrapper .submit-btn:hover {
  background: #0c5ec2;
}

.message {
	flex: 1;
  padding: 10px;
  padding-bottom: 80px; /* 👈 chừa chỗ cho nút Quick Reply */
  overflow-y: auto;
  
  font-size: 13px;
  color: red;
  min-height: 18px;
  margin-top: 4px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px); /* bắt đầu từ dưới */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#formPopup {
  display: none;
  
}

#formPopup.show {
  display: flex !important;
  
}
.input-field {
  flex: 1;
}

.input-field input {
  width: 100%;
  padding: 10px 12px;
 
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}
  .input-container {
    flex-direction: row;
    align-items: center;
	  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 8px;
  border-top: 1px solid #ddd;
  gap: 8px;
  }
    .input-col {
  display: flex;
  align-items: center;
}
.menu-button {
   position: relative; /* Quan trọng để dropdown bám đúng */
  margin-left: 10px;
}

#menu-toggle {
  font-size: 20px;
  padding: 8px 12px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.3s ease;
}

#menu-toggle:hover {
  background: #388e3c;
}

.menu-dropdown {
  position: absolute;
  bottom: calc(100% + 10px); /* 👈 xổ lên trên */
  left: 0;
  
  background: white;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
  padding: 6px 0;
  z-index: 9999;
  display: none;
  
 min-width: 180px;      /* ✅ Không để menu bị co */
 max-width: 280px;
 box-sizing: border-box; /* ✅ Đảm bảo padding không làm tràn */
 width: fit-content;
 white-space: nowrap;
 overflow-x: auto;
}

.menu-dropdown a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 6px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s;
 
}

.menu-dropdown a:hover {
  background: #f0f0f0;
}

/* Animation xổ xuống */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* =========================
   📱 GIAO DIỆN MOBILE
========================= */
@media screen and (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .chatbox {
    width: 100vw;
    height: calc(100vh - 72px); /* chừa chỗ cho input-container */
    border-radius: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 20px; /* chừa chỗ nhỏ cho quick reply, nếu có */
  }

  .input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
  }

  .input-field {
    flex: 1;
  }

  .send-button button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topbar-menu, 
  .menu-button button {
    position: relative;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  }

  #menu-dropdown, 
  .menu-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    padding: 10px;
    display: none;
    z-index: 99999;
    min-width: 180px;
    width: max-content;
    white-space: nowrap;
  }

  #menu-dropdown a, 
  .menu-dropdown a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    border-radius: 6px;
    transition: background 0.2s;
  }

  #menu-dropdown a:hover,
  .menu-dropdown a:hover {
    background: #f1f1f1;
  }

  .quick-replies {
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 6px;
  }

  .quick-reply {
    flex-shrink: 0;
  }

  .start-box {
    align-items: center;
  }

  .form-popup-box {
    width: 95%;
    padding: 20px;
    max-height: 95vh;
    overflow-y: auto;
  }

  .header-grid {
    grid-template-columns: 50px auto;
    gap: 8px;
  }

  .logo-icon {
    max-height: 40px;
  }

  .text-col .line-1 {
    font-size: 13px;
  }

  .text-col .line-2 {
    font-size: 12px;
  }

  .chat-header {
    padding: 8px 12px;
  }

}
