/* DREAMWAVE FM — Mobile Responsive Styles */

/* ===== 600px BREAKPOINT ===== */
@media (max-width: 600px) {
  /* Base adjustments */
  #app {
    padding: 10px;
  }

  /* Header */
  header {
    padding: 10px 0;
    margin-bottom: 6px;
  }

  .header-left h1 {
    font-size: 12px !important;
    letter-spacing: 2px;
  }

  .subtitle {
    display: none;
  }

  /* Album art */
  .album-art-clip {
    width: clamp(80px, 25vw, 120px) !important;
    height: clamp(80px, 25vw, 120px) !important;
  }

  .album-art {
    width: clamp(70px, 22vw, 100px) !important;
    height: clamp(70px, 22vw, 100px) !important;
  }

  /* Track info */
  .now-playing {
    padding: 12px 0;
  }

  .now-playing-label {
    font-size: 9px !important;
  }

  .track-title {
    font-size: 16px !important;
  }

  .track-artist {
    font-size: 12px !important;
  }

  .mood-badge {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  /* Progress bar */
  .progress-container {
    margin: 8px 0;
  }

  .time-display {
    font-size: 10px !important;
  }

  /* Controls - horizontal scroll */
  .controls {
    padding: 8px 0;
    gap: 4px !important;
    scrollbar-width: none;
  }

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

  .btn {
    font-size: 11px !important;
    padding: 4px 7px !important;
    letter-spacing: 1px !important;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .btn-play {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }

  /* Volume & crossfade — stacked inline */
  .volume-control {
    margin-bottom: 6px !important;
    font-size: 12px !important;
  }

  .volume-control input {
    width: 60px !important;
  }

  .crossfade-control {
    margin-bottom: 8px !important;
    font-size: 10px !important;
  }

  .crossfade-control input[type=range] {
    min-width: 60px !important;
  }

  /* Playlist */
  .playlist {
    width: 100% !important;
    padding: 0 !important;
  }

  .playlist h2 {
    font-size: 11px !important;
    margin-bottom: 4px !important;
  }

  /* Filter chips */
  .filter-chips {
    gap: 4px !important;
    padding: 0 4px 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100vw;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    font-size: 11px !important;
    padding: 5px 10px !important;
    flex-shrink: 0;
  }

  /* Search */
  .search-container {
    padding: 2px 4px 6px !important;
    margin-bottom: 8px !important;
  }

  .search-container input {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }

  .search-container select {
    font-size: 11px !important;
    padding: 8px 6px !important;
  }

  .clear-btn {
    font-size: 14px !important;
    padding: 6px 8px !important;
  }

  /* Playlist items */
  .track {
    padding: 6px 8px !important;
  }

  .track-thumb {
    width: 36px !important;
    height: 36px !important;
    margin-right: 8px !important;
  }

  .track-name {
    font-size: 13px !important;
  }

  .track-artist-sm {
    font-size: 10px !important;
  }

  .track-duration {
    font-size: 10px !important;
    padding-left: 6px !important;
  }

  .track-num {
    font-size: 10px !important;
    width: 18px !important;
  }

  .track-heart {
    font-size: 13px !important;
  }

  /* Modals */
  .modal-content,
  #authPage > div {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 16px 12px !important;
  }

  .modal-title {
    font-size: 12px !important;
  }

  /* Profile card */
  .profile-card {
    width: 95vw !important;
    padding: 20px !important;
  }

  .profile-avatar {
    width: 60px !important;
    height: 60px !important;
  }

  .profile-username {
    font-size: 18px !important;
  }

  /* Discover card */
  .discover-card {
    width: 95vw !important;
    padding: 20px !important;
  }

  /* Activity modal */
  #activityModal > div {
    width: 95vw !important;
    max-width: 95vw !important;
  }

  .activity-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .activity-tab {
    font-size: 11px !important;
    padding: 6px 12px !important;
  }

  .find-people-btn {
    margin-left: 0 !important;
    margin-top: 8px;
    width: 100%;
  }

  /* Stats modal */
  .stats-modal {
    width: 95vw !important;
    min-width: auto !important;
    padding: 20px !important;
  }

  /* Sleep timer */
  .sleep-menu {
    width: 90vw !important;
    min-width: auto !important;
    padding: 16px !important;
  }

  /* Shortcuts modal */
  .shortcuts-modal {
    width: 95vw !important;
    padding: 20px !important;
  }

  /* Playlist drawer */
  .playlist-drawer {
    max-height: 50vh !important;
    padding: 16px !important;
  }

  .playlist-drawer h3 {
    font-size: 9px !important;
  }

  /* Queue panel */
  #queuePanel {
    max-width: 100vw !important;
    margin: 8px !important;
    max-height: 250px !important;
  }

  /* Minimal mode */
  #minimal-ui {
    padding: 10px !important;
  }

  .vinyl-container {
    width: 160px !important;
    height: 160px !important;
  }

  .vinyl-bg {
    width: 160px !important;
    height: 160px !important;
  }

  .vinyl-album-art {
    width: 55px !important;
    height: 55px !important;
  }

  .minimal-track-info {
    max-width: 100% !important;
  }

  .minimal-track-name {
    font-size: 18px !important;
  }

  .minimal-controls {
    gap: 10px !important;
  }

  .minimal-btn {
    padding: 10px !important;
    font-size: 18px !important;
  }

  .minimal-btn.play {
    width: 50px !important;
    height: 50px !important;
    font-size: 22px !important;
  }

  /* Up next strip */
  .up-next-strip {
    padding: 6px 10px !important;
    gap: 8px !important;
  }

  /* Minimal volume */
  .minimal-volume {
    bottom: 10px !important;
    right: 10px !important;
  }

  /* User avatar */
  .user-avatar {
    width: 30px !important;
    height: 30px !important;
    top: 8px !important;
    right: 10px !important;
  }

  /* Mode toggle */
  #modeToggle {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
    top: 8px !important;
    left: 8px !important;
  }

  #bgSelector {
    top: 6px !important;
    right: 6px !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
}

