/* ============================================
   Pho Alpha — Tang Dynasty Chinese + Modern
   ============================================ */

:root {
  --vermillion: #c23b22;
  --vermillion-light: #d4563f;
  --ink: #1a1a2e;
  --ink-light: #2d2d44;
  --ivory: #f5f0e1;
  --ivory-dark: #e8e0cc;
  --gold: #d4a843;
  --gold-light: #e4c06a;
  --jade: #5a7d6a;
  --jade-light: #6e9a7f;
  --text: #2c2c3a;
  --text-light: #6b6b7b;
  --border: #d4cfc0;
  --white: #fffaf3;
  --shadow: rgba(26, 26, 46, 0.08);
  --shadow-lg: rgba(26, 26, 46, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--ivory);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Brush Stroke Divider --- */
.brush-divider {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--vermillion), var(--gold), var(--vermillion), transparent);
  margin: 2rem 0;
  border: none;
}

/* --- Header --- */
.site-header {
  background: var(--ink);
  border-bottom: 3px solid var(--vermillion);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ivory);
}

.logo-seal {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.8rem;
  color: var(--vermillion);
  background: var(--gold);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  line-height: 1;
}

.logo-text {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav a {
  color: var(--ivory-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--gold);
}

.main-nav button {
  background: var(--vermillion);
  color: var(--ivory);
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.main-nav button:hover {
  background: var(--vermillion-light);
}

/* --- Main Content --- */
#app {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Homepage: Featured Post --- */
.featured-section {
  margin-bottom: 3rem;
}

.featured-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 5px solid var(--vermillion);
  border-radius: 6px;
  padding: 2rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.featured-card:hover {
  box-shadow: 0 8px 24px var(--shadow-lg);
  transform: translateY(-2px);
}

.featured-label {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.75rem;
  color: var(--vermillion);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.featured-label::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--vermillion);
  border-radius: 50%;
  position: relative;
}

.featured-label::after {
  content: '✦';
  color: var(--gold);
}

.featured-card h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.8rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.featured-card .excerpt {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  line-height: 1.7;
}

.featured-card .meta {
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  gap: 1rem;
}

.featured-card .category-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Category Sections --- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.category-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.category-header {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-header .count {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  background: var(--ivory-dark);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  color: var(--text-light);
}

.cat-high_probability .category-header {
  border-color: var(--jade);
  color: var(--jade);
}

.cat-maybe .category-header {
  border-color: var(--gold);
  color: #8a7030;
}

.cat-possible .category-header {
  border-color: var(--vermillion);
  color: var(--vermillion);
}

.category-posts {
  padding: 0.5rem;
  max-height: 500px;
  overflow-y: auto;
}

.post-card {
  padding: 0.85rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--ivory-dark);
}

.post-card:last-child {
  border-bottom: none;
}

.post-card:hover {
  background: var(--ivory);
}

.post-card h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.post-card .post-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

.post-card .status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.status-approved { background: var(--jade); }
.status-pending { background: var(--gold); }
.status-draft { background: var(--border); }
.status-rejected { background: var(--vermillion); }

.empty-section {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  font-size: 0.85rem;
}

/* --- Post Detail --- */
.post-detail {
  max-width: 800px;
  margin: 0 auto;
}

.post-detail h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 2.2rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-detail .post-info {
  display: flex;
  gap: 1rem;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-detail .post-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 2rem;
}

.post-detail .review-note {
  background: #fff8e1;
  border-left: 3px solid var(--gold);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
}

/* --- Comments --- */
.comments-section {
  margin-top: 2rem;
  border-top: 2px solid var(--border);
  padding-top: 1.5rem;
}

.comments-section h3 {
  font-family: 'Noto Serif SC', serif;
  color: var(--ink);
  margin-bottom: 1rem;
}

.comment {
  padding: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.comment .comment-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}

.comment .comment-body {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--vermillion);
  box-shadow: 0 0 0 3px rgba(194, 59, 34, 0.1);
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--vermillion);
  color: var(--ivory);
}

.btn-primary:hover {
  background: var(--vermillion-light);
}

.btn-secondary {
  background: var(--ink);
  color: var(--ivory);
}

.btn-secondary:hover {
  background: var(--ink-light);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--ivory-dark);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}

.btn-gold:hover {
  background: var(--gold-light);
}

.btn-jade {
  background: var(--jade);
  color: var(--ivory);
}

.btn-jade:hover {
  background: var(--jade-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Auth Pages --- */
.auth-page {
  max-width: 400px;
  margin: 3rem auto;
}

.auth-page h2 {
  font-family: 'Noto Serif SC', serif;
  color: var(--ink);
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2rem;
}

.auth-card .auth-toggle {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.auth-card .auth-toggle a {
  color: var(--vermillion);
  cursor: pointer;
  text-decoration: underline;
}

/* --- Dashboards --- */
.dashboard {
  max-width: 1000px;
  margin: 0 auto;
}

.dashboard h2 {
  font-family: 'Noto Serif SC', serif;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.dashboard .subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.data-table th {
  background: var(--ink);
  color: var(--ivory);
  font-family: 'Noto Serif SC', serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-align: left;
}

.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--ivory-dark);
  font-size: 0.9rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--ivory);
}

/* --- Settings Toggles --- */
.settings-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-family: 'Noto Serif SC', serif;
  color: var(--ink);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--ivory-dark);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.9rem;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 26px;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--jade);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* --- Role Badges --- */
.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-admin { background: var(--vermillion); color: var(--ivory); }
.role-editor { background: var(--gold); color: var(--ink); }
.role-staff { background: var(--jade); color: var(--ivory); }

/* --- Category Badges --- */
.cat-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cat-badge-high_probability { background: #e8f0eb; color: var(--jade); }
.cat-badge-maybe { background: #fdf3dc; color: #8a7030; }
.cat-badge-possible { background: #fce8e4; color: var(--vermillion); }

/* --- Messages --- */
.message {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.message-error {
  background: #fce8e4;
  color: var(--vermillion);
  border: 1px solid var(--vermillion);
}

.message-success {
  background: #e8f0eb;
  color: var(--jade);
  border: 1px solid var(--jade);
}

/* --- Back link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--vermillion);
}

/* --- Footer --- */
.site-footer {
  background: var(--ink);
  color: var(--ivory-dark);
  text-align: center;
  padding: 1.5rem;
  margin-top: auto;
  border-top: 3px solid var(--vermillion);
}

.footer-inner p {
  font-family: 'Noto Serif SC', serif;
  font-size: 0.9rem;
}

.footer-sub {
  font-size: 0.75rem !important;
  opacity: 0.6;
  margin-top: 0.3rem;
}

/* --- Loading --- */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--vermillion);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .featured-card h2 {
    font-size: 1.4rem;
  }

  .post-detail h1 {
    font-size: 1.6rem;
  }

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }
}
