/* ============================================
   slap-map.css — Slap Map view
   ============================================ */

/* Overflow backstop — prevents any child from causing horizontal page scroll */
#slap-map-mapbox {
  overflow-x: hidden;
}

/* Search button injected into #mobile-header when Slap Map is active */
.slap-map-header-search-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6D28D9;
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
}

/* ========== STICKER SELECTION MODAL ========== */

.slap-map-sticker-modal {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 80vh;
  min-height: 60vh;
  width: auto;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.slap-map-sticker-modal .slap-map-drawer-header {
  flex-shrink: 0;
}

.slap-map-sticker-modal .slap-map-sticker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.slap-map-sticker-modal .slap-map-drawer-footer {
  flex-shrink: 0;
}

/* ========== SLAP FLOW ========== */

.slap-map-slap-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #6D28D9;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(109, 40, 217, 0.4);
}

.slap-map-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
}

.slap-map-sticker-drawer {
  width: 100%;
  max-height: 70vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slap-map-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.slap-map-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px;
  overflow-y: auto;
  flex: 1;
}

.slap-map-sticker-grid img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  object-fit: contain;
}

.slap-map-sticker-grid img.selected {
  outline: 3px solid #6D28D9;
}

.slap-map-drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 24px;
  flex-shrink: 0;
}

.slap-map-anon-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.slap-map-anon-pill {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(109, 40, 217, 0.15);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.slap-map-anon-pill.active {
  background: #6D28D9;
}

.slap-map-anon-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: left 0.2s;
}

.slap-map-anon-pill.active .slap-map-anon-knob {
  left: 16px;
}

.slap-map-confirm-btn {
  height: 40px;
  padding: 0 28px;
  border-radius: 999px;
  background: #6D28D9;
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  pointer-events: none;
}

.slap-map-confirm-btn.active {
  opacity: 1;
  pointer-events: auto;
}

.slap-map-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slap-map-confirm-modal-inner {
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 24px;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.slap-map-confirm-modal-inner img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.slap-map-confirm-modal-inner p {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: center;
  margin: 0;
}

.slap-map-confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.slap-map-confirm-cancel {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.slap-map-confirm-slap {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  background: #6D28D9;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  cursor: pointer;
}

/* ========== STICKER DETAIL SLAPPER ========== */

.sticker-detail-slapper {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 12px;
}

.sticker-detail-slapper-handle {
  color: var(--color-purple);
  font-weight: 700;
}

/* ========== CONTROLS RAIL ========== */

/* Create Spot is mobile-only; hidden on desktop */
#slap-map-create-btn {
  display: none;
}

.slap-map-controls-rail {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  gap: 12px;
  z-index: 10;
}

.slap-map-ctrl-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6D28D9;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.slap-map-ctrl-btn:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.slap-map-ctrl-btn.active {
  background: #6D28D9;
  color: #ffffff;
  border-color: #6D28D9;
}

.slap-map-ctrl-pill {
  position: absolute;
  bottom: 100%;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  min-width: 120px;
  overflow: hidden;
  z-index: 20;
}

.slap-map-ctrl-pill-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--font-display, 'Poppins', sans-serif);
  color: #18181b;
  cursor: pointer;
  gap: 12px;
}

.slap-map-ctrl-pill-option:hover {
  background: #f4f4f5;
}

.slap-map-ctrl-pill-option.selected {
  color: #6D28D9;
  font-weight: 600;
}

.slap-map-ctrl-pill-check {
  display: flex;
  align-items: center;
  width: 14px;
  flex-shrink: 0;
}

.slap-map-rotate-hint {
  position: absolute;
  bottom: 36px;
  right: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  color: #71717a;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* ========== SEARCH OVERLAY ========== */

.slap-map-search-overlay {
  position: absolute;
  bottom: 116px;
  top: auto;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slap-map-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-display, 'Poppins', sans-serif);
  outline: none;
  color: #18181b;
}

.slap-map-search-results {
  display: flex;
  flex-direction: column-reverse;
  border-bottom: 1px solid #f4f4f5;
  border-top: none;
  order: -1;
}

.slap-map-search-result {
  padding: 10px 16px;
  cursor: pointer;
}

.slap-map-search-result:hover {
  background: #f4f4f5;
}

.slap-map-search-result__name {
  font-size: 14px;
  font-weight: 500;
  color: #18181b;
  font-family: var(--font-display, 'Poppins', sans-serif);
}

