/**
 * SwissFans 2.0 — App Layout System (Phase 1C)
 * SFAppShell · SFHeader · SFSidebar · SFBottomNav · SFTopBar
 * SFPageContainer · SFDropdown · SFSearchOverlay · SFLayout
 */

/* ─── Layout tokens ─── */
:root {
  --sf-sidebar-width: 240px;
  --sf-sidebar-width-compact: 72px;
  --sf-header-height: 60px;
  --sf-bottom-nav-height: 68px;
  --sf-page-max-width: 1480px;
  --sf-app-footer-height: 48px;
}

/* ─── SFAppShell ─── */
.sf-app-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--sf-color-void);
  background-image: var(--sf-bg-canvas);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  color: var(--sf-color-text);
}

.sf-app-shell__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Desktop — full sidebar */
@media (min-width: 1200px) {
  .sf-app-shell {
    grid-template-columns: var(--sf-sidebar-width) 1fr;
  }
}

/* Tablet — compact sidebar */
@media (min-width: 768px) and (max-width: 1199px) {
  .sf-app-shell {
    grid-template-columns: var(--sf-sidebar-width-compact) 1fr;
  }
}

/* Mobile — no sidebar, bottom nav */
@media (max-width: 767px) {
  .sf-app-shell {
    grid-template-columns: 1fr;
  }

  .sf-app-shell__main {
    padding-bottom: calc(var(--sf-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }
}

/* ─── SFSidebar ─── */
.sf-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: none;
  flex-direction: column;
  border-right: 1px solid var(--sf-color-border-subtle);
  background: var(--sf-color-surface-1);
  z-index: var(--sf-z-nav);
  overflow: hidden;
}

@media (min-width: 768px) {
  .sf-sidebar {
    display: flex;
  }

  /* Legacy-injected drawer: never show as desktop rail (no app-shell grid). */
  .sf-sidebar.sf-sidebar--drawer,
  .sf-sidebar-backdrop.sf-sidebar-backdrop--drawer {
    display: none !important;
  }
}

/* Mobile: left rail becomes an off-canvas drawer (opened via hamburger). */
@media (max-width: 767px) {
  .sf-sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 300px);
    max-width: 100%;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: calc(var(--sf-z-bottom-nav, 150) + 20);
    border-right: 1px solid rgba(46, 26, 50, 0.95);
    background: #150a16;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  }

  .sf-sidebar.is-open {
    transform: translateX(0);
  }

  body.sf-sidebar-open {
    overflow: hidden;
  }
}

.sf-sidebar-backdrop {
  display: none;
}

@media (max-width: 767px) {
  .sf-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: calc(var(--sf-z-bottom-nav, 150) + 15);
    background: rgba(8, 2, 12, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .sf-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .sf-sidebar-backdrop[hidden] {
    display: none !important;
  }
}

.sf-sidebar__brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sf-space-2);
  min-height: var(--sf-header-height);
  padding-right: var(--sf-space-3);
  border-bottom: 1px solid var(--sf-color-border-subtle);
  flex-shrink: 0;
}

.sf-sidebar__brand-row .sf-sidebar__brand {
  border-bottom: 0;
  flex: 1;
  min-width: 0;
}

.sf-sidebar__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: rgba(46, 26, 50, 0.65);
  color: #f7eef8;
  cursor: pointer;
  flex-shrink: 0;
}

.sf-sidebar__close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

@media (max-width: 767px) {
  .sf-sidebar__close {
    display: inline-flex;
  }
}

@media (min-width: 768px) {
  .sf-sidebar__close {
    display: none !important;
  }
}

.sf-sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  min-height: var(--sf-header-height);
  padding: 0 var(--sf-space-5);
  text-decoration: none;
  color: var(--sf-color-text);
  border-bottom: 1px solid var(--sf-color-border-subtle);
  flex-shrink: 0;
  transition: opacity var(--sf-duration-normal) var(--sf-ease);
}

.sf-sidebar__brand:hover {
  opacity: 0.85;
}

.sf-sidebar__logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.sf-sidebar__wordmark {
  font-size: var(--sf-font-size-md);
  font-weight: var(--sf-font-weight-semibold);
  letter-spacing: var(--sf-letter-tight);
  white-space: nowrap;
  overflow: hidden;
}

