/**
 * VUP 语录网站样式
 * 二次元简约风，天蓝色主题，暗黑模式，响应式
 */

:root {
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --bg: #f0f9ff;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  --radius: 16px;
  --nav-height: 60px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.nav-brand .logo { font-size: 1.5rem; }

.nav-search {
  flex: 1;
  max-width: 400px;
  margin: 0 20px;
}

.nav-search input {
  width: 100%;
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.nav-search input:focus { border-color: var(--primary); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-actions button,
.nav-actions .btn-admin {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-actions button:hover,
.nav-actions .btn-admin:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== 主内容区 ===== */
.main {
  padding-top: calc(var(--nav-height) + 20px);
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 40px;
}

/* ===== 标签栏 ===== */
.tags-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 4px 0;
}

.tag {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.tag:hover { border-color: var(--primary); color: var(--primary); }
.tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 语录网格 ===== */
.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.quote-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.quote-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.15);
}

.quote-image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  display: block;
}

.quote-body {
  padding: 14px 16px;
}

.quote-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.quote-tags {
  display: flex;
  gap: 4px;
}

.quote-tag {
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
}

.quote-audio-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.quote-audio-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* ===== 加载与空状态 ===== */
.loading, .no-more {
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== 弹窗 ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active { display: flex; }

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
  z-index: 10;
}

.modal-image {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-text {
  padding: 20px;
  font-size: 1.1rem;
  line-height: 1.6;
  text-align: center;
  white-space: pre-wrap;
}

.modal-audio {
  padding: 0 20px 10px;
  display: flex;
  justify-content: center;
}

.modal-audio audio { width: 100%; }

.modal-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

.modal-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.modal-actions button:hover { background: var(--primary-dark); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .navbar { padding: 0 12px; }
  .nav-brand .title { display: none; }
  .nav-search { margin: 0 8px; }
  .nav-actions .btn-admin { font-size: 0.8rem; padding: 4px 8px; }
  .quotes-grid { grid-template-columns: 1fr; gap: 14px; }
  .main { padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 768px) and (max-width: 1200px) {
  .quotes-grid { grid-template-columns: repeat(2, 1fr); }
}
