/* ============================================================================
   Music Player PWA - styles2.css
   ---------------------------------------------------------------------------
   Clean styling for the refreshed mobile-first library UI.

   Notes:
   - The play screen is left close to your existing layout.
   - Library, folder, search, mix, and hamburger menu are the main polish area.
   - Folder/albums remain one column so users read top-to-bottom naturally.
============================================================================ */

/* ============================================================================
   THEME VARIABLES
============================================================================ */

:root {
  --bg: #0b1020;
  --panel: rgba(18, 27, 45, 0.92);
  --panel-2: rgba(27, 39, 63, 0.95);
  --panel-3: #263955;
  --text: #f7f8fb;
  --muted: #aab6c8;
  --faint: #718198;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #78b7ff;
  --accent-2: #477dff;
  --accent-soft: rgba(120, 183, 255, 0.14);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.22);
  --radius: 22px;
  --radius-sm: 16px;
  --topbar-height: 72px;
  --mini-height: clamp(68px, 9vw, 82px);
  --page-pad: clamp(0.9rem, 2.5vw, 1.5rem);
  --section-gap: clamp(0.8rem, 1.5vw, 1.2rem);
  --library-max: 860px;
  --content-max: 1500px;
  --play-max: 1400px;
}

/* ============================================================================
   BASE RESET
============================================================================ */

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: #0a0d16;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background-color: #0a0d16;
  background:
    radial-gradient(
      circle at 20% -10%,
      rgba(71, 125, 255, 0.22),
      transparent 32rem
    ),
    radial-gradient(
      circle at 85% 5%,
      rgba(102, 255, 204, 0.08),
      transparent 28rem
    ),
    linear-gradient(180deg, #0b1020 0%, #0a0d16 100%);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

body {
  min-height: 100dvh;
}
img {
  display: block;
  max-width: 100%;
}
button,
input,
select {
  font: inherit;
}
button,
select,
input {
  min-height: 44px;
}

button,
select {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.025)
  );
  color: var(--text);
  padding: 0.72rem 1rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

button:active {
  transform: scale(0.985);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(8, 13, 24, 0.72);
  color: var(--text);
  padding: 0.9rem 1rem;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(120, 183, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(120, 183, 255, 0.12);
}

input::placeholder {
  color: var(--faint);
}

/* ============================================================================
   APP SHELL
============================================================================ */

#app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
  background-color: transparent;
}

.topBar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.appTitle {
  display: flex;
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex: 1;
  align-items: flex-start;
}

.appTitle span {
  font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.3rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.appTitle small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

#mainView {
  min-height: 0;
  overflow: hidden;
  max-width: 100dvw;
}

.screen {
  display: none;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: var(--page-pad);
  padding-top: 22px;
  padding-bottom: calc(var(--page-pad) + 0.35rem);
}

.screen.active {
  display: block;
}

#libraryScreen {
  width: 100%;
  max-width: var(--library-max);
  margin: 0 auto;
}

#playScreen {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ============================================================================
   REUSABLE BUTTONS
============================================================================ */

.iconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  min-height: 50px;
  padding: 0;
  border-radius: 14px;
  font-size: 1.2rem;
  line-height: 1;
}

.backBtn {
  flex: 0 0 auto;
}

.closeBtn {
  min-width: 42px;
  min-height: 42px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.iconBtn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.iconBtn.active {
  color: var(--accent);
  border-color: rgba(120, 183, 255, 0.38);
  background: var(--accent-soft);
}

.iconBtn.active svg {
  stroke-width: 3.2;
}

/* ============================================================================
   PANELS
   ---------------------------------------------------------------------------
   All panels start hidden except browsePanel. app2.js decides which one opens.
============================================================================ */

.panel {
  margin-bottom: var(--section-gap);
}

#menuPanel,
#searchPanel,
#mixPanel,
#aboutPanel {
  display: none;
}

