:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2332;
  --muted: #6b7a90;
  --primary: #77263D;
  --primary-hover: #5c1e30;
  --primary-light: #f8f0f3;
  --primary-muted: rgba(119, 38, 61, 0.12);
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.site-header {
  background: linear-gradient(135deg, #4a1828 0%, #77263D 100%);
  color: #fff;
  padding: 28px 20px;
  margin-bottom: 32px;
}

.site-header .inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-header nav a {
  color: rgba(255, 255, 255, 0.9);
  margin-left: 20px;
  font-size: 0.95rem;
}

.site-header nav a:hover {
  color: #fff;
  text-decoration: none;
}

.page-title {
  font-size: 1.35rem;
  margin-bottom: 24px;
  font-weight: 600;
}

.news-grid {
  display: grid;
  gap: 20px;
}

.news-card {
  display: flex;
  gap: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}

.news-card .thumb {
  width: 200px;
  min-height: 140px;
  flex-shrink: 0;
  background: #e8edf4;
  object-fit: cover;
}

.news-card .thumb-placeholder {
  width: 200px;
  min-height: 140px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #e8edf4, #d4dce8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.news-card .body {
  padding: 20px 20px 20px 0;
  flex: 1;
  min-width: 0;
}

.news-card h2 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-card h2 a {
  color: var(--text);
  text-decoration: none;
}

.news-card h2 a:hover {
  color: var(--primary);
}

.news-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.news-card .excerpt {
  margin-top: 10px;
  font-size: 0.92rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--card);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding: 20px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.pagination a {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--primary);
  font-size: 0.95rem;
}

.pagination a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.pagination-prev.is-disabled,
.pagination-next.is-disabled {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: #b0bac8;
  font-size: 0.95rem;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Detail */
.article-header {
  margin-bottom: 28px;
}

.article-header h1 {
  font-size: 1.75rem;
  line-height: 1.35;
  margin-bottom: 12px;
}

.article-header .meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.article-description {
  margin-top: 14px;
  font-size: 0.98rem;
  line-height: 1.75;
  color: #4a5568;
}

.article-thumb {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.article-content {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.article-content p {
  margin-bottom: 1em;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

.content-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.content-gallery img {
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* 纯图片：居中、满宽、高度自适应 */
.content-gallery--image-only {
  display: block;
  margin-bottom: 24px;
}

.content-gallery--image-only img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.content-gallery--image-only img:last-child {
  margin-bottom: 0;
}

.attachments {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.attachments h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.attachments ul {
  list-style: none;
}

.attachments li {
  margin-bottom: 8px;
}

.attachments a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.attachments a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

/* Admin form */
.admin-wrap {
  max-width: 720px;
}

.form-card {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="datetime-local"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

.form-group textarea {
  min-height: 160px;
  resize: vertical;
}

.type-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.type-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.type-options input:checked + span,
.type-options label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: var(--primary-hover);
}

.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.field-hidden {
  display: none;
}

.required {
  color: #77263D;
}

/* Admin login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4a1828 0%, #77263D 100%);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: var(--card);
  padding: 36px 32px;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 6px;
  text-align: center;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form .form-group input[type="text"],
.login-form .form-group input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.btn-block {
  width: 100%;
  text-align: center;
}

/* Admin manage */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.admin-toolbar .page-title {
  margin-bottom: 0;
}

.admin-table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table .col-title {
  max-width: 320px;
}

.col-actions {
  white-space: nowrap;
}

.col-actions a {
  margin-right: 12px;
}

.link-danger {
  color: #b91c1c;
}

.link-danger:hover {
  color: #991b1b;
}

.btn-danger {
  background: #b91c1c;
}

.btn-danger:hover {
  background: #991b1b;
}

.btn-secondary {
  background: var(--muted);
  color: #fff;
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 1rem;
}

.btn-secondary:hover {
  background: #556275;
  text-decoration: none;
}

.delete-target-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 16px 0 24px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
}

.delete-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.current-file {
  margin-bottom: 12px;
}

.preview-thumb {
  max-width: 200px;
  max-height: 120px;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.preview-small {
  max-width: 120px;
  max-height: 80px;
  border-radius: 6px;
  display: block;
  margin-bottom: 6px;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.file-list-item {
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: normal;
  cursor: pointer;
}

.attach-list {
  list-style: none;
  margin-bottom: 12px;
}

.attach-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

@media (max-width: 640px) {
  .news-card {
    flex-direction: column;
  }

  .news-card .thumb,
  .news-card .thumb-placeholder {
    width: 100%;
    min-height: 180px;
  }

  .news-card .body {
    padding: 16px;
  }

  .article-content {
    padding: 20px;
  }
}