@media (min-width: 768px) and (max-width: 1199px) {
  .sf-sidebar__wordmark {
    display: none;
  }

  .sf-sidebar__brand {
    justify-content: center;
    padding: 0 var(--sf-space-3);
  }

  .sf-sidebar__brand-row {
    padding-right: 0;
    justify-content: center;
  }
}

.sf-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sf-space-4) var(--sf-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-1);
}

.sf-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--sf-space-4);
  min-height: var(--sf-touch-min);
  padding: 0 var(--sf-space-4);
  border-radius: var(--sf-radius-md);
  color: var(--sf-color-text-secondary);
  text-decoration: none;
  font-size: var(--sf-font-size-sm);
  font-weight: var(--sf-font-weight-medium);
  transition: background var(--sf-duration-normal) var(--sf-ease),
    color var(--sf-duration-normal) var(--sf-ease),
    transform var(--sf-duration-normal) var(--sf-ease-out);
}

.sf-sidebar__link:hover {
  background: var(--sf-color-glass);
  color: var(--sf-color-text);
}

.sf-sidebar__link.is-active {
  background: var(--sf-color-accent-muted);
  color: var(--sf-color-text);
}

.sf-sidebar__link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sf-sidebar__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 768px) and (max-width: 1199px) {
  .sf-sidebar__link {
    justify-content: center;
    padding: 0;
    gap: 0;
  }

  .sf-sidebar__label {
    display: none;
  }
}

.sf-sidebar__footer {
  padding: var(--sf-space-4) var(--sf-space-3);
  border-top: 1px solid var(--sf-color-border-subtle);
  flex-shrink: 0;
}

@media (min-width: 768px) and (max-width: 1199px) {
  .sf-sidebar__footer .sf-sidebar__link {
    justify-content: center;
  }
}

/* ─── SFHeader / SFTopBar ─── */
.sf-header {
  position: sticky;
  top: 0;
  z-index: calc(var(--sf-z-nav) - 1);
  flex-shrink: 0;
  /* Design-system purple — not near-black (was rgba(5,5,6) and looked broken on profile) */
  background: rgba(21, 10, 22, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(46, 26, 50, 0.9);
}

/* ─── SFMobileSearchBar — eigenes Suchfeld unter der Kopfzeile (Mobile) ─── */
/* Ersetzt das entfernte Such-Icon aus der rechten Icon-Reihe der Kopfzeile.
   Auf Desktop uebernimmt der Sidebar-Eintrag "Suchen" (unter "Home") diese
   Aufgabe, daher hier ab 768px ausgeblendet. */
.sf-mobile-search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: calc(100% - 1.5rem);
  margin: 0.65rem auto;
  padding: 0.65rem 0.9rem;
  border: 0.5px solid var(--sf-color-border, #2e1a32);
  border-radius: var(--sf-radius-full, 9999px);
  background: var(--sf-bg-card, #1c0f1f);
  color: var(--sf-text-muted, #8a7a8d);
  font-family: var(--sf-font-family);
  font-size: var(--sf-font-size-sm, 0.875rem);
  cursor: pointer;
  text-align: left;
}

.sf-mobile-search-bar svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.sf-mobile-search-bar__placeholder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .sf-mobile-search-bar {
    display: none;
  }
}

.sf-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sf-space-4);
  min-height: var(--sf-header-height);
  padding: 0 var(--sf-space-6);
}

@media (max-width: 767px) {
  .sf-top-bar {
    padding: 0 var(--sf-space-4);
  }
}

.sf-top-bar__start {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  min-width: 0;
}

.sf-top-bar__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: #f7eef8;
  cursor: pointer;
  flex-shrink: 0;
}

.sf-top-bar__menu-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.sf-top-bar__menu-btn:hover,
.sf-top-bar__menu-btn:focus-visible {
  background: rgba(46, 26, 50, 0.7);
  outline: none;
}

@media (max-width: 767px) {
  .sf-top-bar__menu-btn {
    display: inline-flex;
  }
}

@media (min-width: 768px) {
  .sf-top-bar__menu-btn {
    display: none !important;
  }
}

