/* =========================================================
   KALAOK — 全局样式表
   ========================================================= */

/* ---------- CSS 变量 ---------- */
:root, [data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-hover: #24243a;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #6a6a80;
  --accent: #f0c040;
  --accent-dim: #a08020;
  --accent-bg: rgba(240, 192, 64, 0.12);
  --highlight-bg: rgba(240, 192, 64, 0.08);
  --border: #2a2a40;
  --border-light: #3a3a50;
  --overlay: rgba(0, 0, 0, 0.7);
  --toast-bg: #2a2a40;
  --radius: 12px; --radius-sm: 8px;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #eeeef2;
  --text-primary: #1a1a2e;
  --text-secondary: #5a5a72;
  --text-muted: #9a9ab0;
  --accent: #d4a019;
  --accent-dim: #b08810;
  --accent-bg: rgba(212, 160, 25, 0.10);
  --highlight-bg: rgba(212, 160, 25, 0.06);
  --border: #e0e0ea;
  --border-light: #d0d0da;
  --overlay: rgba(0,0,0,0.4);
  --toast-bg: #1a1a2e;
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
  background: var(--bg-primary); color: var(--text-primary);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, textarea, select { font: inherit; }
ul { list-style: none; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* ---------- 布局 ---------- */
.container { max-width: 800px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 1rem; font-weight: 700; flex: 1; }
.topbar-action {
  padding: 6px 14px; border-radius: 20px; font-size: 0.82rem;
  background: var(--bg-hover); color: var(--text-secondary);
  transition: background .2s, color .2s; white-space: nowrap;
}
.topbar-action:active { background: var(--border-light); }

/* ---------- 搜索 ---------- */
.search-wrap { padding: 12px 16px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px; padding: 0 16px; transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--accent-dim); }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  padding: 12px 0; font-size: 0.9rem; color: var(--text-primary);
}
.search-box .icon { color: var(--text-muted); font-size: 1.1rem; }



.tab {
  flex-shrink: 0; padding: 6px 18px; border-radius: 20px;
  font-size: 0.82rem; background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border); transition: all .2s;
}
.tab.active { background: var(--accent); color: #1a1a2e; border-color: var(--accent); font-weight: 600; }

/* ---------- 歌曲卡片 ---------- */
.song-list { display: flex; flex-direction: column; gap: 6px; padding: 0 16px; }
.song-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: border-color .2s; cursor: pointer;
}
.song-card:active { border-color: var(--accent-dim); }
.song-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.song-info { flex: 1; min-width: 0; }
.song-title { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.song-fav { font-size: 1.1rem; color: var(--text-muted); cursor: pointer; padding: 4px; transition: color .2s; }
.song-fav.active { color: var(--accent); }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- 小节标题 ---------- */
.section-title {
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  padding: 16px 16px 8px; text-transform: uppercase; letter-spacing: 0.5px;
}
.section-title .more { float: right; font-weight: 400; text-transform: none; font-size: 0.8rem;
  color: var(--accent); cursor: pointer; }

/* ---------- 广告 ---------- */
.ad-container { display: none; padding: 8px 16px; }
.ad-placeholder {
  background: var(--bg-card); border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm); padding: 16px; text-align: center;
  min-height: 60px; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--text-muted);
}

/* ---------- 面板覆盖 ---------- */
.sheet-overlay {
  display: none; position: fixed; inset: 0; background: var(--overlay);
  z-index: 50; justify-content: center; align-items: flex-end;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--bg-primary); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 500px; max-height: 85vh;
  padding: 20px; overflow-y: auto;
}
.sheet-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.sheet-header h2 { font-size: 1.1rem; }
.sheet-close { font-size: 1.5rem; color: var(--text-muted); cursor: pointer; padding: 4px; }

