/* ==========================================================================
   Mkaz Music MP3 Player — Mobile layout
   (base.css is linked separately in index-m.php, loaded before this file)
   ========================================================================== */

:root {
  --m-player-height: 64px;
  --m-tabbar-height: 60px;
}

.m-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--m-player-height) + var(--m-tabbar-height) + 8px);
}

/* ---------- Top bar ---------- */
.m-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11,11,13,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.m-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-brand svg { width: 26px; height: 26px; flex-shrink: 0; }
.m-brand span { font-family: var(--font-display); font-weight: 800; font-size: 17px; }

.m-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
}
.m-back-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.m-back-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.m-icon-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}
.m-icon-btn svg { width: 17px; height: 17px; }

/* ---------- Search bar ---------- */
.m-search-bar { display: none; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.m-search-bar.open { display: block; }
.m-search-bar .search-box { display: flex; align-items: center; gap: 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 22px; padding: 9px 14px; }
.m-search-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text-primary); font-size: 14px; }
.m-search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Page heading ---------- */
.m-heading { padding: 14px 16px 8px; }
.m-heading h1 { font-family: var(--font-display); font-weight: 800; font-size: 21px; margin: 0 0 2px; letter-spacing: -0.3px; }
.m-heading p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ---------- Detail header (artist / album / playlist) ---------- */
.m-detail-header { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 20px 10px; }
.m-detail-cover {
  width: 150px; height: 150px; border-radius: 10px; overflow: hidden; margin-bottom: 14px;
  background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 28px rgba(0,0,0,0.4);
}
.m-detail-cover.round { border-radius: 50%; }
.m-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-detail-cover svg { width: 34%; height: 34%; color: var(--text-muted); }
.m-detail-header h1 { font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 0 0 4px; letter-spacing: -0.4px; }
.m-detail-header .sub { font-size: 13px; color: var(--text-secondary); }
.m-detail-header .bio { font-size: 12.5px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }

.m-play-all {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #000; border: none; border-radius: 24px;
  padding: 11px 28px; font-weight: 700; font-size: 14px; margin: 14px auto 4px;
}
.m-play-all svg { width: 16px; height: 16px; }

.m-section-label { padding: 16px 16px 8px; font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.2px; }

/* ---------- Album mini-grid (inside artist detail) ---------- */
.m-album-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; }
.m-album-scroll::-webkit-scrollbar { display: none; }
.m-album-tile { flex-shrink: 0; width: 120px; }
.m-album-tile .cover { position: relative; width: 120px; height: 120px; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.m-album-tile .cover img { width: 100%; height: 100%; object-fit: cover; }
.m-album-tile .cover svg { width: 34%; height: 34%; color: var(--text-muted); }
.m-album-tile .title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-album-tile .sub { font-size: 11px; color: var(--text-secondary); }

/* ---------- Tile grid (playlists / artists browse) ---------- */
.m-tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 8px 16px 20px; }
.m-tile-card { background: var(--bg-surface); border-radius: var(--radius); padding: 12px; }
.m-tile-cover { position: relative; width: 100%; aspect-ratio: 1; border-radius: 6px; overflow: hidden; margin-bottom: 10px; background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center; }
.m-tile-cover.round { border-radius: 50%; }
.m-tile-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-tile-cover svg { width: 38%; height: 38%; color: var(--text-muted); }

/* ---------- Card play button (Spotify-style, always visible on touch) ---------- */
.card-play-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}
.card-play-btn svg { width: 15px; height: 15px; margin-left: 1px; }
.card-play-btn:active { transform: scale(0.94); }
.m-tile-card .title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-tile-card .sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- Song list (rows) ---------- */
.m-list { display: flex; flex-direction: column; padding: 4px 10px 16px; gap: 2px; }

.m-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; position: relative; }
.m-row:active { background: var(--bg-surface-hover); }
.m-row.playing { background: var(--bg-surface); }
.m-row.playing .name { color: var(--accent); }

.m-row-cover { width: 46px; height: 46px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center; }
.m-row-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-row-cover svg { width: 40%; height: 40%; color: var(--text-muted); }