.sf-top-bar__title {
  margin: 0;
  font-size: var(--sf-font-size-lg);
  font-weight: var(--sf-font-weight-semibold);
  letter-spacing: var(--sf-letter-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-top-bar__logo-mobile {
  display: none;
  height: 28px;
  width: auto;
}

@media (max-width: 767px) {
  .sf-top-bar__logo-mobile {
    display: block;
  }
}

.sf-top-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--sf-space-2);
  flex-shrink: 0;
}

.sf-top-bar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--sf-radius-md);
  background: transparent;
  color: var(--sf-color-text-secondary);
  cursor: pointer;
  transition: background var(--sf-duration-normal) var(--sf-ease),
    color var(--sf-duration-normal) var(--sf-ease),
    transform var(--sf-duration-normal) var(--sf-ease-out);
}

.sf-top-bar__btn:hover {
  background: var(--sf-color-glass);
  color: var(--sf-color-text);
  transform: scale(var(--sf-scale-hover));
}

.sf-top-bar__btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor !important;
  fill: none !important;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sf-top-bar__btn svg path,
.sf-top-bar__btn svg circle,
.sf-top-bar__btn svg rect {
  fill: none !important;
  stroke: currentColor !important;
}

.sf-top-bar__btn--badge {
  position: relative;
}

.sf-top-bar__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-color-accent);
  border: 2px solid var(--sf-color-void);
}

.sf-top-bar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--sf-color-border-subtle);
}

/* ─── SFTopBar level pill ───
   Static only — intentionally NOT built on .sf-badge-lvl (that component's
   --glow modifier / breathing-glow keyframes are reserved for a user's own
   profile badge, never a contextual header element like this one). No
   transition/animation properties anywhere in this block, by design. */
.sf-top-bar__level {
  display: flex;
  align-items: center;
  gap: var(--sf-space-2);
  height: 40px;
  padding: 0 var(--sf-space-3) 0 0;
  border-radius: 999px;
  background: #1c0f1f;
  border: 1px solid #2e1a32;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color var(--sf-duration-normal, 0.2s) var(--sf-ease, ease),
    background var(--sf-duration-normal, 0.2s) var(--sf-ease, ease),
    transform var(--sf-duration-normal, 0.2s) var(--sf-ease-out, ease);
}

.sf-top-bar__level:hover {
  border-color: rgba(233, 30, 140, 0.45);
  background: #241428;
  transform: scale(var(--sf-scale-hover, 1.02));
}

.sf-top-bar__level:focus-visible {
  outline: 2px solid rgba(233, 30, 140, 0.7);
  outline-offset: 2px;
}

.sf-top-bar__level-circle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px;
  min-height: 26px;
  margin-left: 6px;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #e91e8c, #8b2fc9) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: var(--sf-font-weight-bold, 700);
  line-height: 1;
  flex-shrink: 0;
}

.sf-top-bar__level-name {
  font-size: var(--sf-font-size-sm);
  font-weight: var(--sf-font-weight-medium, 500);
  color: var(--sf-color-text-secondary);
  white-space: nowrap;
}

/* Horizontal space next to Coins/Chat/Glocke is tight below this point —
   keep only the compact gradient circle-with-number, drop the tier name. */
@media (max-width: 900px) {
  .sf-top-bar__level {
    padding-right: 0;
  }

  .sf-top-bar__level-name {
    display: none;
  }
}

/* Mobile header is crowded (hamburger + wallet + chat + bell + avatar).
   Level already sits on the avatar corner — hide the standalone pill. */
@media (max-width: 767px) {
  .sf-top-bar__level {
    display: none !important;
  }
}

/* ─── Avatar corner level indicator (topbar trigger only) ───
   Subtle, static badge in the bottom-right corner of the avatar circle —
   no glow, no animation. */
.sf-header-avatar-trigger {
  position: relative;
}

.sf-header-avatar-trigger__level {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e91e8c, #8b2fc9);
  border: 1.5px solid #1c0f1f;
  color: #ffffff;
  font-size: 9px;
  font-weight: var(--sf-font-weight-bold, 700);
  line-height: 1;
  pointer-events: none;
}

/* ─── SFDropdown ─── */
.sf-dropdown {
  position: relative;
}

