/* ═══════════════════════════════════════════════════════════
   Share Picker — in-app share modal for events
   ═══════════════════════════════════════════════════════════ */

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.sp-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sp-modal {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  background: var(--surface, #1a1d24);
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
  overflow: hidden;
}

.sp-overlay.open .sp-modal {
  transform: translateY(0);
}

/* Desktop: center the modal */
@media (min-width: 600px) {
  .sp-overlay {
    align-items: center;
  }
  .sp-modal {
    border-radius: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    max-height: 70vh;
    transform: translateY(20px) scale(.96);
    opacity: 0;
    transition: transform .25s cubic-bezier(.22, 1, .36, 1), opacity .2s ease;
  }
  .sp-overlay.open .sp-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ─── Header ──────────────────────────────────────────── */
.sp-header {
  display: flex;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

.sp-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #fff);
  margin: 0;
}

.sp-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .08);
  color: var(--muted, rgba(255, 255, 255, .5));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}

.sp-close:active {
  background: rgba(255, 255, 255, .15);
}

/* ─── Event preview ───────────────────────────────────── */
.sp-event-preview {
  padding: 10px 16px;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

.sp-ev-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #fff);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-ev-meta {
  font-size: 11px;
  color: var(--muted, rgba(255, 255, 255, .45));
}

/* ─── Search ──────────────────────────────────────────── */
.sp-search-wrap {
  position: relative;
  padding: 10px 16px 6px;
  flex-shrink: 0;
}

.sp-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted, rgba(255, 255, 255, .35));
  pointer-events: none;
}

.sp-search {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
  color: var(--text, #fff);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}

.sp-search::placeholder {
  color: var(--muted, rgba(255, 255, 255, .3));
}

.sp-search:focus {
  border-color: rgba(139, 92, 246, .4);
}

/* ─── Tabs ────────────────────────────────────────────── */
.sp-tabs {
  display: flex;
  padding: 4px 16px;
  gap: 4px;
  flex-shrink: 0;
}

.sp-tab {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted, rgba(255, 255, 255, .45));
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}

.sp-tab.active {
  background: rgba(139, 92, 246, .15);
  color: #a78bfa;
}

.sp-tab:active {
  transform: scale(.97);
}

/* ─── List ────────────────────────────────────────────── */
.sp-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px;
  min-height: 120px;
  max-height: 320px;
}

.sp-loading {
  text-align: center;
  padding: 32px;
  color: var(--muted, rgba(255, 255, 255, .4));
  font-size: 13px;
}

.sp-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted, rgba(255, 255, 255, .35));
  font-size: 13px;
}

/* ─── Row ─────────────────────────────────────────────── */
.sp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
  color: var(--text, #fff);
  font-family: inherit;
}

.sp-row:hover,
.sp-row:active {
  background: rgba(255, 255, 255, .06);
}

.sp-row.sp-sent {
  opacity: .6;
  pointer-events: none;
}

/* Avatar */
.sp-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139, 92, 246, .3), rgba(99, 102, 241, .3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.sp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sp-av-img {
  background: transparent;
}

.sp-av-crew {
  font-size: 18px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}

/* Name + meta */
.sp-row-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-row-meta {
  font-size: 11px;
  color: var(--muted, rgba(255, 255, 255, .35));
  flex-shrink: 0;
}

/* Send action icon */
.sp-row-action {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(139, 92, 246, .12);
  color: #a78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
}

.sp-row:hover .sp-row-action,
.sp-row:active .sp-row-action {
  background: rgba(139, 92, 246, .25);
}

.sp-check {
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
  white-space: nowrap;
}

/* ─── External share buttons ──────────────────────────── */
.sp-external {
  display: flex;
  gap: 8px;
  padding: 10px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

/* Account for iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sp-external {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

.sp-ext-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .04);
  color: var(--text, rgba(255, 255, 255, .7));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}

.sp-ext-btn:active {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
}

/* ─── Add Friends button (empty state) ───────────────────── */
.sp-add-friends-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, rgba(139, 92, 246, .2), rgba(236, 72, 153, .2));
  color: #a78bfa;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.sp-add-friends-btn:active {
  transform: scale(.96);
  background: linear-gradient(135deg, rgba(139, 92, 246, .35), rgba(236, 72, 153, .35));
}

/* ─── Celebration animation ──────────────────────────────── */
.sp-celebrating {
  background: rgba(52, 211, 153, .15) !important;
  transition: background .3s ease;
}

.sp-check-pop {
  animation: spCheckPop .35s cubic-bezier(.22, 1, .36, 1);
  font-size: 13px !important;
  color: #34d399 !important;
}

@keyframes spCheckPop {
  0% { transform: scale(.5); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* Particles */
.sp-particle {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  animation: spParticleBurst .6s cubic-bezier(.22, 1, .36, 1) forwards;
}

@keyframes spParticleBurst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
