/* =============================================================================
   CAYA Share Sheet — Unified share bottom-sheet for all surfaces
   White card, slides up from bottom on mobile, centred modal on desktop.
   ============================================================================= */

/* ── Backdrop ────────────────────────────────────────────────────────────── */
#caya-share-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .22s ease;
}
#caya-share-backdrop.is-open {
  display: block;
  opacity: 1;
}

/* ── Sheet ───────────────────────────────────────────────────────────────── */
#caya-share-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9001;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  box-shadow: 0 -4px 40px rgba(0,0,0,.15);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#caya-share-sheet::-webkit-scrollbar { display: none; }
#caya-share-sheet.is-open {
  display: block;
  transform: translateY(0);
}

/* ── Drag handle ─────────────────────────────────────────────────────────── */
.caya-share__handle {
  width: 40px;
  height: 4px;
  background: #e0e0e6;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.caya-share__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid #f0f0f4;
}
.caya-share__title {
  font-size: .9375rem;
  font-weight: 700;
  color: #1a1a2e;
}
.caya-share__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f4f5f7;
  border: none;
  color: #555;
  cursor: pointer;
  transition: background .15s, color .15s;
  min-height: unset;
  min-width: unset;
  padding: 0;
  flex-shrink: 0;
}
.caya-share__close:hover { background: #e8e8ec; color: #1a1a2e; }

/* ── URL strip ───────────────────────────────────────────────────────────── */
.caya-share__url-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 18px;
  padding: 9px 12px;
  background: #f8f9fb;
  border: 1.5px solid #e8e8ec;
  border-radius: 10px;
  min-height: 40px;
}
.caya-share__url-text {
  flex: 1;
  font-size: .78rem;
  color: #777;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}
.caya-share__url-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(99,102,241,.1);
  border: none;
  color: #6366f1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  min-height: unset;
  min-width: unset;
  padding: 0;
}
.caya-share__url-copy:hover { background: rgba(99,102,241,.18); transform: scale(1.08); }
.caya-share__url-copy:active { transform: scale(0.94); }

/* ── Option grid ─────────────────────────────────────────────────────────── */
.caya-share__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 4px;
  padding: 8px 14px 20px;
}

.caya-share__opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s, transform .1s;
  min-height: unset;
  min-width: unset;
  -webkit-tap-highlight-color: transparent;
}
.caya-share__opt:hover { background: #f4f5f7; transform: scale(1.04); }
.caya-share__opt:active { transform: scale(0.95); }

.caya-share__opt-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  transition: transform .12s;
}
.caya-share__opt:hover .caya-share__opt-icon { transform: scale(1.06); }

.caya-share__opt-label {
  font-size: .72rem;
  font-weight: 600;
  color: #444;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#caya-share-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a1a2e;
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 999px;
  z-index: 9010;
  pointer-events: none;
  opacity: 0;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
#caya-share-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Desktop — centred modal instead of bottom sheet ─────────────────────── */
@media (min-width: 640px) {
  #caya-share-sheet {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, calc(-50% + 20px));
    width: 380px;
    max-width: calc(100vw - 32px);
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    max-height: 80vh;
  }
  #caya-share-sheet.is-open {
    transform: translate(-50%, -50%);
  }
  .caya-share__handle { display: none; }
  .caya-share__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
