/**
 * Reusable "Share this listing" modal — not page-specific. Currently included
 * on the digital product detail page; safe to reuse on any other buyer-detail
 * page that includes views/components/buyer/share-modal.php.
 *
 * Class names consumed by public/js/share-modal.js are load-bearing:
 *   [data-share-modal] [data-share-open] [data-share-close] [data-share-copy]
 *   [data-share-native] [data-share-member-search] [data-share-member-results]
 *   [data-share-member-status]
 */

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 17, 17, 0.55);
  padding: var(--space-4, 16px);
}

.share-modal[hidden] {
  display: none;
}

.share-modal__panel {
  background: #fff;
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 380px;
  padding: var(--space-5, 24px);
  max-height: 88vh;
  overflow-y: auto;
}

.share-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-4, 16px);
}

.share-modal__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text, #333);
}

.share-modal__close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted, #6c6c6c);
  padding: 0.2rem 0.4rem;
}

.share-modal__close:hover,
.share-modal__close:focus-visible {
  color: var(--color-text, #333);
}

.share-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2, 8px);
}

/* [hidden] must win over the flex display below (equal specificity, later rule
   would otherwise take over) — the "More" native-share option starts hidden and
   is only unhidden by JS when navigator.share actually exists. */
.share-modal__option[hidden] {
  display: none;
}

.share-modal__option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-border, #d0d0d0);
  border-radius: var(--radius-sm, 8px);
  background: #fff;
  color: var(--color-text, #333);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.share-modal__option:hover,
.share-modal__option:focus-visible {
  border-color: var(--color-primary, #8c0605);
  background: var(--color-primary-light, #fae6e7);
}

.share-modal__option i {
  width: 1.1em;
  text-align: center;
  color: var(--color-text-muted, #6c6c6c);
}

.share-modal__member {
  margin-top: var(--space-4, 16px);
  padding-top: var(--space-4, 16px);
  border-top: 1px solid #f2f2f2;
}

.share-modal__member-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted, #6c6c6c);
  margin-bottom: var(--space-2, 8px);
}

.share-modal__member-results {
  list-style: none;
  margin: var(--space-2, 8px) 0 0;
  padding: 0;
  border: 1px solid var(--color-border, #ececec);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
}

.share-modal__member-results:empty {
  display: none;
}

.share-modal__member-result {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-bottom: 1px solid #f2f2f2;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-size: var(--font-size-sm, 0.875rem);
}

.share-modal__member-result:last-child {
  border-bottom: 0;
}

.share-modal__member-result:hover,
.share-modal__member-result:focus-visible {
  background: var(--color-primary-light, #fae6e7);
}

.share-modal__member-status {
  margin: var(--space-2, 8px) 0 0;
}

@media (max-width: 480px) {
  .share-modal__grid {
    grid-template-columns: 1fr;
  }
}
