/* ===== Thiruppugazh 503 — mobile-first styles ===== */

:root {
  --bg: #fdf6ec;
  --card: #ffffff;
  --ink: #2b2018;
  --muted: #7a6a58;
  --accent: #c0392b;      /* kumkum red */
  --accent-dark: #96271b;
  --gold: #d99a2b;
  --border: #ecdfce;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --radius: 14px;
  --tap: 48px;            /* minimum touch target */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Tamil", "Latha", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* App is centered and phone-width capped so it looks good on desktop too */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding: 14px 16px calc(14px + env(safe-area-inset-top));
  padding-top: max(14px, env(safe-area-inset-top));
  box-shadow: var(--shadow);
}
.header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .3px;
}
.header .sub {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: .9;
}

/* ---- Search ---- */
.searchbar {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--bg);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.searchbar input {
  width: 100%;
  height: var(--tap);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 18px;
  font-size: 16px;         /* 16px+ prevents iOS zoom-on-focus */
  background: #fff;
  color: var(--ink);
  outline: none;
}
.searchbar input:focus { border-color: var(--gold); }
.count {
  margin: 6px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---- Shelves (recently viewed / favourites) ---- */
[hidden] { display: none !important; }
.shelf {
  padding: 10px 14px 2px;
}
.shelf-title {
  margin: 0 2px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.chip-num {
  flex: 0 0 auto;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.chip-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Song list ---- */
.list {
  list-style: none;
  margin: 0;
  padding: 8px 12px calc(24px + env(safe-area-inset-bottom));
  flex: 1;
}
.song-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.song {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .05s ease;
}
.song:active { transform: scale(.99); }
.fav-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 12px;
}
.fav-btn.on { color: var(--accent); }
.fav-btn:active { transform: scale(.92); }
.song .num {
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.song .title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  word-break: break-word;
}
.song .chev { color: var(--gold); font-size: 20px; flex: 0 0 auto; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 15px;
}

/* ---- Song detail page ---- */
.detail {
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  flex: 1;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--tap);
  color: var(--accent);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}
.songcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.songcard .bignum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  padding: 0 10px;
}
.songcard .bigtitle {
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0 2px;
}
.songcard .oldno { font-size: 13px; color: var(--muted); }
.card-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.fav-toggle, .share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.fav-toggle {
  border: 1px solid var(--gold);
  background: #fffdf8;
  color: var(--accent-dark);
}
.fav-toggle .fav-ico { font-size: 20px; color: var(--gold); line-height: 1; }
.fav-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fav-toggle.on .fav-ico { color: #fff; }
.fav-toggle:active, .share-btn:active { transform: scale(.98); }
.share-btn {
  border: 1px solid #1ebe57;
  background: #25d366;   /* WhatsApp green */
  color: #fff;
}
.share-btn .share-ico { font-size: 18px; line-height: 1; }

/* ---- Action buttons ---- */
.actions { display: flex; flex-direction: column; gap: 12px; }
.btn {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  border-radius: var(--radius);
  padding: 12px 18px;
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: #fff;
  width: 100%;
  text-align: left;
}
.btn .ico { font-size: 22px; flex: 0 0 auto; }
.btn .label { flex: 1; }
.btn .hint { font-size: 12px; font-weight: 400; opacity: .85; display: block; }
.btn-lyrics { background: linear-gradient(135deg,#8e44ad,#6c3483); }
.btn-youtube { background: linear-gradient(135deg,#e53935,#b71c1c); }
.btn-audio { background: linear-gradient(135deg,#00897b,#00695c); }

/* ---- Responsive YouTube embed ---- */
.videowrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;      /* keeps it phone-friendly, no overflow */
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.videowrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-pending {
  margin: 0 0 18px;
  padding: 16px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  font-size: 14px;
}
.video-pending a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  min-height: var(--tap);
  line-height: var(--tap);
}

/* ---- Lyrics ---- */
.lyrics {
  background: linear-gradient(180deg, #fff8ec, #fffdf8);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.lyrics-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
  border-bottom: 2px solid var(--gold);
}
.lyrics-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
}
.lyrics-imagewrap {
  border-radius: 10px;
  background: #fffdf8;
  padding: 10px;
  box-shadow: inset 0 0 0 1px var(--gold);
}
.lyrics-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}

/* ---- Audio player ---- */
.player {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.player audio { width: 100%; }
.player .noaudio {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 6px 4px;
}

/* ---- Footer ---- */
.footer {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.footer a { color: var(--accent); }

.loading { text-align: center; padding: 40px; color: var(--muted); }