/* ===== 400px BREAKPOINT ===== */
@media (max-width: 400px) {
  /* Even smaller */
  .header-left h1 {
    font-size: 10px !important;
  }

  .album-art-clip {
    width: 70px !important;
    height: 70px !important;
  }

  .album-art {
    width: 60px !important;
    height: 60px !important;
  }

  .track-title {
    font-size: 14px !important;
  }

  .track-artist {
    font-size: 11px !important;
  }

  .btn {
    font-size: 10px !important;
    padding: 3px 6px !important;
  }

  .track {
    padding: 4px 6px !important;
  }

  .track-thumb {
    width: 32px !important;
    height: 32px !important;
    margin-right: 6px !important;
  }

  .track-name {
    font-size: 12px !important;
  }

  .vinyl-container {
    width: 140px !important;
    height: 140px !important;
  }

  .vinyl-bg {
    width: 140px !important;
    height: 140px !important;
  }

  .vinyl-album-art {
    width: 48px !important;
    height: 48px !important;
  }

  .minimal-track-name {
    font-size: 16px !important;
  }

  .minimal-controls {
    gap: 8px !important;
  }

  .minimal-btn {
    padding: 8px !important;
    font-size: 16px !important;
  }

  .minimal-btn.play {
    width: 44px !important;
    height: 44px !important;
    font-size: 20px !important;
  }

  /* Hide less important elements */
  .subtitle {
    display: none !important;
  }

  .mood-badge {
    display: none !important;
  }

  .crossfade-control span:first-child {
    display: none !important;
  }

  .volume-control span:first-child {
    display: none !important;
  }

  .volume-control span:last-child {
    display: none !important;
  }

  /* Stack progress bar elements */
  .progress-container {
    flex-direction: column;
    gap: 4px;
  }

  .time-display {
    justify-content: center;
    gap: 8px;
  }

  /* Reduce modal padding */
  .modal-content {
    padding: 12px !important;
  }

  .profile-card {
    padding: 16px !important;
  }

  .discover-card {
    padding: 16px !important;
  }

  /* Simplify playlist drawer */
  .playlist-drawer {
    padding: 12px !important;
  }

  .playlist-drawer-toggle {
    font-size: 10px !important;
    padding: 8px 12px !important;
  }

  /* Compact queue items */
  .queue-item {
    padding: 5px 8px !important;
  }

  .q-num {
    display: none !important;
  }

  .q-cover {
    width: 28px !important;
    height: 28px !important;
  }

  /* Hide up next second track on very small screens */
  .up-next-strip .up-next-track:last-child {
    display: none !important;
  }

  /* Simplify minimal volume */
  .volume-knob-container {
    width: 36px !important;
    height: 36px !important;
  }

  #volumeDisplay {
    display: none !important;
  }

  /* ===== MOBILE: ≤768px — sidebar becomes bottom tab bar ===== */
  @media (max-width: 768px) {
    #top-area {
      flex-direction: column;
    }

    /* Hide sidebar entirely, replaced by bottom tab bar */
    #sidebar {
      display: none;
    }

    /* Mobile top bar — minimal, just logo + sign in */
    #mobile-topbar {
      display: flex !important;
      align-items: center;
      justify-content: space-between;
      padding: 8px 16px;
      background: rgba(0,0,0,0.85);
      border-bottom: 1px solid rgba(255,255,255,0.05);
      flex-shrink: 0;
      height: 48px;
      box-sizing: border-box;
    }

    .mobile-topbar-logo {
      font-family: var(--font-heading);
      font-size: 14px;
      color: var(--neon-pink);
      letter-spacing: 2px;
      text-shadow: 0 0 10px rgba(185,103,255,0.4);
    }

    .mobile-topbar-signin {
      font-size: 11px;
      padding: 5px 12px;
      background: rgba(185,103,255,0.12);
      border: 1px solid rgba(185,103,255,0.3);
      border-radius: 14px;
      color: var(--neon-pink);
      cursor: pointer;
      font-family: inherit;
    }

    /* Mobile bottom tab bar */
    #mobile-tab-bar {
      display: flex !important;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: 54px;
      background: rgba(0, 0, 0, 0.97);
      border-top: 1px solid rgba(255,255,255,0.08);
      z-index: 1000;
      flex-shrink: 0;
    }

    /* Content area has top + bottom padding */
    #content-area {
      padding-top: 8px;
      padding-bottom: 62px;
    }

    /* Compact player bar */
    #player-bar {
      height: 60px;
      padding: 0 10px;
      gap: 6px;
    }

    .player-track-info {
      width: 140px;
      flex-shrink: 0;
    }
    .player-album-art {
      width: 42px;
      height: 42px;
    }
    .player-album-art .album-art {
      width: 42px;
      height: 42px;
    }
    .player-track-text .track-title {
      font-size: 10px;
    }
    .player-track-text .track-artist {
      font-size: 9px;
    }
    .player-controls {
      gap: 4px;
    }
    .player-btn {
      font-size: 13px;
      padding: 2px 3px;
    }
    .player-btn-play {
      font-size: 16px;
      width: 32px;
      height: 32px;
    }
    .player-progress {
      max-width: 140px;
    }
    .player-extras {
      width: auto;
      gap: 4px;
    }
    .player-extras .crossfade-control { display: none; }
    .player-extras .volume-control input[type=range] { width: 40px; }
    .player-extras .player-btn-sm:nth-child(3) { display: none; }
    .player-extras .player-btn-sm:nth-child(4) { display: none; }

    .player-center {
      gap: 3px;
    }

    .filter-chips {
      gap: 4px;
    }

    .sidebar-nav { display: none; }

    /* Up-next strip higher up */
    .up-next-strip {
      bottom: 58px;
    }
  }

  /* Mobile top bar — hidden on desktop */
  #mobile-topbar {
    display: none !important;
  }

  /* Mobile tab bar — hidden on desktop */
  #mobile-tab-bar {
    display: none !important;
  }
  .mobile-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 9px;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0;
    transition: color 0.15s;
  }
  .mobile-tab-btn.active { color: var(--neon-pink); }
  .mobile-tab-icon { font-size: 20px; }
  /* Full-ui: constrained flex column — nothing grows infinitely */
  #full-ui {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  #full-ui > div {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* .playlist fills remaining space and clips children */
  .playlist {
    flex: 1 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
  }

  /* homeFeed scrolls inside the clipped playlist */
  #homeFeed {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    height: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #playlistContainer {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  /* Header — compact */
  header {
    flex: 0 0 auto !important;
    padding: 6px 0 !important;
    margin-bottom: 0 !important;
  }

  /* Now-playing — compact horizontal row */
  .now-playing {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: 4px 0 !important;
  }

  .album-art-clip {
    width: 52px !important;
    height: 52px !important;
    flex-shrink: 0 !important;
    margin-bottom: 0 !important;
  }

  .album-art {
    width: 52px !important;
    height: 52px !important;
  }

  .now-playing-label {
    font-size: 8px !important;
    flex: 0 0 auto !important;
  }

  .track-title {
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .track-artist {
    font-size: 10px !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }

  .mood-badge {
    font-size: 8px !important;
    padding: 1px 5px !important;
    flex: 0 0 auto !important;
  }

  .like-btn {
    font-size: 16px !important;
    flex: 0 0 auto !important;
  }

  /* Controls — single scrollable row */
  .controls {
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 3px !important;
    padding: 4px 0 !important;
  }

  .btn {
    font-size: 10px !important;
    padding: 3px 6px !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .btn-play {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  /* Progress */
  .progress-container { flex: 0 0 auto !important; margin: 2px 0 !important; }
  .time-display { font-size: 9px !important; }

  /* Filter chips */
  .filter-chips {
    gap: 3px !important;
    padding: 0 2px 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    flex: 0 0 auto !important;
  }

  .filter-chip {
    font-size: 10px !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
  }

  /* Search */
  .search-container {
    flex: 0 0 auto !important;
    padding: 2px 4px 4px !important;
  }

  /* Sidebar nav — fixed row at bottom */
  .sidebar-nav {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    padding: 4px 0 !important;
    gap: 0 !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
  }

  .sidebar-nav-btn {
    font-size: 11px !important;
    padding: 5px 12px !important;
    flex: 1 !important;
    text-align: center !important;
  }

  footer { display: none !important; }

  #bgSelector {
    top: 4px !important;
    right: 4px !important;
    font-size: 9px !important;
    padding: 1px 4px !important;
  }

  #queuePanel {
    max-height: 200px !important;
  }
}