/* InnerPeace - Dark Minimal UI */

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #10101c;
  --bg-card: #161626;
  --bg-card-hover: #1e1e32;
  --bg-card-active: #28284a;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-dim: #555570;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.3);
  --border: #252540;
  --radius: 14px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Header ── */
.header {
  padding: 20px 20px 0;
  padding-top: max(20px, env(safe-area-inset-top));
}
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
.header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}
.header-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Language selector */
.lang-selector {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 4px;
}
.lang-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  font-family: inherit;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
}
.lang-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Container ── */
.container {
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 100px;
  width: 100%;
}

/* Home content: push donate banner to fill remaining space */
.home-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 160px); /* header + nav + padding */
}
.home-content .category-list {
  flex-shrink: 0;
  margin-bottom: 20px;
}
.home-content .donate-banner {
  margin-top: auto;
  margin-bottom: 20px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none; /* shown in header instead */
}

/* ── Bottom Nav ── */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}
.nav-item {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 16px;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 1.2rem; }

/* ── Category Cards ── */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: white;
  transition: transform 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.category-card:active { transform: scale(0.98); opacity: 0.9; }
.category-icon { font-size: 1.6rem; flex-shrink: 0; }
.category-info { flex: 1; min-width: 0; }
.category-name { font-size: 1.05rem; font-weight: 700; }
.category-desc { font-size: 0.78rem; opacity: 0.85; margin-top: 2px; }
.category-arrow { font-size: 1.5rem; opacity: 0.6; }

/* ── Track List View ── */
.tracks-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-radius: var(--radius);
  color: white;
  margin: -16px -16px 0;
  border-radius: 0;
}
.tracks-header-icon { font-size: 1.5rem; }
.tracks-header-name { font-size: 1.2rem; font-weight: 700; }
.tracks-header-desc { font-size: 0.78rem; opacity: 0.85; }

.back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.fav-header-btn, .fav-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
  margin-left: auto;
}
.fav-btn.active { color: #f43f5e; }

.tracks-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 24px 0 16px;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.track-card:hover { background: var(--bg-card-hover); }
.track-card:active { background: var(--bg-card-active); }

.track-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.track-name { font-size: 1rem; font-weight: 600; }
.track-intensity { font-size: 0.75rem; white-space: nowrap; }
.track-freq {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.track-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Intensity legend */
.intensity-legend { margin-bottom: 20px; }
.intensity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.intensity-dot { flex-shrink: 0; }

/* ── Player View ── */
.player-hero {
  margin: -16px -16px 0;
  padding: 20px 20px 28px;
  color: white;
  text-align: center;
}
.player-hero-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.player-hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.player-hero-freq {
  font-size: 0.9rem;
  opacity: 0.85;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.player-hero-intensity {
  font-size: 0.8rem;
  margin-top: 4px;
  opacity: 0.8;
}

.player-controls-area {
  margin-top: 24px;
}

.btn-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255, 0.2);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 16px;
}
.btn-play:hover { background: rgba(255,255,255,0.3); }
.btn-play:active { transform: scale(0.93); }

.player-timer-display {
  font-size: 2rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  margin-bottom: 16px;
  opacity: 0.95;
}
.player-timer-sep {
  opacity: 0.4;
  margin: 0 4px;
  font-size: 1.4rem;
}
.player-timer-total {
  opacity: 0.5;
  font-size: 1.4rem;
}

.player-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  justify-content: center;
}
.vol-icon { font-size: 1rem; opacity: 0.7; }
.volume-slider-inline {
  width: 140px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  outline: none;
}
.volume-slider-inline::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
}
.volume-slider-inline::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  border: none;
}

/* ── Player content sections ── */
.player-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 14px;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.about-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.benefits-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.benefits-list li {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Sound & Duration selectors ── */
.sound-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sound-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sound-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.sound-btn.active { background: var(--bg-card-active); border-color: var(--accent); color: var(--text-primary); }

.duration-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.duration-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.duration-btn:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-primary); }
.duration-btn.active { background: var(--bg-card-active); border-color: var(--accent); color: var(--text-primary); }
.duration-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Empty state for favourites */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; color: var(--text-dim); }
.empty-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* Track category tag in favourites */
.track-category-tag {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Premium star badge */
.premium-star {
  font-size: 0.85em;
  filter: drop-shadow(0 0 3px rgba(250, 204, 21, 0.5));
}


/* Volume rows in player content */
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.volume-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
}
.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}
.volume-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.volume-value {
  font-size: 0.75rem;
  color: var(--text-dim);
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Donation Banner ── */
.donate-banner {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.donate-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}
.donate-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.donate-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.donate-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.donate-amounts {
  display: flex;
  gap: 8px;
}
.donate-amount-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.donate-amount-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.donate-amount-btn.active {
  background: #ff5e5b22;
  border-color: #ff5e5b;
  color: #ff5e5b;
}
.donate-btn {
  display: inline-block;
  background: #ff5e5b;
  color: white;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 24px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 0 20px rgba(255, 94, 91, 0.25);
}
.donate-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(255, 94, 91, 0.4);
}
.donate-btn:active {
  transform: scale(0.97);
}

/* ── Responsive ── */
@media (max-width: 380px) {
  .tracks-header { flex-wrap: wrap; }
  .player-hero-title { font-size: 1.3rem; }
}

@media (display-mode: standalone) {
  .header { padding-top: max(20px, env(safe-area-inset-top)); }
  .nav-bar { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.container > * { animation: fadeIn 0.25s ease-out; }
