/* ===================================
   LANDINGPAGE CHATBOT STYLES
   =================================== */

#landingpage-chat-root {
  position: fixed;
  bottom: 30px;
  right: 30px;
  font-family: 'Be Vietnam Pro', Arial, sans-serif;
  z-index: 9999;
}

/* ===================================
   CHAT TOGGLE BUTTON - IMAGE VERSION
   =================================== */

.lp-toggle-btn {
  width: 60px;
  height: 60px;
  background: #fff;
  border: 2px solid #34495e;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation: slideInFromRight 0.5s ease-out, floatAnimation 3s ease-in-out infinite 1s;
}

/* Image inside button - THAY URL NÀY BẰNG LOGO CỦA BẠN */
.lp-toggle-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  background: url('YOUR_LOGO_URL_HERE') no-repeat center center;
  background-size: contain;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* HOẶC sử dụng <img> tag trong HTML */
.lp-toggle-btn img {
  width: 85px;
  height: 85px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* Hover effect */
.lp-toggle-btn:hover {
  background: #fff;
  border-color: #2C3E50;
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.lp-toggle-btn:active {
  transform: scale(1.05);
}

/* Animations */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes floatAnimation {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Pulse ring animation */
@keyframes pulseRing {
  0% {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 
                0 0 0 0 rgba(52, 73, 94, 0.7);
  }
  50% {
    box-shadow: 0 6px 18px rgba(0,0,0,0.35), 
                0 0 0 20px rgba(52, 73, 94, 0);
  }
  100% {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 
                0 0 0 0 rgba(52, 73, 94, 0);
  }
}

.lp-toggle-btn {
  animation: slideInFromRight 0.5s ease-out, 
             floatAnimation 3s ease-in-out infinite 1s,
             pulseRing 2.5s infinite 2s;
}

/* Tooltip */
.lp-toggle-btn::after {
  content: 'Cần hỗ trợ? Chat ngay! 💬';
  position: absolute;
  right: 85px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 10;
}

.lp-toggle-btn:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(-5px);
}

/* ===================================
   MAIN CHAT CONTAINER
   =================================== */

.lp-chat {
  width: 400px;
  height: 400px;
  background: white;
  border: none;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  margin-bottom: 10px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  display: flex;
  flex-direction: column;
  z-index: 9999
}

.lp-chat.expanded {
  width: 600px;
  height: 500px;
  position: fixed;
  bottom: 20px;
  right: 20px;
}

.lp-chat.hidden {
  display: none;
}

.lp-chat.showing {
  animation: chatSlideIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.lp-chat.closing {
  animation: chatSlideOut 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes chatSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes chatSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
}

/* ===================================
   CHAT HEADER
   =================================== */

.lp-header {
  background: #2C3E50;
  color: #F7F5F2;
  padding: 10px;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lp-header-title {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Lead Status Badge */
.lp-lead-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  animation: fadeIn 0.3s;
}

.lp-expand-btn{
  background:transparent;
  color: white;
  width: 28px;
  height: 28px;
  margin-right:-20px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  border: none;
  outline: none; 
}
.lp-close-btn {
  background:transparent;
  color: white;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  border: none; 
  outline: none; 
}


.lp-expand-btn:focus,
.lp-close-btn:focus {
  background: transparent; 
  outline: none;
}

.lp-expand-btn:active,
.lp-close-btn:active {
  background: transparent; 
}

.lp-expand-btn:hover,
.lp-close-btn:hover {
  background: transparent;
  border-radius:50%;
  transform: scale(1.1);
}

.lp-close-btn:hover {
  color: red;
}

/* ===================================
   MESSAGES AREA
   =================================== */

.lp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lp-messages::-webkit-scrollbar {
  width: 6px;
}

.lp-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.lp-messages::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ===================================
   MESSAGE BUBBLES
   =================================== */

.lp-msg {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lp-msg.bot {
  background: white;
  border-radius:20px;
  color: #333;
  align-self: flex-start;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lp-msg.you {
  background: #667eea;
  border-radius:20px;
  color: white;
  align-self: flex-end;
  margin-left: auto;
}

/* Typing indicator */
.typing-indicator {
  display: inline-block;
  animation: blink 1.4s infinite;
}

@keyframes blink {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* ===================================
   INPUT AREA
   =================================== */

.lp-input-wrap {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
  border-radius: 0 0 16px 16px;
}

.lp-input {
  flex: 1;
  border: 2px solid #e0e0e0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.lp-input:focus {
  border-color: #2C3E50;
  box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.lp-send {
  background: #2C3E50;
  color: #F7F5F2;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.lp-send:hover {
  transform: scale(1.1);
  background: #34495e;
}

.lp-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================================
   CONTACT FORM
   =================================== */

.lp-form-wrapper {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 8px;
}

.lp-contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.lp-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lp-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.lp-form-group input,
.lp-form-group select {
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.lp-form-group input:focus,
.lp-form-group select:focus {
  border-color: #667eea;
}

.lp-form-submit {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.lp-form-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.lp-form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===================================
   WHATSAPP BUTTON
   =================================== */

.lp-whatsapp-btn {
  position: fixed;
  bottom: 110px;
  right: 30px;
  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: 9998;
  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.chat-open {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100px) scale(0.5);
}

.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);
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(100px) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes whatsappPulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.8), 
                0 0 0 10px rgba(37, 211, 102, 0.2);
  }
}

.lp-whatsapp-btn {
  animation: slideInFromBottom 0.5s ease-out 0.5s both,
             whatsappPulse 2s infinite 2s;
}

/* Disable pulse when chat open */
.lp-whatsapp-btn.chat-open {
  animation: none;
}

.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) {
  #landingpage-chat-root {
    bottom: 20px;
    right: 20px;
  }

  .lp-toggle-btn {
    width: 60px;
    height: 60px;
  }

  .lp-toggle-btn::before,
  .lp-toggle-btn img {
    width: 75px;
    height: 75px;
  }
  
  .lp-toggle-btn::after {
    display: none;
  }
  
  .lp-chat {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
    bottom: 10px;
    right: 10px;
    border-radius: 12px;
  }
  
  .lp-chat.expanded {
    width: calc(100% - 20px);
    height: calc(100vh - 20px);
  }

  .lp-whatsapp-btn {
    width: 56px;
    height: 56px;
    bottom: 90px;
    right: 20px;
  }
  
  .lp-whatsapp-btn::before {
    display: none;
  }
}

@media (max-width: 480px) {
  .lp-toggle-btn {
    width: 56px;
    height: 56px;
  }

  .lp-toggle-btn::before,
  .lp-toggle-btn img {
    width: 70px;
    height: 70px;
  }
  
  .lp-whatsapp-btn {
    bottom: 85px;
    right: 15px;
  }

  .lp-form-group input,
  .lp-form-group select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* ===================================
   UTILITY ANIMATIONS
   =================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@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);
  }
}