.sf-dropdown__panel {
  position: absolute;
  top: calc(100% + var(--sf-space-2));
  right: 0;
  min-width: 280px;
  max-width: 320px;
  background: var(--sf-color-surface-2);
  border: 1px solid var(--sf-color-border-subtle);
  border-radius: var(--sf-radius-lg);
  box-shadow: var(--sf-shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity var(--sf-duration-normal) var(--sf-ease-out),
    transform var(--sf-duration-normal) var(--sf-ease-out),
    visibility var(--sf-duration-normal) var(--sf-ease);
  z-index: var(--sf-z-modal);
  overflow: hidden;
}

.sf-dropdown.is-open .sf-dropdown__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.sf-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sf-space-4) var(--sf-space-5);
  border-bottom: 1px solid var(--sf-color-border-subtle);
}

.sf-dropdown__title {
  margin: 0;
  font-size: var(--sf-font-size-sm);
  font-weight: var(--sf-font-weight-semibold);
  letter-spacing: var(--sf-letter-tight);
}

.sf-dropdown__body {
  max-height: 360px;
  overflow-y: auto;
}

.sf-dropdown__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sf-space-3);
  padding: var(--sf-space-4) var(--sf-space-5);
  border-bottom: 1px solid var(--sf-color-border-subtle);
  transition: background var(--sf-duration-normal) var(--sf-ease);
}

.sf-dropdown__item:last-child {
  border-bottom: none;
}

.sf-dropdown__item:hover {
  background: var(--sf-color-glass);
}

.sf-dropdown__item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sf-color-accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.sf-dropdown__item-text {
  flex: 1;
  min-width: 0;
}

.sf-dropdown__item-title {
  margin: 0 0 var(--sf-space-1);
  font-size: var(--sf-font-size-sm);
  font-weight: var(--sf-font-weight-medium);
  color: var(--sf-color-text);
}

.sf-dropdown__item-meta {
  margin: 0;
  font-size: var(--sf-font-size-xs);
  color: var(--sf-color-text-tertiary);
}

.sf-dropdown__menu {
  padding: var(--sf-space-2);
}

.sf-dropdown__menu-link {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  padding: var(--sf-space-3) var(--sf-space-4);
  border-radius: var(--sf-radius-md);
  color: var(--sf-color-text-secondary);
  text-decoration: none;
  font-size: var(--sf-font-size-sm);
  transition: background var(--sf-duration-normal) var(--sf-ease),
    color var(--sf-duration-normal) var(--sf-ease);
}

.sf-dropdown__menu-link:hover {
  background: var(--sf-color-glass);
  color: var(--sf-color-text);
}

.sf-dropdown__menu-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  flex-shrink: 0;
}

.sf-dropdown__divider {
  height: 1px;
  margin: var(--sf-space-2) var(--sf-space-4);
  background: var(--sf-color-border-subtle);
}

.sf-dropdown__user {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  padding: var(--sf-space-4) var(--sf-space-5);
  border-bottom: 1px solid var(--sf-color-border-subtle);
}

.sf-dropdown__user-name {
  margin: 0;
  font-size: var(--sf-font-size-sm);
  font-weight: var(--sf-font-weight-semibold);
}

.sf-dropdown__user-handle {
  margin: 0;
  font-size: var(--sf-font-size-xs);
  color: var(--sf-color-text-tertiary);
}

/* ─── SFSearchOverlay ─── */
.sf-search-overlay {
  position: fixed;
  inset: 0;
  /* Above legacy search panels (9999), below .i_modal_bg (999999) and story viewer */
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--sf-space-16) var(--sf-space-6) var(--sf-space-8);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--sf-duration-normal) var(--sf-ease-out),
    visibility var(--sf-duration-normal) var(--sf-ease);
}

.sf-search-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sf-search-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  /* backdrop-filter ONLY when open — closed overlays with blur can paint over the whole app */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sf-search-overlay.is-open .sf-search-overlay__backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sf-search-overlay__panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--sf-color-surface-2);
  border: 1px solid var(--sf-color-border-subtle);
  border-radius: var(--sf-radius-xl);
  box-shadow: var(--sf-shadow-lg);
  transform: translateY(-12px) scale(0.98);
  transition: transform var(--sf-duration-normal) var(--sf-ease-out);
  overflow: hidden;
}

.sf-search-overlay.is-open .sf-search-overlay__panel {
  transform: translateY(0) scale(1);
}

