/* --- Design Tokens ------------------------------------------------------- */
:root {
  --bg:           #faf9f6;
  --bg-secondary: #f0ede6;
  --text:         #1a1a1a;
  --text-muted:   #6b6b6b;
  --accent:       #8b5e3c;
  --accent-hover: #6e4a2e;
  --border:       #ddd8d0;
  --card-bg:      #ffffff;
  --shadow:       0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.1);
  --font-poetry:  'Poppins', system-ui, sans-serif;
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --radius:       4px;
  --radius-lg:    8px;
  --max-width:    1100px;
  --prose-width:  680px;
  --transition:   0.2s ease;
}

[data-theme="dark"] {
  --bg:           #111110;
  --bg-secondary: #1a1917;
  --text:         #e8e4dc;
  --text-muted:   #9a9590;
  --accent:       #c4895a;
  --accent-hover: #d9a070;
  --border:       #2d2b28;
  --card-bg:      #1a1917;
  --shadow:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.5);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), color var(--transition);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover {
  color: var(--accent-hover);
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-ui);
  cursor: pointer;
}

textarea, input, select {
  font-family: var(--font-ui);
}

/* --- Container ------------------------------------------------------------ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Site Header ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-poetry);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.site-title:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.nav-link:hover {
  color: var(--accent);
}

/* --- Theme Toggle --------------------------------------------------------- */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}

#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(30deg);
}

/* --- Main & Footer -------------------------------------------------------- */
.site-main {
  flex: 1;
  padding: 2.5rem 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

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

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  color: #c0392b;
  border-color: #f5c6c2;
  background: #fef2f0;
}

