/* ===== Design Tokens ===== */
:root {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-alt: #f5f3ef;
  --text: #2c2825;
  --text-secondary: #7a726a;
  --text-muted: #b0a89e;
  --accent: #b8860b;
  --accent-light: #f5edd8;
  --accent-hover: #9a7209;
  --border: rgba(44,40,37,0.08);
  --border-strong: rgba(44,40,37,0.15);
  --shadow-sm: 0 1px 3px rgba(44,40,37,0.04);
  --shadow-md: 0 2px 12px rgba(44,40,37,0.06), 0 1px 3px rgba(44,40,37,0.04);
  --radius: 6px;
  --radius-lg: 10px;
  --font-display: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }

/* ===== Header ===== */
header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.logo {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text) !important;
  text-decoration: none !important;
  letter-spacing: 1px;
}

header nav { display: flex; align-items: center; gap: 0; }
header nav a {
  color: var(--text-secondary) !important;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none !important;
  transition: color 0.15s;
  letter-spacing: 0.3px;
}
header nav a:hover { color: var(--text) !important; }
.nav-admin {
  color: var(--accent) !important;
  border-left: 1px solid var(--border);
  margin-left: 6px;
  padding-left: 14px !important;
}

/* ===== Main ===== */
main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

@media (max-width: 768px) {
  main { padding: 24px 16px 40px; }
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-strong);
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 2px;
}

/* ===== Search ===== */
.search-section { margin-bottom: 20px; }
.search-form {
  display: flex;
  gap: 0;
}
.search-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-card);
  color: var(--text);
}
.search-form input:focus {
  border-color: var(--accent);
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form button {
  padding: 10px 20px;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-family: var(--font-body);
  letter-spacing: 0.5px;
}
.search-form button:hover { background: var(--accent); border-color: var(--accent); }

.stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

/* ===== Categories ===== */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag, .tag-sm {
  display: inline-block;
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.tag { padding: 5px 14px; }
.tag:hover, .tag-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none !important;
}
.tag.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tag.active:hover { background: var(--accent-hover); }
.tag small { color: var(--text-muted); margin-left: 3px; font-size: 11px; }
.tag.active small { color: rgba(255,255,255,0.7); }

/* ===== Cards ===== */
.list { display: flex; flex-direction: column; gap: 1px; background: var(--border); }
.card {
  display: block;
  background: var(--bg-card);
  padding: 18px 22px;
  transition: background 0.15s;
  color: var(--text) !important;
}
.card:hover {
  background: var(--bg-alt);
  text-decoration: none !important;
}
.card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: 0.5px;
}
.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
  align-items: center;
}
.card-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: pre-line;
  word-break: break-all;
}

/* ===== Sound Cards ===== */
.sound-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); }
.sound-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 14px 22px;
  transition: background 0.15s;
  gap: 16px;
}
.sound-card:hover { background: var(--bg-alt); }
.sound-info { flex: 1; min-width: 0; }
.sound-info h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}
.sound-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.sound-actions { display: flex; gap: 8px; flex-shrink: 0; }
.filesize { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty p { font-size: 14px; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  font-size: 13px;
}
.pagination span { color: var(--text-muted); }
.pagination a {
  padding: 6px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: var(--bg-card);
  transition: all 0.15s;
  font-size: 13px;
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none !important;
}

/* ===== Detail ===== */
.detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: 1px;
}
.detail-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.detail-content p {
  font-size: 14px;
  line-height: 2;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-all;
  letter-spacing: 0.3px;
}

@media (max-width: 768px) {
  .detail { padding: 24px 18px; }
  .detail-content p { font-size: 13px; }
}

.detail-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ===== Upload ===== */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.upload-section h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}
.upload-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.form-group input, .form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg);
  color: var(--text);
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
  background: var(--bg-card);
}
.file-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
  font-family: var(--font-body);
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none !important;
}
.btn-primary {
  background: var(--text);
  color: var(--bg) !important;
  border-color: var(--text);
  padding: 9px 20px;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-download {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
  padding: 7px 16px;
  font-weight: 500;
}
.btn-download:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger {
  background: var(--bg-card);
  color: #c0392b !important;
  border: 1px solid #c0392b;
}
.btn-danger:hover { background: #fdf2f2; }
.btn-sm { padding: 4px 12px !important; font-size: 12px !important; }

/* ===== Login ===== */
.login-page {
  display: flex;
  justify-content: center;
  padding-top: 72px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 360px;
  box-shadow: var(--shadow-md);
}
.login-box h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text);
}
.msg-error {
  background: #fdf2f2;
  color: #c0392b;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid rgba(192,57,43,0.15);
}

/* ===== Admin ===== */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-strong);
}
.admin-tabs .tab {
  padding: 10px 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-weight: 500;
}
.admin-tabs .tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.admin-tabs .tab:hover { text-decoration: none !important; color: var(--text); }

.admin-list table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.admin-list th, .admin-list td {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.admin-list th {
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.admin-list tr:last-child td { border-bottom: none; }
.admin-list .col-id { width: 50px; color: var(--text-muted); }
.admin-list .col-cat { width: 80px; }
.admin-list .col-info { font-size: 12px; color: var(--text-muted); }
.admin-list .col-date { width: 100px; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.admin-list .col-action { width: 70px; }
.admin-list table a { color: var(--accent); font-weight: 500; }

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  letter-spacing: 0.5px;
}