.sf-search-overlay__input-wrap {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  padding: var(--sf-space-4) var(--sf-space-5);
  border-bottom: 1px solid var(--sf-color-border-subtle);
}

.sf-search-overlay__input-wrap svg {
  width: 20px;
  height: 20px;
  stroke: var(--sf-color-text-tertiary);
  fill: none;
  stroke-width: 1.75;
  flex-shrink: 0;
}

.sf-search-overlay__input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--sf-color-text);
  font-size: var(--sf-font-size-md);
  font-family: inherit;
  outline: none;
}

.sf-search-overlay__input::placeholder {
  color: var(--sf-color-text-tertiary);
}

.sf-search-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--sf-radius-sm);
  background: transparent;
  color: var(--sf-color-text-tertiary);
  cursor: pointer;
  transition: background var(--sf-duration-normal) var(--sf-ease),
    color var(--sf-duration-normal) var(--sf-ease);
}

.sf-search-overlay__close:hover {
  background: var(--sf-color-glass);
  color: var(--sf-color-text);
}

.sf-search-overlay__results {
  padding: var(--sf-space-4) var(--sf-space-5) var(--sf-space-6);
}

.sf-search-overlay__hint {
  margin: 0;
  font-size: var(--sf-font-size-sm);
  color: var(--sf-color-text-tertiary);
}

.sf-search-overlay__suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-1);
  margin-top: var(--sf-space-4);
}

.sf-search-overlay__suggestion {
  display: flex;
  align-items: center;
  gap: var(--sf-space-3);
  padding: var(--sf-space-3) var(--sf-space-4);
  border-radius: var(--sf-radius-md);
  color: var(--sf-color-text-secondary);
  font-size: var(--sf-font-size-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--sf-duration-normal) var(--sf-ease);
}

.sf-search-overlay__suggestion:hover,
.sf-search-overlay__suggestion:focus,
.sf-search-overlay__suggestion:visited {
  color: var(--sf-color-text);
  text-decoration: none;
}

.sf-search-overlay__suggestion:hover {
  background: var(--sf-color-glass);
  color: var(--sf-color-text);
}

/* Grouped result rows (sf/php/search_results.php). Every media element gets an
   explicit, hard-capped box — root cause of the earlier "oversized black
   circle" bug was an avatar/icon rendered with no width/height constraint at
   all, so an unstyled/failed-to-load image (or a bare inline <svg> with no
   size attributes) fell back to its native intrinsic size and, combined with
   border-radius:50%, filled almost the whole overlay as a solid circle. */
.sf-search-result__media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  max-height: 32px;
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--sf-color-glass);
}

.sf-search-result__avatar {
  display: block;
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  border-radius: 999px;
  object-fit: cover;
}

.sf-search-result__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
  border-radius: 10px;
  background: var(--sf-color-glass);
  color: var(--sf-color-text-tertiary);
}

.sf-search-result__icon svg {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex-shrink: 0;
}