.btn-danger:hover {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

/* --- Alerts --------------------------------------------------------------- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert ul {
  list-style: disc;
  padding-left: 1.25rem;
}

[data-theme="dark"] .alert-success {
  background: #1a3a25;
  color: #6fcf97;
  border-color: #2d6a3f;
}

[data-theme="dark"] .alert-error {
  background: #3a1a1a;
  color: #eb5757;
  border-color: #6a2d2d;
}

/* --- Type Badges ---------------------------------------------------------- */
.type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.type-poem {
  background: rgba(139, 94, 60, 0.12);
  color: var(--accent);
}

.type-story {
  background: rgba(52, 100, 180, 0.1);
  color: #3464b4;
}

.type-video {
  background: rgba(180, 52, 52, 0.1);
  color: #b43434;
}

[data-theme="dark"] .type-story { color: #5b8ae6; }
[data-theme="dark"] .type-video { color: #e65b5b; }

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
}

.status-published {
  background: rgba(39, 174, 96, 0.12);
  color: #1a7a42;
}

.status-draft {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

[data-theme="dark"] .status-published { color: #4ac97a; }

/* --- Home: Daily Post ------------------------------------------------------ */
.daily-post {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 3rem;
  box-shadow: var(--shadow);
}

.daily-label {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.daily-post-image {
  width: 100%;
  height: 280px;
  background-size: cover;
  background-position: center;
}

.daily-post-content {
  padding: 2rem;
}

.daily-post-title {
  font-family: var(--font-poetry);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.daily-post-title a {
  color: var(--text);
}

.daily-post-title a:hover {
  color: var(--accent);
}

.daily-post-subtitle {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.daily-post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.daily-post-excerpt {
  font-family: var(--font-poetry);
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--text);
  margin-bottom: 1.5rem;
  opacity: 0.85;
}

.excerpt-more {
  color: var(--text-muted);
}

/* --- Posts Section (home) ------------------------------------------------- */
.posts-section {
  margin-top: 1rem;
}

.post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Post List (home alphabetical) --------------------------------------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list-item {
  border-bottom: 1px solid var(--border);
}

.post-list-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.25rem;
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  border-radius: var(--radius);
}

.post-list-link:hover {
  color: var(--accent);
}

.post-list-title {
  font-size: 1rem;
  font-weight: 500;
}

.post-list-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  white-space: nowrap;
}

/* --- Pagination ----------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-link {
  font-size: 0.875rem;
  color: var(--accent);
}

.page-info {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --- Post Layout (sidebar + main) ---------------------------------------- */
.post-layout {
  display: flex;
  gap: 0;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  align-items: flex-start;
}

.post-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1rem 1.5rem 1rem 0;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-item a {
  display: block;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  line-height: 1.4;
  transition: color var(--transition), background var(--transition);
}

.sidebar-item a:hover {
  color: var(--accent);
  background: var(--bg-secondary);
}

.sidebar-item.active a {
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-secondary);
}

.post-main {
  flex: 1;
  min-width: 0;
  max-width: 640px;
  padding: 0 2rem;
}

/* --- Single Post ---------------------------------------------------------- */
.post-header-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--border);
}

.post-header {
  margin-bottom: 2rem;
}

.post-title {
  font-family: var(--font-poetry);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.post-subtitle {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.post-written-at {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.post-featured-image {
  margin: 2rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.post-featured-image img {
  width: 100%;
  border-radius: var(--radius-lg);
}

/* --- Poem Body ------------------------------------------------------------ */
.poem-body {
  font-family: var(--font-poetry);
  font-size: 1.25rem;
  line-height: 2;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 2rem 0;
}

.poem-body br {
  line-height: 2;
}

/* --- Post Video ----------------------------------------------------------- */
.post-video {
  margin: 2rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* --- Post Footer ---------------------------------------------------------- */
/* --- Post Nav (prev/next) ------------------------------------------------- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  max-width: 45%;
}

.post-nav-next {
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.post-nav-dir {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
}

.post-nav-link:hover .post-nav-title {
  text-decoration: underline;
}

/* --- Post Footer Note ----------------------------------------------------- */
.post-footer-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--border);
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-link {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all var(--transition);
}

.tag-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* --- Like Button ---------------------------------------------------------- */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.like-btn:hover {
  border-color: #e05c7a;
  color: #e05c7a;
}

.like-btn.liked {
  border-color: #e05c7a;
  color: #e05c7a;
  background: rgba(224, 92, 122, 0.08);
}

.like-heart {
  font-size: 1.1rem;
  transition: transform 0.15s ease;
}

.like-btn:active .like-heart {
  transform: scale(1.3);
}

.view-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Search --------------------------------------------------------------- */
.search-form {
  margin-bottom: 2rem;
}

.search-input-wrap {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
}

.search-input {
  flex: 1;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-btn {
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.search-btn:hover {
  background: var(--accent-hover);
}

.search-info {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

/* --- Page Headings -------------------------------------------------------- */
.page-title {
  font-family: var(--font-poetry);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.page-header {
  margin-bottom: 2rem;
}

.tag-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.tag-count {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* --- 404 Page ------------------------------------------------------------- */
.error-page {
  text-align: center;
  padding: 5rem 1rem;
}

.error-code {
  font-family: var(--font-poetry);
  font-size: 6rem;
  font-weight: 400;
  color: var(--border);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 1.5rem;
  font-family: var(--font-poetry);
  margin-bottom: 0.5rem;
}

.error-sub {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

/* --- Empty State ---------------------------------------------------------- */
.empty-message {
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 0;
}

/* --- Text Utilities ------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 0.875rem; }
.link-small { font-size: 0.8rem; margin-left: 0.5rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Admin Layout --------------------------------------------------------- */
.admin-body {
  background: var(--bg-secondary);
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Admin Sidebar -------------------------------------------------------- */
.admin-sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar-header {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-site-title {
  display: block;
  font-family: var(--font-poetry);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.admin-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.admin-nav {
  padding: 1rem 0;
  flex: 1;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: all var(--transition);
  border-radius: 0;
}

.admin-nav-link:hover,
.admin-nav-link.active {
  color: var(--accent);
  background: rgba(139, 94, 60, 0.06);
}

.nav-icon {
  font-size: 1rem;
  opacity: 0.7;
}

.admin-sidebar-footer {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.admin-logout-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 1rem;
  width: 100%;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.admin-logout-btn:hover {
  color: #c0392b;
}

/* --- Admin Content Area --------------------------------------------------- */
.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-page-title {
  font-family: var(--font-poetry);
  font-size: 1.3rem;
  font-weight: 600;
}

.admin-main {
  padding: 1.5rem;
  flex: 1;
}

/* --- Login Page ----------------------------------------------------------- */
.admin-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-title {
  font-family: var(--font-poetry);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Stats Grid ----------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  font-family: var(--font-poetry);
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Dashboard Sections --------------------------------------------------- */
.dashboard-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.section-heading {
  font-family: var(--font-poetry);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.current-daily {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.daily-post-form .form-row {
  display: flex;
  gap: 0.5rem;
}

.daily-post-form select {
  flex: 1;
}

/* --- Admin Table ---------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background: var(--bg-secondary);
}

.col-title {
  max-width: 300px;
}

.post-title-link {
  color: var(--text);
  font-weight: 500;
}

.post-title-link:hover {
  color: var(--accent);
}

.col-actions {
  white-space: nowrap;
  display: flex;
  gap: 0.375rem;
}

/* --- Filter Bar ----------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.filter-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 94, 60, 0.06);
}

.filter-sep {
  color: var(--border);
  padding: 0 0.25rem;
}

/* --- Page Actions --------------------------------------------------------- */
.page-actions {
  margin-bottom: 1.25rem;
}

/* --- Form Styles ---------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.required {
  color: #c0392b;
}

.form-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-textarea {
  resize: vertical;
  font-family: var(--font-ui);
  line-height: 1.6;
}

.form-textarea-sm {
  min-height: 80px;
}

.form-textarea-lg {
  min-height: 420px;
  font-family: var(--font-poetry);
  font-size: 1rem;
  line-height: 1.8;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.textarea-wrap {
  position: relative;
}

.textarea-stats {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  display: flex;
  gap: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 0.1rem 0.25rem;
  border-radius: var(--radius);
  pointer-events: none;
}

/* --- Post Form Layout ----------------------------------------------------- */
.form-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

.form-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 4rem;
}

.sidebar-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.sidebar-box-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: flex;
  gap: 0.5rem;
}

.tags-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.current-image-preview {
  margin-bottom: 0.5rem;
}

/* --- Tags Page ------------------------------------------------------------ */
.page-layout-two {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}

.page-main {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.page-sidebar {
  position: sticky;
  top: 4rem;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
  .form-layout,
  .page-layout-two {
    grid-template-columns: 1fr;
  }

  .form-sidebar,
  .page-sidebar {
    position: static;
  }

  .admin-sidebar {
    width: 180px;
    min-width: 180px;
  }
}

@media (max-width: 700px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }

  .admin-sidebar-header {
    display: none;
  }

  .admin-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
  }

  .admin-sidebar-footer {
    display: flex;
    flex-direction: row;
    border-top: none;
    padding: 0;
  }

  .admin-nav-link,
  .admin-logout-btn {
    padding: 0.5rem 0.75rem;
  }

  .daily-post-title {
    font-size: 1.6rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .site-nav {
    padding: 0.75rem 1rem;
  }

  .container {
    padding: 0 1rem;
  }

  .admin-main {
    padding: 1rem;
  }

  .post-single {
    padding: 0 1rem;
  }
}
