/* === Mobile-first: Variables & Base === */
:root{
  --bg:#0f0f12;
  --panel:#15151b;
  --text:#e5e7eb;
  --muted:#a1a1aa;
  --accent:#f59e0b;
  --accent2:#22d3ee;
  --card:#1c1c24;
  --radius:18px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, #12121a, #0c0c10 60%), var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}

.container{max-width:1000px;margin:0 auto;padding:20px}

/* === Header / Hero === */
.header{
  display:flex; gap:16px; align-items:center;
  background:linear-gradient(135deg, rgba(34,211,238,.12), rgba(245,158,11,.10));
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  padding:16px; box-shadow:var(--shadow);
}
.header img{
  width:112px; height:112px; flex:0 0 auto;
  border-radius:14px; background:#0b0b0f; object-fit:cover;
  border:1px solid rgba(255,255,255,.08);
}
.header h1{margin:0; font-size:clamp(20px,3.5vw,28px); line-height:1.15}
.small{font-size:.9rem; color:var(--muted)}

/* Badges & Controls */
.badges{display:flex; gap:8px; flex-wrap:wrap; margin:8px 0 0}
.badge{
  background:var(--card); border:1px solid rgba(255,255,255,.08);
  padding:6px 10px; border-radius:999px; color:#cbd5e1; font-size:.8rem;
}
.controls{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
button{
  background:linear-gradient(135deg, var(--accent), #ef4444);
  color:#0a0a0a; border:0; padding:10px 14px; border-radius:10px;
  font-weight:700; cursor:pointer; box-shadow:0 6px 18px rgba(239,68,68,.35);
}
button.secondary{
  background:var(--card); color:var(--text); box-shadow:none;
  border:1px solid rgba(255,255,255,.08);
}
button[disabled]{
  opacity:.5;
  cursor:not-allowed;
}
button.secondary.subtle{
  color:var(--muted);
  border-color:rgba(255,255,255,.05);
  background:transparent;
  box-shadow:none;
  transition:color .2s ease, border-color .2s ease;
}
button.secondary.subtle:hover{
  color:var(--text);
  border-color:rgba(255,255,255,.15);
}

.hidden{display:none !important;}

.cardActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
}

.downloadBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.2rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  transition: background 0.2s ease;
}

.downloadBtn:hover {
  background: rgba(255,255,255,0.08);
}

.buttonLike{
  display:inline-block;
  background:linear-gradient(135deg, var(--accent), #ef4444);
  color:#0a0a0a; text-decoration:none;
  padding:10px 14px; border-radius:10px; font-weight:700;
  box-shadow:0 6px 18px rgba(239,68,68,.35);
}
.buttonLike:active{ transform:translateY(1px) }


/* Suche & Filter */
.utilityBar{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  justify-content:space-between;
}
.searchField{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1 1 240px;
  padding:8px 12px;
  border-radius:12px;
  background:rgba(28,28,36,0.85);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 8px 18px rgba(0,0,0,.25);
  transition:border-color .2s ease, box-shadow .2s ease;
}
.searchField:focus-within{
  border-color:rgba(34,211,238,.6);
  box-shadow:0 0 0 1px rgba(34,211,238,.35);
}
.searchIcon{opacity:.75; font-size:1rem;}
.searchField input{
  flex:1 1 auto;
  min-width:120px;
  border:0;
  background:transparent;
  color:var(--text);
  font-size:.95rem;
  outline:none;
}
.searchField input::placeholder{color:rgba(229,231,235,.6);}
.resultInfo{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  font-size:.9rem;
  color:var(--muted);
}
.resultInfo span{white-space:normal;}


/* === Playlist === */
.playlistPanel{
  margin-top:20px;
  background:var(--panel);
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  padding:18px;
  box-shadow:var(--shadow);
}
.playlistHead h2{margin:0; font-size:1.3rem;}
.playlistHead p{margin:6px 0 14px; color:var(--muted); font-size:.95rem;}
.playlistControls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:0 0 12px;
}
.playlistControls button{flex:1 1 160px;}
.playlistControls button.primary{box-shadow:0 8px 20px rgba(245,158,11,.35);}
.playlistStatus{
  margin:0 0 12px;
  color:var(--muted);
  font-size:.9rem;
}
.playlistItems{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.playlistItem{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  background:rgba(28,28,36,.85);
  border-radius:12px;
  border:1px solid rgba(255,255,255,.06);
  transition:border-color .2s ease, box-shadow .2s ease;
}
.playlistItem.playing{
  border-color:rgba(34,211,238,.6);
  box-shadow:0 0 0 1px rgba(34,211,238,.35);
}
.playlistItem.paused{
  border-style:dashed;
  border-color:rgba(34,211,238,.35);
}
.playlistOrder{
  font-weight:600;
  color:var(--accent2);
  min-width:28px;
  text-align:center;
}
.playlistLabel{
  flex:1 1 auto;
  text-align:left;
  background:transparent;
  border:0;
  color:var(--text);
  font-weight:600;
  font-size:.95rem;
  padding:0;
  box-shadow:none;
  border-radius:0;
  cursor:pointer;
}
.playlistLabel:hover{color:#fff;}
.playlistItemButtons{display:flex; gap:6px;}
.tinyBtn{
  padding:6px 8px;
  font-size:.8rem;
  min-width:0;
}
.tinyBtn.danger{
  color:#fca5a5;
  border-color:rgba(239,68,68,.35);
}
.playlistEmpty{
  margin:12px 0 0;
  color:var(--muted);
  font-size:.9rem;
}


/* === Track Grid (cards) === */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
  gap:14px; margin-top:18px;
}
.grid.is-empty{display:block;}
.card{
  background:var(--panel);
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  padding:12px; box-shadow:var(--shadow);
}
.card.playing{
  border-color:rgba(34,211,238,.8);
  box-shadow:0 0 0 1px rgba(34,211,238,.35), var(--shadow);
}
.title{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin-bottom:4px;
}
.titleText{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1 1 auto;
  min-width:0;
}
.titleText h3{
  margin:0;
  font-size:1rem;
  line-height:1.3;
  white-space:normal;
  overflow:visible;
}
.trackNo{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:28px;
  padding:0 6px;
  border-radius:999px;
  background:rgba(34,211,238,.12);
  color:var(--accent2);
  font-size:.8rem;
  font-weight:600;
}
.card.playing .trackNo{background:var(--accent2); color:#0a0a0a;}
.card.playing .titleText h3{color:#fff;}
.meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:4px 0 6px;
  font-size:.8rem;
  color:var(--muted);
}
.pill{
  padding:4px 8px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
}
.emptyState{
  max-width:420px;
  margin:0 auto;
  padding:36px 20px;
  background:rgba(21,21,27,.85);
  border-radius:var(--radius);
  border:1px dashed rgba(255,255,255,.08);
  box-shadow:var(--shadow);
}
.emptyState h3{margin:0 0 8px; font-size:1.1rem;}
.emptyState p{margin:0; color:var(--muted);}
.smallBtn{padding:6px 10px; font-size:.85rem}

audio{
  width:100%; height:40px; margin-top:8px; border-radius:10px; background:#000;
}

body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

/* Mini Player – sticky full width */
#miniPlayer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(21,21,27,0.98);
  border-top: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
  z-index: 1000;
  transform: translateY(0);
  transition: transform .25s ease;
}
#miniPlayer.hidden { transform: translateY(110%); }

#miniPlayer .mp-left { flex: 1 1 auto; min-width: 0; }
#mp-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#miniPlayer .mp-controls { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
#miniPlayer button {
  appearance: none; border: 0; background: #2a2a33; color: #e5e7eb;
  padding: 8px 12px; border-radius: 10px; font-size: 1rem; cursor: pointer;
}
#miniPlayer button:hover { background: #3a3a44; }


/* === Footer === */
.footer{opacity:.85; color:var(--muted); margin:24px 0; text-align:center; font-size:.85rem}
a{color:var(--accent2); text-decoration:none}

.infoPanel .infoGrid{display:grid; gap:12px;}
.infoPanel details{
  background:rgba(21,21,27,.85);
  border:1px solid rgba(255,255,255,.06);
  border-radius:14px;
  padding:12px 14px;
  box-shadow:0 10px 24px rgba(0,0,0,.35);
}
.infoPanel details[open]{border-color:rgba(34,211,238,.4);}
.infoPanel summary{
  cursor:pointer;
  font-weight:600;
  list-style:none;
  display:flex;
  align-items:center;
  gap:8px;
}
.infoPanel summary::-webkit-details-marker{display:none;}
.infoPanel p{margin:8px 0 0; color:var(--muted);}

/* === Responsive Tweaks === */

/* ≥ 600px: etwas luftiger */
@media (min-width: 600px){
  .header{padding:18px}
  .grid{gap:16px}
}

/* ≤ 700px: Header stapeln, größere Touch-Ziele */
@media (max-width: 700px){
  .header{flex-direction:column; align-items:flex-start}
  .header img{width:96px; height:96px}
  .controls button{flex:1 1 auto}
  .utilityBar{flex-direction:column; align-items:stretch}
  .resultInfo{justify-content:space-between; width:100%;}
  .resultInfo span{white-space:normal;}
  .title{flex-wrap:wrap}
  .smallBtn{width:100%}
  .playlistControls button{flex:1 1 100%;}
  .playlistItem{flex-direction:column; align-items:flex-start;}
  .playlistItemButtons{width:100%; justify-content:flex-end; margin-top:6px;}
}

/* ≤ 420px: Einzelspalte, Typo anpassen */
@media (max-width: 420px){
  .grid{grid-template-columns:1fr}
  .badge{font-size:.75rem}
  .title h3{font-size:.95rem}
  audio{height:44px}
}

/* Barrierefreiheit / Motion preferences */
@media (prefers-reduced-motion: reduce){
  *{animation:none !important; transition:none !important}
}
