/* Popup Overlay */
.share-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1040;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* animation state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.3s ease,
    visibility 0s linear 0.3s;
}

/* visible state */
.share-popup-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transition:
    opacity 0.3s ease,
    visibility 0s linear 0s;
}

/* Popup Container */
.share-popup-container {
  background: #ffffff;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);

  transform: scale(0.9) translateY(20px);
  opacity: 0;

  transition:
    transform 0.3s cubic-bezier(.22, 1, .36, 1),
    opacity 0.25s ease;
}

/* animate when open */
.share-popup-overlay.active .share-popup-container {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Header */
.share-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid #e5e7eb;
}

.share-popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.share-popup-close {
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.share-popup-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Content */
.share-popup-content {
  padding: 28px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

/* Share Preview */
.share-preview {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 24px;
}

.share-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.share-preview-text h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.share-preview-text p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
  line-height: 1.5;
}

/* Share Buttons Grid */
.share-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.share-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  text-decoration: none;
  color: #bad81a;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.share-button span {
  color: #000000;
}

.share-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-button:hover span {
  color: #fff;
}

.share-button svg {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease;
}

.share-button:hover svg {
  transform: scale(1.1);
}

/* Individual Platform Colors */
.share-facebook {
  border-color: #1877f2;
}

.share-facebook:hover {
  background: #1877f2;
  color: #ffffff;
  border-color: #1877f2;
}

.share-twitter {
  border-color: #000000;
}

.share-twitter:hover {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

.share-linkedin {
  border-color: #0a66c2;
}

.share-linkedin:hover {
  background: #0a66c2;
  color: #ffffff;
  border-color: #0a66c2;
}

.share-whatsapp {
  border-color: #25d366;
}

.share-whatsapp:hover {
  background: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.share-pinterest {
  border-color: #e60023;
}

.share-pinterest:hover {
  background: #e60023;
  color: #ffffff;
  border-color: #e60023;
}

.share-telegram {
  border-color: #0088cc;
}

.share-telegram:hover {
  background: #0088cc;
  color: #ffffff;
  border-color: #0088cc;
}

.share-email {
  border-color: #ea4335;
}

.share-email:hover {
  background: #ea4335;
  color: #ffffff;
  border-color: #ea4335;
}

.share-copy {
  border-color: #6b7280;
}

.share-copy:hover {
  background: #6b7280;
  color: #ffffff;
  border-color: #6b7280;
}

.share-copy.copied {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

/* Responsive Design */
@media (max-width: 768px) {
  .share-popup-container {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }

  .share-popup-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .share-buttons-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .share-button {
    padding: 16px 12px;
    gap: 8px;
  }

  .share-button svg {
    width: 24px;
    height: 24px;
  }

  .share-preview {
    flex-direction: column;
  }

  .share-preview img {
    width: 100%;
    height: 160px;
  }
}

@media (max-width: 480px) {
  .share-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .share-popup-header {
    padding: 20px;
  }

  .share-popup-content {
    padding: 20px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

  .share-popup-overlay,
  .share-popup-container,
  .share-button,
  .directory-share-trigger {
    transition: none;
  }
}
