/**
 * VamsiDev — Professional WhatsApp Integration Styles
 * Reusable across Studio, Professional, and Current themes.
 * Complies with WCAG AAA contrast, touch target guidelines, and reduced motion.
 */

:root {
  --wa-green: #25d366;
  --wa-green-hover: #20ba59;
  --wa-green-dark: #128c7e;
  --wa-green-tint: rgba(37, 211, 102, 0.12);
  --wa-green-tint-hover: rgba(37, 211, 102, 0.22);
  --wa-green-border: rgba(37, 211, 102, 0.35);
  --wa-green-glow: rgba(37, 211, 102, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   1. FLOATING WHATSAPP BUTTON (Fixed Bottom-Right)
───────────────────────────────────────────────────────────────────────────── */
.floating-whatsapp-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90; /* Below drawer backdrop (100) to ensure drawers overlay properly */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.floating-whatsapp-btn {
  position: relative;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #1da851 100%);
  color: #ffffff !important;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s ease,
              background 0.25s ease;
  animation: waEntrance 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s backwards;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.floating-whatsapp-svg {
  width: 30px;
  height: 30px;
  fill: #ffffff;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-whatsapp-btn:hover {
  transform: translateY(-3px) scale(1.06);
  background: linear-gradient(135deg, #2ae06d 0%, #20ba59 100%);
  box-shadow: 0 8px 26px rgba(37, 211, 102, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.floating-whatsapp-btn:hover .floating-whatsapp-svg {
  transform: scale(1.08);
}

.floating-whatsapp-btn:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.4);
}

.floating-whatsapp-btn:focus-visible {
  outline: 3px solid #25d366;
  outline-offset: 3px;
}

/* Subtle gentle ping ring */
.floating-whatsapp-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, 0.6);
  pointer-events: none;
  animation: waPulse 3s infinite;
}

/* Hover Tooltip (Desktop) */
.floating-whatsapp-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: rgba(13, 18, 27, 0.96);
  color: #f8fafc;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.floating-whatsapp-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5px;
  transform: translateY(-50%);
  border-width: 5px 0 5px 5px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(13, 18, 27, 0.96);
}

.floating-whatsapp-btn:hover .floating-whatsapp-tooltip,
.floating-whatsapp-btn:focus-visible .floating-whatsapp-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. HERO SECTION WHATSAPP BUTTON
───────────────────────────────────────────────────────────────────────────── */
.btn-whatsapp-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--wa-green-tint);
  color: #25d366 !important;
  border: 1px solid var(--wa-green-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-whatsapp-hero i,
.btn-whatsapp-hero svg {
  font-size: 1.15em;
  color: #25d366;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.btn-whatsapp-hero:hover {
  background: var(--wa-green-tint-hover);
  border-color: var(--wa-green);
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.28);
}

.btn-whatsapp-hero:hover i,
.btn-whatsapp-hero:hover svg {
  transform: scale(1.12);
  color: #ffffff;
}

.btn-whatsapp-hero:active {
  transform: scale(0.985);
}

.btn-whatsapp-hero:focus-visible {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. PROJECTS PAGE / SECTION SUBTLE WHATSAPP CTA
───────────────────────────────────────────────────────────────────────────── */
.whatsapp-project-cta {
  margin-top: 36px;
  padding: 24px 28px;
  background: linear-gradient(135deg, rgba(16, 24, 38, 0.8) 0%, rgba(13, 20, 32, 0.95) 100%);
  border: 1px solid rgba(37, 211, 102, 0.22);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.whatsapp-project-cta:hover {
  border-color: rgba(37, 211, 102, 0.4);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45), 0 0 20px rgba(37, 211, 102, 0.1);
}

.whatsapp-project-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.whatsapp-project-cta-content {
  flex: 1 1 380px;
}

.whatsapp-project-cta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 211, 102, 0.12);
  color: #25d366;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.whatsapp-project-cta-badge i,
.whatsapp-project-cta-badge svg {
  font-size: 0.95em;
  fill: currentColor;
}

.whatsapp-project-cta-title {
  margin: 0 0 6px 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.35;
}

.whatsapp-project-cta-desc {
  margin: 0;
  font-size: 0.885rem;
  color: #94a3b8;
  line-height: 1.55;
  max-width: 620px;
}

