/* chat.css */
#nailsalon-chat-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: Arial, sans-serif;
  z-index: 9999;
}

/* Chat toggle button (floating icon) */
.ns-toggle-btn {
  width: 60px;
  height: 60px;
  background: #fff;
  border: 2px solid #34495e;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.35s ease-in-out,
              border-color 0.35s ease-in-out,
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s ease-in-out;
}

.ns-toggle-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  background: url('https://nail.chuyenlaman.com/wp-content/themes/nailsalon-child/images/schat_logo.png') no-repeat center center;
  background-size: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ns-toggle-btn:hover {
  background: #fff;
  border-color: #2C3E50;
  transform: scale(1.15);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

/* Main chat container */
.ns-chat {
  width: 400px;
  background: #F7F5F2;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  margin-bottom: 10px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Expanded state - chiếm nửa màn hnh */
.ns-chat.expanded {
  width: 50vw;
  height: 70vh;
  position: fixed;
  bottom: 20px;
  right: 20px;
}

/* Hidden state */
.ns-chat.hidden {
  display: none;
}

/* Chat header vi nút close và expand */
.ns-header {
  background: #2C3E50;
  color: #F7F5F2;
  padding: 10px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ns-header-title {
  flex: 1;
}

.ns-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ns-expand-btn,
.ns-close-btn {
  background: #2C3E50;
  color: #F7F5F2;
  font-size: 24px;
  font-weight:bold;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.2s ease;
  border: none;
  outline:none;
}

.ns-expand-btn:hover,
.ns-close-btn:hover {
  color: #D98760;
  transform: scale(1.1);
  background: #2C3E50;
}
.ns-expand-btn:focus,
.ns-expand-btn:active,
.ns-close-btn:focus,
.ns-close-btn:active {
  background: #2C3E50;
  color: #F7F5F2;
  outline: none;
}
.ns-close-btn:hover {
  color: red;
  background: #2C3E50;
}

.ns-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: #fafafa;
  flex: 1;
  min-height: 0;
}

/* Expanded messages area */
.ns-chat.expanded .ns-messages {
  flex: 1;
  max-height: none;
}

.ns-msg { 
  display: inline-block;
  margin-bottom: 8px; 
  padding: 8px 12px;
  border-radius: 15px;
  max-width: 80%;
  word-wrap: break-word;
  white-space: pre-wrap; 
}

.ns-msg.you { 
  background: #6b63ff;
  color: white;
  margin-left: auto;
  text-align: left;
  display: block;
  width: fit-content; 
}

.ns-msg.bot { 
  background: #e9ecef;
  color: #333;
  margin-right: auto;
  text-align: left;
  display: block;
  width: fit-content;
}

.ns-input-wrap {
  display: flex;
  padding: 8px;
  border-top: 1px solid #eee;
  background: white;
  flex-shrink: 0;
}

.ns-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  margin-right: 6px;
  outline: none;
  transition: border 0.3s ease;
}

.ns-input:focus {
  border: 1.5px solid #2C3E50;
}

.ns-send {
  background: #2C3E50;
  color: #F7F5F2;
  border: none;
  border-radius: 50%;
  padding: 8px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.ns-send:hover {
  background: #5a52e0;
}

.ns-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Animation for smooth transitions */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ns-chat.showing {
  animation: slideUp 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.ns-chat.closing {
  animation: slideDown 0.3s ease forwards;
}

/* Responsive cho màn hình nh */
@media (max-width: 768px) {
  .ns-chat {
    width: 90vw;
  }
  
  .ns-chat.expanded {
    width: 95vw;
    height: 80vh;
    bottom: 10px;
    right: 10px;
  }
}

/*CHAT FORM*/
/*========================*/
/* Lead Status Badge */
.ns-lead-badge {
  padding: 4px 10px;
  border-radius: 12px;
  color: white;
  font-size: 11px;
  font-weight: 600;
  margin-right: 8px;
  animation: fadeIn 0.3s ease-in;
}

/* Form Wrapper */
.ns-form-wrapper {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  margin-top: 10px;
}

.ns-form-wrapper p {
  margin: 0 0 15px 0;
  font-weight: 500;
  color: #333;
}

/* Contact Form Styles */
.ns-contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ns-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ns-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.ns-form-group input,
.ns-form-group select {
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.ns-form-group input:focus,
.ns-form-group select:focus {
  outline: none;
  border-color: #007bff;
  background: white;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.ns-form-group input::placeholder {
  color: #aaa;
}

.ns-form-submit {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 8px;
}

.ns-form-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ns-form-submit:active {
  transform: translateY(0);
}

.ns-form-submit:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Typing Indicator Animation */
.typing-indicator {
  display: inline-block;
  letter-spacing: 2px;
}

@keyframes typingDots {
  0%, 20% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.3;
  }
}

.typing-indicator::before,
.typing-indicator::after {
  content: '●';
  animation: typingDots 1.4s infinite;
}

.typing-indicator::before {
  animation-delay: 0s;
}

.typing-indicator::after {
  animation-delay: 0.2s;
}

/* Enhanced message styles */
.ns-msg.bot {
  animation: slideInLeft 0.3s ease-out;
}

.ns-msg.you {
  animation: slideInRight 0.3s ease-out;
}

/* WhatsApp Button */
.lp-whatsapp-btn {
  position: fixed;
  bottom: 100px; /* Phía trên chatbot button */
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  text-decoration: none;
  animation: slideInFromBottom 0.5s ease-out 0.5s both;
}

.lp-whatsapp-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
  background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

.lp-whatsapp-btn:active {
  transform: scale(0.95);
}

/* Animation khi load trang */
@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(100px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulse animation lặp lại */
@keyframes whatsappPulse {
    0% {
    box-shadow: 
      0 0 0 0 rgba(37, 211, 102, 0.6),
      0 0 0 0 rgba(37, 211, 102, 0.2);
    transform: scale(1) translateY(0);
  }
  50% {
    box-shadow: 
      0 0 15px 6px rgba(37, 211, 102, 0.7),
      0 0 35px 10px rgba(37, 211, 102, 0.25);
    transform: scale(1.05) translateY(-4px);
  }
  100% {
    box-shadow: 
      0 0 0 0 rgba(37, 211, 102, 0.6),
      0 0 0 0 rgba(37, 211, 102, 0.2);
    transform: scale(1) translateY(0);
  }
}

.lp-whatsapp-btn {
  animation: slideInFromBottom 0.5s ease-out 0.5s both,
             whatsappPulse 2s infinite 2s;
}

/* Tooltip khi hover */
.lp-whatsapp-btn::before {
  content: attr(title);
  position: absolute;
  right: 70px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lp-whatsapp-btn:hover::before {
  opacity: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .lp-whatsapp-btn {
    width: 56px;
    height: 56px;
    bottom: 90px;
    right: 20px;
  }
  
  .lp-whatsapp-btn svg {
    width: 26px;
    height: 26px;
  }
  
  .lp-whatsapp-btn::before {
    display: none; /* Ẩn tooltip trên mobile */
  }
}

/* Điều chỉnh vị trí chatbot button */
.lp-toggle-btn {
  bottom: 30px; /* Giữ nguyn vị trí cũ */
}

/* Stack buttons vertically */
@media (max-width: 480px) {
  .lp-whatsapp-btn {
    bottom: 100px;
    right: 15px;
  }
  
  .lp-toggle-btn {
    bottom: 25px;
    right: 15px;
  }
}

.lp-whatsapp-btn.chat-open{
  opacity: 0;
  pointer-events: none;
  transform: translateY(100px) scale(0.5);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Responsive form */
@media (max-width: 480px) {
  .ns-form-wrapper {
    padding: 12px;
  }
  
  .ns-form-group input,
  .ns-form-group select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}