.sf-search-result__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.sf-search-result__title {
  color: var(--sf-color-text);
  font-size: var(--sf-font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-search-result__subtitle {
  color: var(--sf-color-text-tertiary);
  font-size: var(--sf-font-size-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-search-group__title {
  margin: 0 0 var(--sf-space-2);
  padding: 0 var(--sf-space-1);
  color: var(--sf-color-brand, #e91e8c);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sf-search-group {
  margin-bottom: var(--sf-space-3);
}

.sf-search-group:last-child {
  margin-bottom: 0;
}

/* ─── SFPageContainer ─── */
.sf-page-container {
  flex: 1;
  width: 100%;
  padding: var(--sf-space-8) var(--sf-space-6) var(--sf-space-16);
}

@media (min-width: 768px) {
  .sf-page-container {
    padding: var(--sf-space-10) var(--sf-space-8) var(--sf-space-20);
  }
}

.sf-page-container__inner {
  width: 100%;
  max-width: var(--sf-page-max-width);
  margin: 0 auto;
}

/* Placeholder blocks (Phase 1C — no feed data) */
.sf-page-placeholder {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-6);
}

.sf-page-placeholder__header {
  margin-bottom: var(--sf-space-4);
}

.sf-page-placeholder__title {
  margin: 0 0 var(--sf-space-2);
  font-size: var(--sf-font-size-2xl);
  font-weight: var(--sf-font-weight-semibold);
  letter-spacing: var(--sf-letter-tight);
}

.sf-page-placeholder__subtitle {
  margin: 0;
  font-size: var(--sf-font-size-sm);
  color: var(--sf-color-text-tertiary);
}

.sf-page-placeholder__card {
  padding: var(--sf-space-8);
  border: 1px solid var(--sf-color-border-subtle);
  border-radius: var(--sf-radius-lg);
  background: var(--sf-color-surface-1);
}

.sf-page-placeholder__lines {
  display: flex;
  flex-direction: column;
  gap: var(--sf-space-3);
}

/* ─── SFBottomNav ─── */
.sf-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Dedicated tier above ordinary page content/status overlays (loading bars,
     inline "please wait" notices) so the nav is never visually covered, while
     staying below real modals/toasts which must appear on top of everything. */
  z-index: var(--sf-z-bottom-nav, 150);
  min-height: var(--sf-bottom-nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(12, 12, 14, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--sf-color-border-subtle);
}

@media (max-width: 767px) {
  .sf-bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
  }
}

.sf-bottom-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sf-space-1);
  flex: 1;
  min-height: var(--sf-bottom-nav-height);
  padding: var(--sf-space-2) var(--sf-space-1);
  color: var(--sf-color-text-tertiary);
  text-decoration: none;
  font-size: 0.625rem;
  font-weight: var(--sf-font-weight-medium);
  letter-spacing: 0.02em;
  transition: color var(--sf-duration-normal) var(--sf-ease),
    transform var(--sf-duration-normal) var(--sf-ease-out);
}

.sf-bottom-nav__link:hover,
.sf-bottom-nav__link.is-active {
  color: var(--sf-color-text);
}

.sf-bottom-nav__link.is-active {
  color: var(--sf-color-accent);
}

.sf-bottom-nav__link svg {
  width: 22px;
  height: 22px;
  stroke: currentColor !important;
  fill: none !important;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sf-bottom-nav__link svg path,
.sf-bottom-nav__link svg circle,
.sf-bottom-nav__link svg rect,
.sf-bottom-nav__link svg polyline,
.sf-bottom-nav__link svg line {
  fill: none !important;
  stroke: currentColor !important;
}

/* Create FAB keeps white glyph on pink disc */
.sf-bottom-nav__link--create svg,
.sf-bottom-nav__link--create svg path,
.sf-bottom-nav__link--create svg circle {
  stroke: #fff !important;
  fill: none !important;
}

/* ─── App Footer ─── */
.sf-app-footer {
  flex-shrink: 0;
  padding: var(--sf-space-6) var(--sf-space-6) var(--sf-space-8);
  border-top: 1px solid var(--sf-color-border-subtle);
  text-align: center;
}

.sf-app-footer__text {
  margin: 0;
  font-size: var(--sf-font-size-xs);
  color: var(--sf-color-text-tertiary);
  letter-spacing: var(--sf-letter-wide);
}

.sf-app-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--sf-space-6);
  margin-top: var(--sf-space-3);
  flex-wrap: wrap;
}

.sf-app-footer__link {
  color: var(--sf-color-text-tertiary);
  text-decoration: none;
  font-size: var(--sf-font-size-xs);
  transition: color var(--sf-duration-normal) var(--sf-ease);
}

.sf-app-footer__link:hover {
  color: var(--sf-color-text-secondary);
}

/* ─── SFLayout body state ─── */
body.sf-app-body {
  overflow-x: hidden;
  color: var(--sf-color-text);
  background-color: var(--sf-color-void);
  background-image: var(--sf-bg-canvas);
  background-repeat: no-repeat;
  background-attachment: scroll;
  background-size: 100% auto;
  min-height: 100%;
}

/* Keep shell/content above any accidental full-bleed layers */
body.sf-app-body .sf-app-shell,
body.sf-app-body .sf-app-shell__main,
body.sf-app-body .sf-page-container {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

body.sf-app-body .sf-dropdown-open {
  overflow: hidden;
}

/* OneSignal floating bell — covers bottom-nav profile on mobile */
#onesignal-bell-container,
.onesignal-bell-launcher,
.onesignal-bell-launcher-button,
iframe#onesignal-bell-iframe {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
