:root {
  --lyrics-scale: 1;
}

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

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0b0e14;
  color: #ffffff;
}

/* =========================
   TOPBAR
   ========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: #11151f;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #1f2430;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
}

.back-btn {
  margin-right: 12px;
  background: none;
  border: none;
  color: inherit; /* tetap flexible untuk light/dark */
  font-size: 18px;
  cursor: pointer;
}

.hidden {
  display: none;
}

/* =========================
   MAIN LAYOUT
   ========================= */
.app {
  padding: 16px;
  padding-bottom: 100px;
}

.content-body {
  min-height: 60vh;
}

/* =========================
   LIST ITEM
   ========================= */
.list-item {
  background: #151a24;
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid #1f2430;
}

.list-item:hover {
  background: #1b2230;
  transform: translateY(-2px);
}

/* =========================
   MUTED TEXT
   ========================= */
.muted {
  color: #7a8194;
  font-size: 14px;
}

/* =========================
   ALPHABET GRID
   ========================= */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 10px;
}

.alphabet-grid button {
  padding: 12px;
  background: #151a24;
  border: 1px solid #1f2430;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.alphabet-grid button:hover {
  background: #1f2636;
}

/* =========================
   SONG HEADER
   ========================= */
.song-header button {
  background: #1f2636;
  border: none;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.song-header button:hover {
  background: #2a3448;
}

/* =========================
   LYRICS VIEW
   ========================= */
.lyrics {
  background: #0f131b;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #1f2430;

  font-family: "Courier New", monospace;
  line-height: 1.8;
  font-weight: 600;

  /* FONT BASE + ZOOM */
  font-size: calc(clamp(15px, 4vw, 22px) * var(--lyrics-scale));

  /* HEIGHT PAS LAYAR */
  height: calc(100vh - 56px - 60px - 48px);

  overflow-y: auto;
  overflow-x: auto;
  white-space: pre;
}

/* chord styling (single source) */
.chord {
  font-weight: 800;
  font-size: calc(clamp(16px, 4.2vw, 24px) * var(--lyrics-scale));
  color: #4c8dff;
}

.chord.inline {
  font-weight: 700;
  font-size: calc(clamp(15px, 4vw, 22px) * var(--lyrics-scale));
  color: #ffb84c;
}

/* =========================
   BOTTOM TAB
   ========================= */
.bottom-tab {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #11151f;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #1f2430;
}

.bottom-tab button {
  background: none;
  border: none;
  color: #7a8194;
  font-size: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.bottom-tab button:hover {
  color: white;
}

/* =========================
   FLOATING ACTION BUTTON
   ========================= */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #4c8dff;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}

.fab-main:hover {
  background: #6aa0ff;
  transform: scale(1.05);
}

/* visual change when search-open (ke-rotate & warna) */
.search-open .fab-main {
  background: #ff4c4c;
  transform: rotate(90deg);
}

/* =========================
   SEARCH MODAL (FULLSCREEN BASE)
   ========================= */
.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 999;
}

.search-box {
  width: 90%;
  max-width: 500px;
  background: #11151f;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  animation: fadeIn 0.2s ease;
}

.search-box input {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #1f2430;
  background: #0f131b;
  color: white;
  font-size: 15px;
  outline: none;
}

.search-box input:focus {
  border-color: #4c8dff;
}

#searchResults {
  margin-top: 12px;
  max-height: 50vh;
  overflow-y: auto;
}

.search-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.search-item:hover {
  background: #1b2230;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   PREMIUM SEARCH (OVERRIDE)
   - KEEP AS OVERRIDE (tetap di bawah base .search-modal)
   - Ini mereplikasi perilaku yang semula ada (transform/active)
   ========================= */
.search-modal {
  /* override/premium behavior placed after base so kaskade sama seperti file asli */
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  transform: translateY(-110%);
  transition: transform 0.25s ease;
  z-index: 500;
}

.search-modal.active {
  transform: translateY(0);
}

.search-open::before {
  content: "";
  position: fixed;
  inset: 0;
  backdrop-filter: blur(6px);
  background: rgba(0,0,0,0.3);
  z-index: 400;
}

/* Slight variant of search-box for premium (ke-same dengan sebelumnya) */
.search-box {
  background: #11151f;
  border-bottom: 1px solid #1f2430;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

/* smaller searchResults in premium override */
#searchResults {
  margin-top: 12px;
  max-height: 45vh;
  overflow-y: auto;
}

/* highlight mark */
mark {
  background: #4c8dff;
  color: black;
  padding: 0 3px;
  border-radius: 3px;
}

/* =========================
   THEME TOGGLE
   ========================= */
.theme-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

/* =========================
   LIGHT MODE OVERRIDES
   ========================= */
body.light-mode {
  background: #f4f6fb;
  color: #111;
}

body.light-mode .topbar {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

body.light-mode .bottom-tab {
  background: #ffffff;
  border-top: 1px solid #ddd;
}

body.light-mode .list-item,
body.light-mode .alphabet-grid button {
  background: #ffffff;
  border: 1px solid #ddd;
  color: #111;
}

body.light-mode .list-item:hover,
body.light-mode .alphabet-grid button:hover {
  background: #f0f2f7;
}

body.light-mode .lyrics {
  background: #ffffff;
  border: 1px solid #ddd;
  color: #111;
}

body.light-mode .chord {
  color: #2563eb;
}

body.light-mode .chord.inline {
  color: #d97706;
}

body.light-mode .search-box {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

body.light-mode .search-box input {
  background: #f0f2f7;
  border: 1px solid #ddd;
  color: #111;
}

body.light-mode .muted {
  color: #666;
}

body.light-mode .bottom-tab button {
  color: #666;
}

body.light-mode .bottom-tab button:hover {
  color: #111;
}

body.light-mode mark {
  background: #4c8dff;
  color: #fff;
}

/* =========================
   APP BACKGROUND (light/dark)
   ========================= */
body.light-mode .app {
  background: #f4f6fb;
}

body:not(.light-mode) .app {
  background: #0b0e14;
}

/* =========================
   CONTROLS
   ========================= */
.ctrl-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ctrl-group.extra {
  margin-top: 4px;
  padding: 4px 6px;
  background: #151a24;
  border-radius: 8px;
}

.ctrl-group.hidden {
  display: none;
}

.ctrl-group button {
  min-width: 36px;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: #1f2636;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.ctrl-group button:hover {
  background: #2a3448;
}

.expand-btn {
  font-size: 18px;
  padding: 4px 8px;
}