.whatsapp-project-cta-action {
  flex-shrink: 0;
}

.btn-whatsapp-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #25d366 0%, #1ea952 100%);
  color: #ffffff !important;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-whatsapp-cta i,
.btn-whatsapp-cta svg {
  font-size: 1.15em;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.btn-whatsapp-cta:hover {
  background: linear-gradient(135deg, #2ae06d 0%, #20ba59 100%);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.5);
}

.btn-whatsapp-cta:hover i,
.btn-whatsapp-cta:hover svg {
  transform: scale(1.1);
}

.btn-whatsapp-cta:active {
  transform: scale(0.985);
}

.btn-whatsapp-cta:focus-visible {
  outline: 3px solid #25d366;
  outline-offset: 3px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. CONTACT SECTION DIRECT OPTION
───────────────────────────────────────────────────────────────────────────── */
.contact-info-item-whatsapp:hover {
  border-color: rgba(37, 211, 102, 0.45) !important;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.15);
}

.contact-icon-whatsapp {
  background: rgba(37, 211, 102, 0.12) !important;
  color: #25d366 !important;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.contact-icon-whatsapp i,
.contact-icon-whatsapp svg {
  color: #25d366;
  fill: currentColor;
}

.contact-info-item-whatsapp:hover .contact-icon-whatsapp {
  background: #25d366 !important;
  color: #ffffff !important;
  border-color: #25d366;
}

.contact-info-item-whatsapp:hover .contact-icon-whatsapp i,
.contact-info-item-whatsapp:hover .contact-icon-whatsapp svg {
  color: #ffffff !important;
}

/* Professional theme contact item overrides */
.prof-contact-item-whatsapp:hover {
  border-color: rgba(37, 211, 102, 0.45) !important;
}
.prof-contact-icon-whatsapp {
  background: rgba(37, 211, 102, 0.12) !important;
  color: #25d366 !important;
}
.prof-contact-item-whatsapp:hover .prof-contact-icon-whatsapp {
  background: #25d366 !important;
  color: #ffffff !important;
}

.contact-info-item-whatsapp .contact-value,
.prof-contact-item-whatsapp .prof-contact-val {
  color: #25d366 !important;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.contact-info-item-whatsapp:hover .contact-value,
.prof-contact-item-whatsapp:hover .prof-contact-val {
  color: #ffffff !important;
  transform: translateX(3px);
}

/* Current theme direct WhatsApp link */
.cal-direct-whatsapp {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.whatsapp-link {
  color: #25d366 !important;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.whatsapp-link:hover {
  color: #ffffff !important;
  text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────────────────────
   5. KEYFRAME ANIMATIONS & REDUCED MOTION
───────────────────────────────────────────────────────────────────────────── */
@keyframes waEntrance {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes waPulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.22);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-whatsapp-btn,
  .floating-whatsapp-pulse,
  .btn-whatsapp-hero,
  .btn-whatsapp-cta,
  .floating-whatsapp-tooltip {
    animation: none !important;
    transition: none !important;
  }
  .floating-whatsapp-btn:hover {
    transform: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. RESPONSIVE DESIGN (Avoiding Mobile Bottom Nav collision)
───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  /*
   * Crucial: On mobile, the studio theme has a fixed bottom navigation bar
   * (height ~60px + safe-area-inset-bottom).
   * Position the floating button cleanly ABOVE it so it never overlaps!
   */
  .floating-whatsapp-container {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
    right: 14px;
  }

  .floating-whatsapp-btn {
    width: 48px;
    height: 48px;
  }

  .floating-whatsapp-svg {
    width: 26px;
    height: 26px;
  }

  /* Don't show tooltip on touch screens */
  .floating-whatsapp-tooltip {
    display: none !important;
  }

  .whatsapp-project-cta {
    padding: 20px 18px;
    margin-top: 24px;
  }

  .whatsapp-project-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .whatsapp-project-cta-action {
    width: 100%;
  }

  .btn-whatsapp-cta {
    width: 100%;
    justify-content: center;
  }

  .btn-whatsapp-hero {
    width: 100%;
    justify-content: center;
  }
}
