/* =========================================================================
   Spotiny · App shell layout (v2 — dark premium redesign)
   ----------------------------------------------------------------------------
   Topbar (simplified): brand + search + theme/settings only.
   Bottom navigation (NEW): fixed Home / Search / Library tabs.
   Main scrollable region that switches between views (home / artist / library
   / liked / album / playlist). Mini-player floats above the bottom nav.
   ========================================================================= */
.app-shell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 var(--sp-4);
  position: relative;
}

/* ----------------------- Topbar ----------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  border-bottom: none;            /* no border — let content scroll under it */
  position: sticky;
  top: 0;
  z-index: 30;
  /* subtle gradient so content fades nicely underneath when scrolling */
  background: linear-gradient(to bottom, var(--bg) 75%, transparent);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--sp-2);
  font-weight: 800; font-size: var(--fs-18); letter-spacing: -0.02em;
  flex-shrink: 0;
  background: none; border: 0; padding: 0; margin: 0;
  color: inherit; font-family: inherit; cursor: pointer;
  border-radius: var(--r-xs);
  transition: opacity var(--dur-1);
}
.topbar__brand:hover { opacity: 0.85; }
.topbar__brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Logo badge: square with accent-gradient background, holds the Spotiny logo SVG */
.topbar__logo {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
  overflow: hidden;
}
.topbar__logo img {
  width: 20px; height: 20px;
  object-fit: contain;
  display: block;
}
.topbar__logo svg {
  width: 16px; height: 16px; color: #fff;
}
.topbar__title { color: var(--text); }

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* ----------------------- Search bar ----------------------- */
.search-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-4);
  transition: border-color var(--dur-2) var(--ease-out),
              background var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out);
}
.search-wrap:focus-within {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-softer);
}
.search-wrap__icon { color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.search-wrap__icon svg { width: 18px; height: 18px; }
.search-input {
  flex: 1; min-width: 0; font-size: var(--fs-14); padding: var(--sp-2) 0;
  color: var(--text);
}
.search-input::placeholder { color: var(--muted-2); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 28px; height: 28px; border-radius: 50%;
  display: none; place-items: center; color: var(--muted);
  transition: color var(--dur-1), background var(--dur-1);
  flex-shrink: 0;
}
.search-clear:hover { color: var(--text); background: var(--surface-3); }
.search-clear svg { width: 14px; height: 14px; }
.search-clear.is-visible { display: grid; }

/* Suggestions dropdown (absolute under search-wrap) */
.suggestions {
  position: absolute;
  top: calc(100% + var(--sp-2));
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 40;
}
.suggestion-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: background var(--dur-1);
}
.suggestion-item:hover, .suggestion-item:focus-visible { background: var(--surface-3); }
.suggestion-item__icon { color: var(--muted); display: grid; place-items: center; flex-shrink: 0; }
.suggestion-item__icon svg { width: 16px; height: 16px; }
.suggestion-item span:last-child {
  font-size: var(--fs-14); color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ----------------------- Filter chips strip ----------------------- */
.filters {
  display: flex; gap: var(--sp-2);
  margin: var(--sp-3) 0 var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }

/* ----------------------- Main / views -----------------------
   Bottom padding clears the mini-player AND bottom-nav so content
   is never hidden behind either. */
.main {
  padding-bottom: calc(var(--mini-h) + var(--bottom-nav-h) + var(--sp-4));
  padding-top: var(--sp-2);
}

.view { animation: viewIn var(--dur-3) var(--ease-out); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Bottom navigation (NEW)
   --------------------------------------------------------------------------
   Fixed at the bottom of the .app-shell column. Three tabs: Home / Search /
   Your Library. The mini-player floats ABOVE this (z-index 35 > 40 swap
   handled in player.css — see .mini-player rules there).
   ========================================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  transform: none;
  width: 100%;
  max-width: 100%;
  height: var(--bottom-nav-h);
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: var(--r-md);
  transition: color var(--dur-1);
  font-family: inherit;
  flex: 1;
  max-width: 120px;
}
.bottom-nav__item:hover { color: var(--text-2); }
.bottom-nav__item.is-active { color: var(--text); }
.bottom-nav__item svg {
  width: 24px; height: 24px;
  flex-shrink: 0;
}
.bottom-nav__item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bottom-nav__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Hide bottom-nav when now-playing is fullscreen so it doesn't peek out */
body.now-playing-open .bottom-nav { opacity: 0; pointer-events: none; transition: opacity var(--dur-2); }

/* ----------------------- Responsive ----------------------- */
@media (min-width: 768px) {
  .app-shell {
    max-width: var(--app-max-w);
    padding: 0 var(--sp-6);
  }
  .bottom-nav {
    max-width: var(--app-max-w);
    left: 50%;
    transform: translateX(-50%);
  }
}
