/* ELIMED - Enhanced WhatsApp Widget Styles */

/* =============== WHATSAPP WIDGET BASE =============== */
.whatsapp-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: var(--font-primary, "Inter", sans-serif);

  /* Initial state - hidden */
  opacity: 0;
  visibility: hidden;
  transform: translateY(100px) scale(0.8);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.whatsapp-widget--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.whatsapp-widget--loaded {
  /* Add any loaded state styles here */
}

/* =============== WIDGET CONTAINER =============== */
.whatsapp-widget__container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* =============== MAIN BUTTON =============== */
.whatsapp-widget__button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  font-size: 14px;
  min-height: 56px;
  overflow: hidden;
}

.whatsapp-widget__button:hover {
  background: linear-gradient(135deg, #128c7e 0%, #075e54 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(37, 211, 102, 0.4);
}

.whatsapp-widget__button:active {
  transform: translateY(-1px) scale(1.02);
}

.whatsapp-widget__button:focus {
  outline: none;
  box-shadow:
    0 8px 25px rgba(37, 211, 102, 0.3),
    0 0 0 3px rgba(37, 211, 102, 0.2);
}

/* =============== BUTTON ICON =============== */
.whatsapp-widget__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.whatsapp-widget__icon i {
  font-size: 24px;
  transition: transform 0.3s ease;
}

.whatsapp-widget__button:hover .whatsapp-widget__icon i {
  transform: scale(1.1) rotate(5deg);
}

/* =============== BUTTON TEXT =============== */
.whatsapp-widget__text {
  white-space: nowrap;
  transition: all 0.3s ease;
  max-width: 150px;
  overflow: hidden;
}

/* =============== PULSE ANIMATION =============== */
.whatsapp-widget__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50px;
  background: rgba(37, 211, 102, 0.3);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  pointer-events: none;
  transition: all 0.6s ease;
}

.whatsapp-widget__pulse--active {
  transform: translate(-50%, -50%) scale(1.4);
  opacity: 1;
  animation: whatsapp-pulse 1.5s ease-out;
}

@keyframes whatsapp-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.7;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/* =============== OPTIONS PANEL =============== */
.whatsapp-widget__options {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;

  /* Initial state - hidden */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Prevent interaction when hidden */
  pointer-events: none;
}

.whatsapp-widget--expanded .whatsapp-widget__options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* =============== OPTIONS HEADER =============== */
.whatsapp-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
}

.whatsapp-widget__header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.whatsapp-widget__close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.whatsapp-widget__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.whatsapp-widget__close:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
}

/* =============== CONTACTS LIST =============== */
.whatsapp-widget__contacts {
  padding: 8px 0;
}

.whatsapp-widget__contact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.whatsapp-widget__contact:last-child {
  border-bottom: none;
}

.whatsapp-widget__contact:hover {
  background: #f8f9fa;
  transform: translateX(4px);
}

.whatsapp-widget__contact:focus {
  outline: none;
  background: #e8f5e8;
  box-shadow: inset 3px 0 0 #25d366;
}

/* =============== CONTACT ICON =============== */
.whatsapp-widget__contact-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.whatsapp-widget__contact-icon i {
  font-size: 18px;
}

/* =============== CONTACT INFO =============== */
.whatsapp-widget__contact-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.whatsapp-widget__contact-number {
  font-weight: 600;
  color: #2c3e50;
  font-size: 15px;
}

.whatsapp-widget__contact-label {
  font-size: 13px;
  color: #7f8c8d;
}

/* =============== CONTACT ARROW =============== */
.whatsapp-widget__contact-arrow {
  color: #bdc3c7;
  transition: all 0.2s ease;
}

.whatsapp-widget__contact:hover .whatsapp-widget__contact-arrow {
  color: #25d366;
  transform: translateX(2px);
}

/* =============== OPTIONS FOOTER =============== */
.whatsapp-widget__footer {
  padding: 16px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.whatsapp-widget__note {
  margin: 0;
  font-size: 12px;
  color: #6c757d;
  display: flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-widget__note i {
  color: #25d366;
}

/* =============== RESPONSIVE DESIGN =============== */

/* Tablet */
@media (max-width: 768px) {
  .whatsapp-widget {
    bottom: 16px;
    right: 16px;
  }

  .whatsapp-widget__options {
    width: 280px;
    bottom: 65px;
  }

  .whatsapp-widget__text {
    display: none;
  }

  .whatsapp-widget__button {
    padding: 16px;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    justify-content: center;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .whatsapp-widget {
    bottom: 20px;
    right: 20px;
  }

  .whatsapp-widget__options {
    width: calc(100vw - 40px);
    max-width: 300px;
    right: 0;
  }

  .whatsapp-widget__button {
    width: 60px;
    height: 60px;
  }

  .whatsapp-widget__icon i {
    font-size: 26px;
  }
}

/* =============== ACCESSIBILITY ENHANCEMENTS =============== */

/* High contrast mode */
@media (prefers-contrast: high) {
  .whatsapp-widget__button {
    border: 2px solid #000;
  }

  .whatsapp-widget__options {
    border: 2px solid #000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .whatsapp-widget,
  .whatsapp-widget__button,
  .whatsapp-widget__options,
  .whatsapp-widget__contact,
  .whatsapp-widget__pulse {
    transition: none !important;
    animation: none !important;
  }

  .whatsapp-widget__pulse--active {
    display: none;
  }
}

/* Focus visible for keyboard navigation */
@supports selector(:focus-visible) {
  .whatsapp-widget__button:focus:not(:focus-visible),
  .whatsapp-widget__close:focus:not(:focus-visible),
  .whatsapp-widget__contact:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
  }
}

/* =============== DARK MODE SUPPORT =============== */
/* Note: Keeping light theme for WhatsApp widget to match medical website design */
@media (prefers-color-scheme: dark) {
  .whatsapp-widget__options {
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--gray);
  }

  .whatsapp-widget__contact {
    border-bottom-color: var(--gray);
  }

  .whatsapp-widget__contact:hover {
    background: var(--light-gray);
  }

  .whatsapp-widget__contact:focus {
    background: var(--light-green);
  }

  .whatsapp-widget__contact-number {
    color: var(--text-dark);
  }

  .whatsapp-widget__contact-label {
    color: #bdc3c7;
  }

  .whatsapp-widget__footer {
    background: #34495e;
    border-top-color: #4a5f7a;
  }

  .whatsapp-widget__note {
    color: #95a5a6;
  }
}

/* =============== ANIMATION KEYFRAMES =============== */
@keyframes whatsapp-bounce-in {
  0% {
    opacity: 0;
    transform: translateY(100px) scale(0.3);
  }
  50% {
    opacity: 1;
    transform: translateY(-10px) scale(1.05);
  }
  70% {
    transform: translateY(5px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes whatsapp-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(2px);
  }
}

/* =============== LOADING STATES =============== */
.whatsapp-widget--loading .whatsapp-widget__button {
  pointer-events: none;
}

.whatsapp-widget--loading .whatsapp-widget__icon i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* =============== ERROR STATES =============== */
.whatsapp-widget--error .whatsapp-widget__button {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  animation: whatsapp-shake 0.5s ease-in-out;
}

/* =============== SUCCESS STATES =============== */
.whatsapp-widget--success .whatsapp-widget__button {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.whatsapp-widget--success .whatsapp-widget__icon i::before {
  content: "\f00c"; /* FontAwesome check icon */
}