/* ---------- 设置表单 ---------- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.setting-row label { font-size: 0.9rem; }
.setting-row select, .setting-row .chip-group { display: flex; gap: 6px; }
.chip {
  padding: 4px 14px; border-radius: 14px; font-size: 0.78rem;
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--border); transition: all .2s; cursor: pointer;
}
.chip.active { background: var(--accent); color: #1a1a2e; border-color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: #fff; font-size: 0.85rem;
  padding: 10px 24px; border-radius: 24px; z-index: 100;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.toast.show { opacity: 1; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: var(--overlay);
  z-index: 60; align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: var(--bg-primary); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 720px; padding: 20px; overflow-y: auto;
  max-height: 92vh;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.05rem; }
.modal-close { font-size: 1.5rem; color: var(--text-muted); cursor: pointer; line-height: 1; }

/* ---------- 后台管理 ---------- */
.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 4px; }
.admin-field input, .admin-field textarea, .admin-field select {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-secondary);
  color: var(--text-primary); font-size: 0.9rem; outline: none;
  transition: border-color .2s;
}
.admin-field input:focus, .admin-field textarea:focus { border-color: var(--accent-dim); }
.admin-field textarea { min-height: 80px; resize: vertical; font-family: "Menlo","Consolas",monospace; font-size: 0.82rem; }
.admin-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
}
.admin-toggle-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-toggle {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--bg-hover); border: 1px solid var(--border);
  position: relative; cursor: pointer; transition: background .2s;
}
.admin-toggle.active { background: var(--accent); border-color: var(--accent-dim); }
.admin-toggle::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: white; top: 2px; left: 2px; transition: transform .2s;
}
.admin-toggle.active::after { transform: translateX(20px); }
.admin-checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 0.85rem; }
.admin-checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.admin-status {
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 0.82rem;
  display: none; margin-bottom: 10px;
}
.admin-status.show { display: block; }
.admin-status.success { background: rgba(64,200,100,0.15); color: #40c864; border: 1px solid rgba(64,200,100,0.3); }
.admin-status.error { background: rgba(224,80,80,0.15); color: #e05050; border: 1px solid rgba(224,80,80,0.3); }
.save-btn {
  padding: 10px 28px; border-radius: 24px; background: var(--accent);
  color: #1a1a2e; font-weight: 700; font-size: 0.95rem; transition: opacity .2s;
}
.save-btn:active { opacity: 0.8; }
.save-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.control-chip {
  padding: 4px 12px; border-radius: 12px; font-size: 0.72rem;
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; transition: border-color .2s;
}

/* ---------- 后台 Tab ---------- */
.admin-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  flex-shrink: 0; padding: 10px 20px; font-size: 0.88rem;
  color: var(--text-secondary); border-bottom: 2px solid transparent; transition: all .2s;
}
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-section { display: none; padding: 16px; }
.admin-section.active { display: block; }

/* ---------- 桌面适配 ---------- */
@media (min-width: 768px) {
  .container { max-width: 640px; }
  .search-wrap { padding: 20px 16px; }
  .tabs { justify-content: center; }
  .admin-section.active { max-width: 640px; margin: 0 auto; }
}
@media (min-width: 1024px) {
  .container { max-width: 720px; }
}

/* ---------- 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.open, .sheet-overlay.open { animation: fadeIn .2s; }


/* =========================================================
   KALAOK — 站点页脚
   ========================================================= */
.site-footer {
  margin-top: 32px;
  padding: 28px 20px 20px;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.6;
}
.site-footer .footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.site-footer .footer-col h4 {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-footer .footer-col p { color: var(--text-muted); font-size: 0.78rem; }
.site-footer .footer-col ul li {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.site-footer .footer-col ul li a {
  color: var(--text-secondary);
  transition: color .15s;
}
.site-footer .footer-col ul li a:hover { color: var(--accent); }
.site-footer .qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.site-footer .qr-frame {
  width: 132px;
  height: 132px;
  padding: 8px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.site-footer .qr-frame img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.site-footer .qr-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #6a6a80; font-size: 0.7rem; text-align: center; padding: 4px;
  background: #f5f5f8; border-radius: 4px;
}
.site-footer .qr-caption { font-size: 0.78rem; color: var(--text-secondary); }
.site-footer .qr-sub { font-size: 0.7rem; color: var(--text-muted); }
.site-footer .footer-bottom {
  max-width: 960px;
  margin: 18px auto 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer .footer-bottom a { color: var(--text-muted); }
.site-footer .footer-bottom a:hover { color: var(--accent); }

/* 窄屏：双列 + QR 单独居中 */
@media (max-width: 720px) {
  .site-footer .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .site-footer .qr-block {
    grid-column: 1 / -1;
    flex-direction: row;
    text-align: left;
    justify-content: center;
    gap: 14px;
  }
  .site-footer .qr-frame { width: 92px; height: 92px; padding: 6px; }
  .site-footer .qr-text { display: flex; flex-direction: column; gap: 2px; }
}
/* 超窄屏：单列 */
@media (max-width: 420px) {
  .site-footer .footer-inner { grid-template-columns: 1fr; }
  .site-footer .footer-bottom { justify-content: center; text-align: center; }
}
