/**
 * Contact Icon Plugin Frontend Styles
 * Version: 0.0.1
 * Author: Reachlane Co. Ltd
 */

/* Main contact icon container */
.contact-icon-container {
  position: fixed;
  bottom: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.contact-icon-container.position-bottom-left {
  left: 20px;
}

.contact-icon-container.position-bottom-right {
  right: 20px;
}

/* Main chat icon */
.contact-icon-main {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--contact-icon-primary-color, #007cba);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  border: none;
  outline: none;
}

.contact-icon-main:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.contact-icon-main.active {
  transform: rotate(45deg);
}

/* Chat icon SVG */
.contact-icon-main .chat-icon {
  width: 28px;
  height: 28px;
  fill: white;
  transition: transform 0.3s ease;
}

.contact-icon-main.active .chat-icon {
  transform: rotate(-45deg);
}

/* Methods container */
.contact-methods {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10000; /* Ensure container is above other elements */
}

.contact-methods.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Individual method button */
.contact-method {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: white;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  transform: translateY(20px);
  border: none;
  outline: none;
  text-decoration: none;
  position: relative;
  z-index: 10001; /* Ensure methods are above everything */
  font-family: inherit; /* For button elements */
  font-size: inherit; /* For button elements */
}

.contact-methods.active .contact-method {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.contact-method:nth-child(1) {
  transition-delay: 0.1s;
  z-index: 10006;
}
.contact-method:nth-child(2) {
  transition-delay: 0.15s;
  z-index: 10005;
}
.contact-method:nth-child(3) {
  transition-delay: 0.2s;
  z-index: 10004;
}
.contact-method:nth-child(4) {
  transition-delay: 0.25s;
  z-index: 10003;
}
.contact-method:nth-child(5) {
  transition-delay: 0.3s;
  z-index: 10002;
}
.contact-method:nth-child(6) {
  transition-delay: 0.35s;
  z-index: 10001;
}

.contact-method:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Method icons */
.contact-method .method-icon {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
  fill: #666666; /* Default color for visibility */
}
.contact-method:hover .method-icon {
  transform: scale(1.1);
}

/* WhatsApp specific styles */
.contact-method.contact-method-whatsapp {
  background-color: white;
  border: 2px solid #25d366;
}

.contact-method.contact-method-whatsapp .method-icon {
  fill: #25d366;
}

.contact-method.contact-method-whatsapp:hover {
  background-color: #25d366;
  border-color: #25d366;
}

.contact-method.contact-method-whatsapp:hover .method-icon {
  fill: white;
}

/* Email/Contact specific styles */
.contact-method.contact-method-contact_page {
  background-color: white;
  border: 2px solid #34495e;
}

.contact-method.contact-method-contact_page .method-icon {
  fill: #34495e;
}

.contact-method.contact-method-contact_page:hover {
  background-color: #34495e;
  border-color: #34495e;
}

.contact-method.contact-method-contact_page:hover .method-icon {
  fill: white;
}

/* LINE specific styles */
.contact-method.contact-method-line {
  background-color: white;
  border: 2px solid #00b900;
}

.contact-method.contact-method-line .method-icon {
  fill: #00b900;
}

.contact-method.contact-method-line:hover {
  background-color: #00b900;
  border-color: #00b900;
}

.contact-method.contact-method-line:hover .method-icon {
  fill: white;
}

/* Modal specific styles */
.contact-method.contact-method-modal {
  background-color: white;
  border: 2px solid var(--contact-icon-modal-color, #2c1c5d);
  z-index: 10002; /* Higher than other methods */
}

.contact-method.contact-method-modal .method-icon {
  fill: var(--contact-icon-modal-color, #2c1c5d);
  width: 32px !important;
  height: 32px !important;
}

.contact-method.contact-method-modal:hover {
  background-color: var(--contact-icon-modal-color, #2c1c5d);
  border-color: var(--contact-icon-modal-color, #2c1c5d);
  transform: scale(1.1);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.contact-method.contact-method-modal:hover .method-icon {
  fill: white;
}

/* LinkedIn specific styles */
.contact-method.contact-method-linkedin {
  background-color: white;
  border: 2px solid #0077b5;
}

.contact-method.contact-method-linkedin .method-icon {
  fill: #0077b5;
}

.contact-method.contact-method-linkedin:hover {
  background-color: #0077b5;
  border-color: #0077b5;
}

.contact-method.contact-method-linkedin:hover .method-icon {
  fill: white;
}

/* Facebook specific styles */
.contact-method.contact-method-facebook {
  background-color: white;
  border: 2px solid #1877f2;
}

.contact-method.contact-method-facebook .method-icon {
  fill: #1877f2;
}

.contact-method.contact-method-facebook:hover {
  background-color: #1877f2;
  border-color: #1877f2;
}

.contact-method.contact-method-facebook:hover .method-icon {
  fill: white;
}

/* Tooltip */
.contact-method::before {
  content: attr(data-title);
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 10000;
}

.contact-icon-container.position-bottom-left .contact-method::before {
  right: auto;
  left: 60px;
}

.contact-method:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Tooltip arrow */
.contact-method::after {
  content: "";
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10000;
}

.contact-icon-container.position-bottom-left .contact-method::after {
  right: auto;
  left: 50px;
  border-right: none;
  border-left: 5px solid rgba(0, 0, 0, 0.8);
}

.contact-method:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Responsive design */
@media (max-width: 768px) {
  .contact-icon-container {
    bottom: 15px;
  }

  .contact-icon-container.position-bottom-left {
    left: 15px;
  }

  .contact-icon-container.position-bottom-right {
    right: 15px;
  }

  .contact-icon-main {
    width: 55px;
    height: 55px;
  }

  .contact-icon-main .chat-icon {
    width: 26px;
    height: 26px;
  }

  .contact-method {
    width: 45px;
    height: 45px;
  }

  .contact-method .method-icon {
    width: 22px;
    height: 22px;
  }

  .contact-method.contact-method-modal .method-icon {
    width: 26px !important;
    height: 26px !important;
  }

  /* Hide tooltips on mobile */
  .contact-method::before,
  .contact-method::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .contact-icon-container {
    bottom: 10px;
  }

  .contact-icon-container.position-bottom-left {
    left: 10px;
  }

  .contact-icon-container.position-bottom-right {
    right: 10px;
  }

  .contact-icon-main {
    width: 50px;
    height: 50px;
  }

  .contact-icon-main .chat-icon {
    width: 24px;
    height: 24px;
  }

  .contact-method {
    width: 42px;
    height: 42px;
  }

  .contact-method .method-icon {
    width: 20px;
    height: 20px;
  }

  .contact-method.contact-method-modal .method-icon {
    width: 24px !important;
    height: 24px !important;
  }

  .contact-methods {
    gap: 8px;
    bottom: 60px;
  }
}

/* Animation for unfold effect */
@keyframes unfoldAnimation {
  0% {
    transform: translateY(20px) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.contact-methods.active .contact-method {
  animation: unfoldAnimation 0.3s ease forwards;
}

/* Accessibility improvements */
.contact-icon-main:focus,
.contact-method:focus {
  outline: 2px solid #005a87;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .contact-icon-main,
  .contact-method {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .contact-icon-main,
  .contact-method,
  .contact-methods,
  .chat-icon,
  .method-icon {
    transition: none;
    animation: none;
  }

  .contact-icon-main:hover,
  .contact-method:hover {
    transform: none;
  }
}