.slap-map-search-result__place {
  font-size: 12px;
  color: #71717a;
  font-family: var(--font-display, 'Poppins', sans-serif);
  margin-top: 1px;
}

/* ========== OVERLAY BACKDROP ========== */

.slap-map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== CARD — DESKTOP CENTERED MODAL ========== */

.slap-map-card {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 80vh;
  min-height: 60vh;
  width: auto;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: #6D28D9;
}

/* ========== CARD — MOBILE BOTTOM SHEET ========== */

.slap-map-card--mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 75vh;
  aspect-ratio: unset;
  max-height: none;
  border-radius: 20px 20px 0 0;
}

/* ========== DARK TINT LAYER ========== */

.slap-map-card__inner {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 0;
}

/* ========== HEADER ========== */

.slap-map-card__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px;
  flex-shrink: 0;
}

.slap-map-card__header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.slap-map-card__name {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.slap-map-card__creator {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.slap-map-card__header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  margin-left: 12px;
}

.slap-map-card__slap-count {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  text-align: right;
}

.slap-map-card__last-slap {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
}

/* ========== STICKER WALL ========== */

.slap-map-card__wall {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
}

.slap-map-card__loading,
.slap-map-card__empty {
  text-align: center;
  padding: 32px 16px;
  font-size: 14px;
  color: #ffffff;
  font-family: var(--font-display, 'Poppins', sans-serif);
}

/* ========== STICKER GRID ========== */

.slap-map-wall-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
}

.slap-map-wall-cell {
  display: flex;
}

.slap-map-wall-cell__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.slap-map-wall-cell__img:hover {
  opacity: 0.85;
}

/* ========== PROFILE MODAL OVERRIDES ========== */

.slap-map-profile-modal .profile-view-shell {
  grid-template-columns: 1fr 380px;
  min-height: 0;
}

.slap-map-profile-modal .profile-info-col {
  position: relative;
  top: auto;
  height: auto;
  width: 100%;
  overflow-y: visible;
}

.slap-map-profile-modal .profile-grid-col {
  height: auto;
  overflow-y: visible;
}

.slap-map-profile-modal .profile-pages-grid {
  grid-template-columns: repeat(3, 1fr);
}

.slap-map-profile-modal .profile-page-overlay {
  display: none;
}

.slap-map-profile-modal .profile-sticker-tile,
.slap-map-profile-modal .profile-sticker-card {
  background: none;
  background-color: transparent;
}

.slap-map-profile-modal #profile-btn-message {
  display: none;
}

#global-sticker-detail-panel .shop-cta-btn {
  width: auto;
  min-width: 160px;
  max-width: 280px;
  align-self: center;
}

/* ============================================
   Mobile — rail switches to vertical right side
   ============================================ */
@media (max-width: 767px) {
  .slap-map-controls-rail {
    flex-direction: column;
    bottom: auto;
    top: 50%;
    left: auto;
    right: 12px;
    transform: translateY(-50%);
    gap: 10px;
  }

  .slap-map-rotate-hint {
    display: none;
  }

  /* Hide rotate buttons — desktop (≥768px) still shows all 6 */
  .slap-map-controls-rail .slap-map-ctrl-btn[title="Rotate left"],
  .slap-map-controls-rail .slap-map-ctrl-btn[title="Rotate right"] {
    display: none;
  }

  /* Hide rail Search button — replaced by header Search on mobile */
  .slap-map-controls-rail .slap-map-ctrl-btn[title="Search locations"] {
    display: none;
  }

  /* Show Create Spot on mobile */
  #slap-map-create-btn {
    display: flex;
  }

  /* Shrink buttons to match native app (44×44px, 22px icon) */
  .slap-map-ctrl-btn {
    width: 44px;
    height: 44px;
  }

  .slap-map-ctrl-btn svg {
    width: 22px;
    height: 22px;
  }

  /* Dock search overlay directly below #mobile-header.
     #mobile-header is: padding-top:env(safe-area-inset-top,0px) + height:44px = calc(44px + env(safe-area-inset-top,0px)) */
  .slap-map-search-overlay {
    bottom: auto;
    top: calc(44px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    transform: none;
    border-radius: 0 0 12px 12px;
    box-sizing: border-box;
    z-index: 99;
  }

  /* Input: full-width, cannot overflow */
  .slap-map-search-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Results grow downward on mobile (input at top, results below) */
  .slap-map-search-overlay .slap-map-search-results {
    order: 1;
    flex-direction: column;
    border-top: 1px solid #f4f4f5;
    border-bottom: none;
  }
}
