/* Chat Widget Styles */
.chat-widget-container {
  position: fixed;
  /* place just above the page-up button (which is at bottom:20px; height:55px) */
  bottom: 90px; /* 20 + 55 + 15 gap */
  right: 20px; /* align with page-up button */
  z-index: 100000;
  font-family: var(--tp-ff-body);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-widget-container * {
  pointer-events: auto;
}

/* Chat Button */
.chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #04915f 0%, #a6ce38 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(4, 145, 95, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chat-toggle-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.chat-toggle-btn:hover::before {
  width: 120px;
  height: 120px;
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(4, 145, 95, 0.6);
}

.chat-toggle-btn i {
  font-size: 26px;
  color: #ffffff;
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.chat-toggle-btn:hover i {
  transform: rotate(360deg);
}

.chat-toggle-btn .fa-whatsapp {
  color: #ffffff;
}

/* Notification Badge */
.chat-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #e62415;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  font-weight: 600;
  animation: pulse 2s infinite;
  box-shadow: 0 0 0 0 rgba(230, 36, 21, 0.7);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(230, 36, 21, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(230, 36, 21, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(230, 36, 21, 0);
  }
}

/* Chat Box */
.chat-box {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 550px;
  background: var(--tp-common-white);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

.chat-box.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #04915f 0%, #a6ce38 100%);
  padding: 20px;
  color: var(--tp-common-white);
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

/* Close button inside header */
.chat-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--tp-common-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.12s ease;
  z-index: 3;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.04);
}

.chat-close-btn i {
  font-size: 14px;
}

.chat-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: wave 15s linear infinite;
}

@keyframes wave {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.chat-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--tp-common-white);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-avatar i {
  font-size: 22px;
  color: #04915f;
}

.chat-header-info {
  flex: 1;
  position: relative;
  z-index: 2;
}

.chat-header-info h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-header-info p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.chat-online-status {
  width: 8px;
  height: 8px;
  background: #00dd80;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  animation: blink 2s infinite;
}

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

/* Chat Body */
.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #a6ce38;
  border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
  background: #04915f;
}

/* Chat Messages */
.chat-message {
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

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

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #04915f 0%, #a6ce38 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-avatar i {
  font-size: 16px;
  color: var(--tp-common-white);
}

.chat-message.user .message-avatar {
  background: var(--tp-grey-3);
}

.chat-message.user .message-avatar i {
  color: #04915f;
}

.message-content {
  max-width: 70%;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--tp-common-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  word-wrap: break-word;
}

.chat-message.user .message-bubble {
  background: linear-gradient(135deg, #04915f 0%, #a6ce38 100%);
  color: var(--tp-common-white);
}

.message-time {
  font-size: 11px;
  color: var(--tp-grey-2);
  margin-top: 5px;
  display: block;
}

.chat-message.user .message-time {
  text-align: right;
  color: var(--tp-grey-4);
}

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-reply-btn {
  padding: 8px 16px;
  background: var(--tp-common-white);
  border: 2px solid #04915f;
  border-radius: 20px;
  color: #04915f;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.quick-reply-btn:hover {
  background: #04915f;
  color: var(--tp-common-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(4, 145, 95, 0.3);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}

.typing-indicator .message-bubble {
  display: flex;
  gap: 5px;
  padding: 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #04915f;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Chat Footer */
.chat-footer {
  padding: 15px 20px;
  background: var(--tp-common-white);
  border-top: 1px solid var(--tp-border-1);
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  font-family: var(--tp-ff-body);
}

.chat-input:focus {
  border-color: #04915f;
  box-shadow: 0 0 0 3px rgba(4, 145, 95, 0.1);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #04915f 0%, #a6ce38 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(4, 145, 95, 0.4);
}

.chat-send-btn i {
  font-size: 16px;
  color: var(--tp-common-white);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chat-box {
    width: calc(100vw - 40px);
    height: calc(100vh - 140px);
    right: 20px;
    bottom: 90px;
  }

  /* On small screens keep the chat button above the mobile scrollToTop (shorter height)
     Use a slightly smaller gap so it doesn't overlap the bottom controls */
  .chat-widget-container {
    bottom: 70px;
    right: 20px;
  }
}

/* Footer icon/logo color fixes to match the theme */
.tp-footer-area {
  --footer-icon-color: #a6ce38;
}

.tp-footer-area i {
  color: black !important;
}

.tp-footer-area .tp-footer-wd-social a {
  background: white;
}

.tp-footer-area .tp-footer-wd-social a i {
  font-size: 18px;
  color: black;
  transition:
    transform 0.18s ease,
    color 0.18s ease;
}

.tp-footer-area .tp-footer-wd-social a:hover i {
  color: #ffffff !important;
  transform: translateY(-3px) scale(1.05);
}

/* Ensure the anchor itself and focus state also show white on hover */
.tp-footer-area .tp-footer-wd-social a:hover {
  color: #ffffff !important;
}

.tp-footer-area .tp-footer-wd-social a:hover i {
  color: #ffffff !important;
}

.tp-footer-area .tp-footer-widget-form i,
.tp-footer-area .tp-footer-wd-widget i {
  color: var(--footer-icon-color) !important;
}

.tp-footer-copyright svg path {
  fill: #ffffff !important;
}

/* Welcome Animation */
@keyframes welcome-bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.chat-toggle-btn.welcome {
  animation: welcome-bounce 2s ease-in-out;
}

.tp-footer-area .tp-footer-wd-social a:focus i {
  color: black !important;
}