/* LiveChord — 全站樣式 */

/* ========== [COMPONENT: ROOT & GLOBAL] ========== */

:root {
  --bg: #0d1117;
  --bg-card: rgba(22, 27, 34, 0.7);
  --bg-hover: rgba(48, 54, 61, 0.8);
  --accent: #2196F3;
  --accent-dim: #1976D2;
  --text: #ffffff;
  --text-dim: #a3b3cc;
  --border: rgba(255, 255, 255, 0.1);
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --glass-blur: blur(12px);

  /* Purple chord gradient & glow (shared across active chord badges) */
  --chord-gradient:
    linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.04) 38%, transparent 50%),
    linear-gradient(180deg, #9b49db 0%, #7c3aed 30%, #6d28d9 60%, #5b21b6 100%);
  --chord-glow:
    0 0 24px rgba(147,51,234,0.5),
    0 0 48px rgba(147,51,234,0.25),
    inset 0 1px 2px rgba(255,255,255,0.35),
    inset 0 -1px 2px rgba(0,0,0,0.2);
  --chord-text-shadow: 0 0 14px rgba(255,255,255,0.4), 0 1px 2px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== [END: ROOT & GLOBAL] ========== */


/* ========== [COMPONENT: HEADER] ========== */

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.header .search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header .search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.header .search-box input:focus {
  border-color: var(--accent);
}

.header .search-box::before {
  content: "\1F50D";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

.search-marquee {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}
.header .search-box .search-marquee { left: 36px; right: 14px; }
.topbar-search .search-marquee { left: 14px; right: 14px; }
.header .search-box input::placeholder,
.topbar-search input::placeholder { color: transparent; }
.header .search-box input:focus ~ .search-marquee,
.header .search-box input:not(:placeholder-shown) ~ .search-marquee,
.topbar-search input:focus ~ .search-marquee,
.topbar-search input:not(:placeholder-shown) ~ .search-marquee { display: none; }
.search-marquee-text {
  display: inline-block;
  padding-left: 100%;
  animation: lc-search-marquee 11s linear infinite;
}
@keyframes lc-search-marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.header-fs-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  z-index: 10;
  transition: color .2s;
}
.header-fs-btn:hover { color: rgba(255,255,255,0.7); }

.header nav {
  display: flex;
  gap: 4px;
}

.header nav button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .2s;
}
/* User greeting (Hello, name) shrinks first when viewport is tight so the
   button labels keep their natural width and never wrap. */
.header nav #userGreeting {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header nav button.active,
.header nav button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Header overflow menu — houses 匯出資料 + future admin utilities so the
   visible header row stays compact on mobile. */
.header-menu {
  position: relative;
}
.header-menu-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  padding: 6px;
  background: rgba(22,27,34,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 10000;
}
.header-menu-popup.open { display: flex; }
.header-menu-popup button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.header-menu-popup button:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border);
}

/* ========== [END: HEADER] ========== */

/* ========== [COMPONENT: SEARCH RESULTS] ========== */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow);
  display: none;
}

.search-results.show { display: block; }

.search-results .result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s;
}

.search-results .result-item:hover {
  background: var(--bg-hover);
}

.search-results .result-item .r-cover {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: #222;
}

.search-results .result-item .r-info {
  flex: 1;
  min-width: 0;
}

.search-results .result-item .r-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-results .result-item .r-artist {
  font-size: 11px;
  color: var(--text-dim);
}

/* ========== [END: SEARCH RESULTS] ========== */


/* ========== [COMPONENT: TABS] ========== */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  background: var(--bg-card);
}

.tabs button {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  transition: all .2s;
}

.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========== [END: TABS] ========== */


/* ========== [COMPONENT: LAYOUT] ========== */

.content {
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: #555; }

/* ========== [END: LAYOUT] ========== */
/* ========== [COMPONENT: TOAST] ========== */

.toast {
  position: fixed;
  bottom: 64px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
  z-index: 15000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ========== [END: TOAST] ========== */


/* ========== [COMPONENT: RESPONSIVE] ========== */

/* tablet (768-1024px) */
@media (max-width: 1024px) {
  .chord-toolbar { gap: 4px; }
  .chord-ribbon { min-height: 120px; }
  .chord-item { min-width: 50px; padding: 4px 8px; }
  .chord-item .chord-name { font-size: 14px; }
}

/* phone (< 640px) */
@media (max-width: 640px) {
  .header { flex-wrap: wrap; padding: 10px 12px; }
  .header .search-box { max-width: none; order: 3; flex-basis: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .player-header { flex-direction: row; }
  .player-cover { width: 56px; height: 56px; }
  .chord-toolbar { padding: 8px; }
  .chord-ribbon { min-height: 100px; }
  .chord-88-keys { min-height: 100px; }
  #modeSwitch { flex-wrap: wrap; }
}

/* ========== [END: RESPONSIVE] ========== */