.m-row-meta { flex: 1; min-width: 0; }
.m-row-meta .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row-meta .sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-row-fav { background: none; border: none; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.m-row-fav.active { color: var(--accent); }
.m-row-fav svg { width: 17px; height: 17px; }

.m-row-duration { font-size: 12px; color: var(--text-muted); flex-shrink: 0; width: 34px; text-align: right; }

.m-empty { padding: 50px 24px; text-align: center; color: var(--text-secondary); }
.m-empty svg { width: 40px; height: 40px; color: var(--text-muted); margin-bottom: 10px; }

/* ---------- Mini player ---------- */
.m-player {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--m-tabbar-height) + 8px);
  height: var(--m-player-height); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
  display: flex; align-items: center; gap: 10px; padding: 0 10px; z-index: 25;
  transform: translateY(140%); transition: transform 0.25s ease; box-shadow: 0 10px 24px rgba(0,0,0,0.4);
  overflow: hidden;
}
.m-player.visible { transform: translateY(0); }
.m-player-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); width: 0%; }

.m-player-cover { width: 44px; height: 44px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center; }
.m-player-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-player-cover svg { width: 40%; height: 40%; color: var(--text-muted); }

.m-player-meta { flex: 1; min-width: 0; }
.m-player-meta .name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-player-meta .artist { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-player-playpause { width: 36px; height: 36px; border-radius: 50%; background: var(--text-primary); border: none; color: #000; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-player-playpause svg { width: 15px; height: 15px; }
.m-player-more { width: 30px; height: 30px; border-radius: 50%; background: none; border: none; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-player-more svg { width: 18px; height: 18px; }

/* ---------- Bottom tab bar ---------- */
.m-tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--m-tabbar-height); background: var(--bg-elevated); border-top: 1px solid var(--border); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom, 0); }
.m-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: none; color: var(--text-muted); font-size: 10px; font-weight: 600; }
.m-tab svg { width: 19px; height: 19px; }
.m-tab.active { color: var(--accent); }

/* ---------- Bottom sheet (expanded player) ---------- */
.m-sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 35; display: none; }
.m-sheet-overlay.open { display: block; }

.m-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg-elevated); border-top: 1px solid var(--border); border-radius: 18px 18px 0 0;
  z-index: 36; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0));
  transform: translateY(100%); transition: transform 0.28s ease;
}
.m-sheet.open { transform: translateY(0); }
.m-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 6px auto 16px; }

.m-sheet-cover { width: 100%; max-width: 200px; aspect-ratio: 1; margin: 0 auto 16px; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #2a2a2d, #1a1a1c); display: flex; align-items: center; justify-content: center; box-shadow: 0 16px 32px rgba(0,0,0,0.4); }
.m-sheet-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-sheet-cover svg { width: 30%; height: 30%; color: var(--text-muted); }

.m-sheet-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.m-sheet-meta { min-width: 0; }
.m-sheet-meta .name { font-family: var(--font-display); font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sheet-meta .artist { font-size: 13px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sheet-fav { background: none; border: none; color: var(--text-muted); width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.m-sheet-fav.active { color: var(--accent); }
.m-sheet-fav svg { width: 20px; height: 20px; }

.m-sheet-seek-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.m-sheet-seek-row .time { font-size: 11px; color: var(--text-muted); width: 32px; flex-shrink: 0; }
.m-sheet-seek-row .time.end { text-align: right; }

.m-sheet-transport { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 20px; }
.m-sheet-transport button { background: none; border: none; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; position: relative; }
.m-sheet-transport button.active { color: var(--accent); }
.m-sheet-transport .m-mini-btn svg { width: 20px; height: 20px; }
.m-sheet-transport .m-side-btn svg { width: 24px; height: 24px; }
.m-sheet-playpause-big { width: 62px; height: 62px; border-radius: 50%; background: var(--accent) !important; color: #000 !important; }
.m-sheet-playpause-big svg { width: 26px; height: 26px; }

.m-sheet-actions { display: flex; align-items: center; justify-content: center; gap: 30px; margin-bottom: 16px; }
.m-sheet-actions button, .m-sheet-actions a { background: none; border: none; color: var(--text-secondary); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; }
.m-sheet-actions button.active { color: var(--accent); }
.m-sheet-actions svg { width: 19px; height: 19px; }

.m-sheet-volume { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.m-sheet-volume svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }

.m-lyrics-view { display: none; }
.m-lyrics-view.open { display: block; }
.m-lyrics-view .m-lyrics-back { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); background: none; border: none; font-size: 13px; margin-bottom: 14px; }
.m-lyrics-view .m-lyrics-back svg { width: 16px; height: 16px; }
.m-lyrics-view .m-lyrics-title { font-family: var(--font-display); font-size: 16px; margin-bottom: 12px; }
.m-lyrics-view .m-lyrics-text { white-space: pre-line; font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.m-sheet-controls-view.hidden { display: none; }

.device-switch { text-align: center; padding: 10px 16px 4px; }