.utilityPanel,
.actionPanel,
#browsePath {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

#menuBtn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Hamburger dropdown menu. It feels like a menu, not a full replacement page. */
.appMenu {
  position: relative;
  padding: 0.9rem;
}

.menuHeader,
.panelHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.menuHeader h2,
.panelCopy h2 {
  margin: 0.18rem 0 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.panelCopy p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.menuActions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.modeCard {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.78rem;
  border-radius: 18px;
  text-align: left;
}

.modeIcon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(120, 183, 255, 0.13);
  color: var(--accent);
}

.modeText {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.modeText strong {
  font-size: 0.98rem;
}
.modeText small {
  color: var(--muted);
  font-size: 0.78rem;
}

.menuUtilityActions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.menuUtilityActions button {
  width: 100%;
}

.actionPanel {
  padding: 1rem;
}

.panelControls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.panelControls button {
  width: 100%;
}

.aboutBox {
  color: var(--muted);
  line-height: 1.55;
}

.aboutBox p {
  margin: 0 0 0.75rem;
}
.aboutBox p:last-child {
  margin-bottom: 0;
}
.aboutBox strong {
  color: var(--text);
}

/* ============================================================================
   BREADCRUMBS
============================================================================ */

#browsePath {
  padding: 0.8rem 0.9rem;
  overflow: hidden;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

.crumbBtn,
.crumbCurrent {
  white-space: nowrap;
  font-size: 0.88rem;
}

.crumbBtn {
  min-height: 34px;
  padding: 0.42rem 0.7rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border-radius: 999px;
}

.crumbCurrent {
  color: var(--muted);
  padding: 0.42rem 0;
}

.crumbSep {
  color: var(--faint);
}

/* ============================================================================
   FOLDER AND TRACK LISTS
   ---------------------------------------------------------------------------
   One column is deliberate. It reads like a music app, not a file manager.
============================================================================ */

.trackList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.82rem;
}

.folderCard,
.trackCard {
  display: grid;
  align-items: center;
  gap: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.055),
    rgba(255, 255, 255, 0.025)
  );
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.folderCard {
  grid-template-columns: 48px minmax(0, 1fr);
  padding: 0.85rem;
}

.folderIcon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.05rem;
}

.folderHint {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.trackCard {
  grid-template-columns: 64px minmax(0, 1fr);
  padding: 0.85rem;
}

.trackCard.hasNumber {
  grid-template-columns: 22px 64px minmax(0, 1fr);
}

.trackNumber {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.trackThumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--panel-2);
}

.trackMeta {
  min-width: 0;
}

.trackTitle {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.32;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trackArtist,
.trackAlbum {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trackArtist {
  font-size: 0.88rem;
  line-height: 1.35;
}
.trackAlbum {
  font-size: 0.72rem;
  line-height: 1.35;
}

.emptyState {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ============================================================================
   PLAY SCREEN
   ---------------------------------------------------------------------------
   Kept close to your original. Only small polish comes from theme variables.
============================================================================ */

.playContent {
  min-height: 100%;
  width: 100%;
  max-width: var(--play-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.6rem);
}

.artwork {
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nowPlayingMeta {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

#nowPlayingTitle,
#nowPlayingArtist,
#nowPlayingAlbum {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#nowPlayingTitle {
  height: 56px;

  display: flex;
  align-items: center;

  margin-bottom: 8px;

  color: #f5f7fa;

  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.9rem);

  font-weight: 600;

  line-height: 1.2;
}

#nowPlayingArtist {
  min-height: 34px;

  display: flex;
  align-items: center;

  color: #c7d0da;

  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);

  line-height: 1.2;

  font-weight: 500;
}

#nowPlayingAlbum {
  color: #7d8895;

  font-size: 0.85rem;

  letter-spacing: 0.03em;

  text-transform: uppercase;
}

.progressArea {
  width: 100%;
  max-width: 680px;
}

