/**
 * PF-195: Reusable Smart Consultation Popup Styles
 * Responsive, accessible, and high-contrast design
 */

.pf-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 11, 15, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
}

.pf-popup-overlay:not([hidden]),
.pf-popup-overlay.pf-popup-open {
  opacity: 1;
  visibility: visible;
}

.pf-popup-dialog {
  position: relative;
  width: 100%;
  max-width: 530px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(45, 12, 28, 0.28), 0 4px 14px rgba(0, 0, 0, 0.12);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.pf-popup-overlay.pf-popup-open .pf-popup-dialog {
  transform: scale(1) translateY(0);
}

.pf-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #333333;
  font-size: 24px;
  line-height: 1;
  font-family: inherit;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.pf-popup-close:hover,
.pf-popup-close:focus-visible {
  background-color: #982B56;
  color: #ffffff;
  transform: rotate(90deg);
  outline: 2px solid #982B56;
  outline-offset: 2px;
}

.pf-popup-image {
  width: 100%;
  position: relative;
  aspect-ratio: 2 / 1;
  background: #FAF7F5;
  overflow: hidden;
  flex-shrink: 0;
}

.pf-popup-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pf-popup-content {
  padding: 22px 28px 24px;
  text-align: center;
  overflow-y: auto;
  box-sizing: border-box;
}

.pf-popup-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #3A1827;
  margin: 0 0 6px 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.pf-popup-dynamic-topic {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #982B56;
  margin: 0 0 10px 0;
  line-height: 1.35;
  min-height: 1.35em;
}

.pf-popup-description {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.92rem;
  color: #555555;
  line-height: 1.48;
  margin: 0 0 12px 0;
}

.pf-popup-doctor-message {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.92rem;
  color: #2A2528;
  margin: 0 0 18px 0;
  font-weight: 500;
}

.pf-popup-doctor-message .pf-doctor-name {
  color: #982B56;
  font-weight: 700;
}

.pf-popup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: stretch;
}

.pf-popup-call,
.pf-popup-whatsapp {
  flex: 1;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 10px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
  text-align: center;
}

.pf-popup-btn-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.pf-popup-call {
  background: #982B56;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(152, 43, 86, 0.22);
}

.pf-popup-call:hover,
.pf-popup-call:focus-visible {
  background: #801E43;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(152, 43, 86, 0.32);
  outline: 2px solid #801E43;
  outline-offset: 2px;
}

.pf-popup-whatsapp {
  background: #25D366;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.22);
}

.pf-popup-whatsapp:hover,
.pf-popup-whatsapp:focus-visible {
  background: #1EBE5D;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.32);
  outline: 2px solid #1EBE5D;
  outline-offset: 2px;
}

body.pf-popup-active {
  overflow: hidden;
}

@media (max-width: 600px) {
  .pf-popup-dialog {
    max-width: 100%;
    border-radius: 14px;
    margin: auto 0;
  }

  .pf-popup-content {
    padding: 18px 18px 20px;
  }

  .pf-popup-heading {
    font-size: 1.35rem;
  }

  .pf-popup-dynamic-topic {
    font-size: 0.98rem;
  }

  .pf-popup-description {
    font-size: 0.88rem;
    margin-bottom: 10px;
  }

  .pf-popup-doctor-message {
    font-size: 0.88rem;
    margin-bottom: 16px;
  }

  .pf-popup-actions {
    flex-direction: column;
    gap: 10px;
  }

  .pf-popup-call,
  .pf-popup-whatsapp {
    width: 100%;
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-popup-overlay,
  .pf-popup-dialog,
  .pf-popup-close,
  .pf-popup-call,
  .pf-popup-whatsapp {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}
