/* WhatsApp FAB Container */
.whatsapp-fab-container-p {
  position: fixed;
  bottom: 100px;
  right: 25px;
  z-index: 999998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* FAB Button */
.whatsapp-fab-p {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.whatsapp-fab-p:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-fab-p:active {
  transform: scale(0.95);
}

.whatsapp-icon-p {
  width: 32px;
  height: 32px;
  color: white;
  transition: all 0.3s ease;
}

.fab-close-icon-p {
  position: absolute;
  font-size: 36px;
  color: white;
  font-weight: 300;
  opacity: 0;
  transform: rotate(-90deg);
  transition: all 0.3s ease;
}

.whatsapp-fab-p.active .whatsapp-icon-p {
  opacity: 0;
  transform: rotate(90deg);
}

.whatsapp-fab-p.active .fab-close-icon-p {
  opacity: 1;
  transform: rotate(0deg);
}

/* Chat Badge */
.chat-badge-p {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 3px solid white;
  animation: pulse-badge-p 2s infinite;
}

@keyframes pulse-badge-p {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

.chat-badge-p.hidden {
  display: none;
}

/* Chatbot Modal - INCREASED WIDTH FOR DESKTOP */
.whatsapp-chat-modal-p {
  position: absolute;
  bottom: -90px;
  right: 0;
  width: 450px; /* Increased from 360px */
  max-width: 90vw;
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

.whatsapp-chat-modal-p.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.chat-header-p {
  background: linear-gradient(135deg, #075E54 0%, #128C7E 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.chat-header-left-p {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-p {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-avatar-p svg {
  width: 24px;
  height: 24px;
}

.chat-header-info-p h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.chat-status-p {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.95;
  margin-top: 2px;
}

.status-dot-p {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: blink-status-p 2s infinite;
}

@keyframes blink-status-p {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-close-btn-p {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.chat-close-btn-p:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Chat Body - ENHANCED BACKGROUND */
.chat-body-p {
  padding: 20px;
  max-height: 65vh;
  overflow-y: auto;
  background: linear-gradient(to bottom, #e5ddd5 0%, #f0ebe5 100%);
  background-image: 
    linear-gradient(to bottom, #e5ddd5 0%, #f0ebe5 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.03) 10px, rgba(255,255,255,.03) 20px);
}

.chat-body-p::-webkit-scrollbar {
  width: 6px;
}

.chat-body-p::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body-p::-webkit-scrollbar-thumb {
  background: #bdbdbd;
  border-radius: 10px;
}

.chat-body-p::-webkit-scrollbar-thumb:hover {
  background: #9e9e9e;
}

/* Chat Messages - RECEIVED (From Business) */
.chat-message-received-p {
  margin-bottom: 15px;
  animation: slideInLeft-p 0.4s ease;
  display: flex;
  justify-content: flex-start;
}

@keyframes slideInLeft-p {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message-bubble-p {
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  max-width: 75%;
  display: inline-block;
  position: relative;
}

/* Triangle for received messages */
.message-bubble-p::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent #ffffff transparent transparent;
}

.message-bubble-p p {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
}

.message-time-p {
  font-size: 11px;
  color: #667781;
  display: block;
  text-align: right;
}

/* Chat Messages - SENT (From User) - NEW STYLE */
.chat-message-sent-p {
  margin-bottom: 15px;
  animation: slideInRight-p 0.4s ease;
  display: flex;
  justify-content: flex-end;
}

@keyframes slideInRight-p {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message-bubble-sent-p {
  background: linear-gradient(135deg, #dcf8c6 0%, #d4f4b7 100%);
  padding: 10px 14px;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  max-width: 75%;
  display: inline-block;
  position: relative;
}

/* Triangle for sent messages */
.message-bubble-sent-p::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 0 8px;
  border-color: #dcf8c6 transparent transparent transparent;
}

.message-bubble-sent-p p {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #1a1a1a;
}

.message-bubble-sent-p .message-time-p {
  color: #667781;
}

/* Chat Form */
.chat-form-container-p {
  margin-top: 15px;
  animation: fadeInUp-p 0.5s ease 0.3s both;
}

@keyframes fadeInUp-p {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-form-p {
  background: #ffffff;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.chat-form-group-p {
  margin-bottom: 15px;
}

.chat-form-group-p:last-of-type {
  margin-bottom: 18px;
}

.chat-form-group-p label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.required-chat-p {
  color: #e74c3c;
  margin-left: 2px;
}

.chat-form-group-p input,
.chat-form-group-p select,
.chat-form-group-p textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: #f9fafb;
}

.chat-form-group-p input:focus,
.chat-form-group-p select:focus,
.chat-form-group-p textarea:focus {
  outline: none;
  border-color: #25D366;
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.chat-form-group-p textarea {
  resize: vertical;
  min-height: 75px;
}

.chat-error-p {
  display: block;
  color: #e74c3c;
  font-size: 11px;
  margin-top: 4px;
  font-weight: 500;
}

/* Submit Button */
.chat-submit-btn-p {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.chat-submit-btn-p:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

.chat-submit-btn-p:active {
  transform: translateY(0);
}

/* Responsive - TABLET */
@media (max-width: 768px) {
  .whatsapp-chat-modal-p {
    width: 380px;
  }
}

/* Responsive - MOBILE */
@media (max-width: 480px) {
  .whatsapp-fab-container-p {
    bottom: 20px;
    left: 20px;
  }

  .whatsapp-chat-modal-p {
    width: calc(100vw - 40px);
    bottom: 75px;
  }

  .chat-body-p {
    max-height: 400px;
  }
  
  .message-bubble-p,
  .message-bubble-sent-p {
    max-width: 85%;
  }
}

/* Animations for FAB */
@keyframes bounce-fab-p {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.whatsapp-fab-p.bounce {
  animation: bounce-fab-p 1s ease infinite;
}

/* Additional Enhancement - Typing Indicator */
.typing-indicator-p {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  align-items: center;
}

.typing-dot-p {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #90949c;
  animation: typing-p 1.4s infinite;
}

.typing-dot-p:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot-p:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-p {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}