#seekBar {
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
}

.timeRow {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: -10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.playerControls {
  width: 100%;
  max-width: 1000px;
  display: flex;
  gap: 0.75rem;
  margin-top: 10px;
}

.playerControls > button {
  flex: 1;
}

#miniPlayerPlayPauseBtn,
#miniPlayerMuteBtn,
#shuffleBtn,
#prevBtn,
#playPauseBtn,
#nextBtn,
#repeatBtn {
  width: 50px;
  height: 50px;
}

/* ============================================================================
   MINI PLAYER
============================================================================ */

.miniPlayer {
  min-height: var(--mini-height);
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem var(--page-pad);
  background: rgba(13, 20, 35, 0.98);
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  z-index: 45;
  max-width: 100dvw;
  backdrop-filter: blur(14px);
}

.miniPlayerThumb {
  width: clamp(46px, 5vw, 56px);
  height: clamp(46px, 5vw, 56px);
  border-radius: 12px;
  object-fit: cover;
  background: var(--panel-2);
  flex-shrink: 0;
}

.miniPlayerMeta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.miniPlayerButtons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.miniPlayerTitle,
.miniPlayerArtist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.miniPlayerTitle {
  font-size: 0.95rem;
  font-weight: 700;
}

.miniPlayerArtist {
  color: var(--muted);
  font-size: 0.84rem;
}

/* ============================================================================
   LOADING OVERLAY
============================================================================ */

.loadingOverlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 15, 0.65);
  backdrop-filter: blur(3px);
}

.loadingOverlay.hidden {
  display: none;
}

.loadingBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(18, 27, 45, 0.96);
  box-shadow: var(--shadow);
}

.loadingText {
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   SMALL MOBILE TWEAKS
============================================================================ */

@media (max-width: 389px) {
  :root {
    --topbar-height: 58px;
  }

  .topBar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding-inline: 10px;
  }

  .iconBtn {
    min-width: 44px;
    min-height: 44px;
  }

  .artwork {
    width: 255px;
  }
  .playContent {
    margin-top: -30px;
  }

  #nowPlayingTitle {
    min-height: 40px;
    font-size: 18px;
    line-height: 1.2rem;
  }

  #nowPlayingArtist {
    min-height: 35px;
    font-size: 14px;
  }
}

/* ============================================================================
   TABLET / DESKTOP
   ---------------------------------------------------------------------------
   Library stays one column, but the page gets more breathing room.
============================================================================ */

@media (min-width: 700px) {
  :root {
    --library-max: 900px;
  }

  .topBar {
    padding-inline: 24px;
  }

  .appTitle span {
    font-size: 1.45rem;
  }
  .appTitle small {
    font-size: 0.82rem;
  }

  .utilityPanel,
  .actionPanel,
  #browsePath {
    padding-inline: 1.2rem;
  }

  .menuActions {
    grid-template-columns: 1fr;
  }

  .miniPlayerTitle {
    font-size: 1.05rem;
  }
  .miniPlayerArtist {
    font-size: 0.92rem;
  }
}

@media (min-width: 1030px) {
  .playContent {
    flex-direction: row;
  }

  .nowPlayingMeta {
    width: 40%;
    gap: 10px;
  }

  #nowPlayingTitle {
    min-height: 70px;
    font-size: clamp(1.35rem, 1.1rem + 0.8vw, 2rem);
    line-height: 1.5rem;
  }

  #nowPlayingArtist {
    min-height: 50px;
    font-size: clamp(1rem, 0.95rem + 0.35vw, 1.2rem);
    line-height: 1.5rem;
  }

  .artwork {
    width: 550px;
  }
}

@media (min-width: 1990px) {
  :root {
    --topbar-height: 100px;
  }

  .appTitle span {
    font-size: 2.2rem;
  }
  .artwork {
    width: 950px;
  }
  .screen {
    padding-top: 50px;
  }
}
