/* =========================================================
   Design tokens
   Palette: deep indigo (#1B2A4A) + warm brass/gold (#B8892B)
   on a soft warm-grey page (#F5F2EC), charcoal text (#262A33)
   Type: Baloo Thambi 2 (display, Tamil) / Hind Madurai (body, Tamil)
   ========================================================= */
:root {
  --ink: #262A33;
  --indigo: #1B2A4A;
  --indigo-deep: #101a30;
  --gold: #B8892B;
  --gold-soft: #E8C77A;
  --paper: #F5F2EC;
  --card: #FFFFFF;
  --line: #E2DCCF;
}

* { box-sizing: border-box; }

body {
  font-family: 'Hind Madurai', 'Noto Sans Tamil', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
}

h1, h2, h3, h4, .brand-text {
  font-family: 'Baloo Thambi 2', 'Noto Sans Tamil', sans-serif;
  color: var(--indigo);
  font-weight: 600;
}

a { text-decoration: none; color: var(--indigo); }
a:hover { color: var(--gold); }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--indigo);
}
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.navbar-brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--indigo);
  color: var(--gold-soft);
  font-family: 'Baloo Thambi 2', sans-serif;
  font-size: 1.3rem;
  border-radius: 8px;
}
.brand-text { font-size: 1.3rem; }

.navbar-nav .nav-link {
  color: var(--ink);
  font-weight: 500;
  padding: .5rem 1rem !important;
  border-bottom: 2px solid transparent;
}
.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--indigo);
  border-bottom-color: var(--gold);
}

.search-form { gap: .4rem; }
.search-form .form-control {
  border: 1px solid var(--line);
  min-width: 180px;
}
.search-form .btn {
  background: var(--indigo);
  color: #fff;
}
.search-form .btn:hover { background: var(--indigo-deep); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  color: #fff;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gold);
}
.hero h1 {
  color: #fff;
  font-size: 2.4rem;
  margin-bottom: .3rem;
}
.hero p {
  color: var(--gold-soft);
  margin: 0;
  font-size: 1.05rem;
}

/* ---------- Section title ---------- */
.section-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--line);
}

/* ---------- Post card ---------- */
.post-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.post-thumb {
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
}
.post-card-body { padding: 1.25rem 1.5rem; }
.post-card h3 { font-size: 1.25rem; margin: .4rem 0 .5rem; }
.post-excerpt { color: #4a4f5a; margin-bottom: .6rem; }
.post-meta { font-size: .85rem; color: #8a8f99; }

.post-category {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--indigo);
  background: #EFE6CF;
  padding: .2rem .6rem;
  border-radius: 3px;
}

/* ---------- Sidebar ---------- */
.sidebar-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.sidebar-box h4 {
  font-size: 1.05rem;
  border-bottom: 2px solid var(--gold);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}
.category-list, .related-list { list-style: none; padding: 0; margin: 0; }
.category-list li, .related-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px dashed var(--line);
}
.category-list li:last-child, .related-list li:last-child { border-bottom: none; }
.category-list .badge { background: var(--indigo); }

/* ---------- Single post ---------- */
.single-post h1 { font-size: 2rem; margin: .6rem 0; }
.single-post-img {
  width: 100%;
  border-radius: 4px;
  margin: 1rem 0 1.5rem;
}
.post-content { font-size: 1.08rem; max-width: 68ch; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--indigo-deep);
  color: #cfd3dc;
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
}
.site-footer p { margin: 0; }

/* ---------- Pagination ---------- */
.pagination .page-link { color: var(--indigo); }
.pagination .active .page-link {
  background: var(--indigo);
  border-color: var(--indigo);
}

/* ---------- Admin panel ---------- */
.admin-body { background: var(--paper); min-height: 100vh; }
.admin-sidebar {
  background: var(--indigo-deep);
  min-height: 100vh;
  padding: 1.5rem 0;
}
.admin-sidebar .brand { color: var(--gold-soft); font-family: 'Baloo Thambi 2', sans-serif; font-size: 1.2rem; padding: 0 1.5rem 1.5rem; display: block; }
.admin-sidebar a {
  display: block;
  color: #cfd3dc;
  padding: .7rem 1.5rem;
  border-left: 3px solid transparent;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,.06);
  color: #fff;
  border-left-color: var(--gold);
}
.admin-content { padding: 2rem; }
.admin-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
}
.stat-box .num { font-family: 'Baloo Thambi 2', sans-serif; font-size: 2rem; color: var(--indigo); }
.stat-box .label { color: #6b7078; font-size: .9rem; }
.thumb-sm { width: 60px; height: 45px; object-fit: cover; border-radius: 3px; }

@media (max-width: 767px) {
  .hero h1 { font-size: 1.8rem; }
  .search-form { margin-top: .75rem; width: 100%; }
}

/* ---------- Rich post content (Quill output) ---------- */
.post-content.ql-editor {
  padding: 0;
  font-size: 1.08rem;
  max-width: 68ch;
}
.post-content.ql-editor h1,
.post-content.ql-editor h2,
.post-content.ql-editor h3 { margin-top: 1.2rem; }
.post-content.ql-editor blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 1rem;
  color: #55595f;
}
.post-content.ql-editor img { max-width: 100%; border-radius: 4px; }

/* ---------- Quill editor in admin ---------- */
.quill-editor {
  background: #fff;
  min-height: 280px;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}
.ql-toolbar.ql-snow {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  background: #F5F2EC;
}

/* ---------- Comments ---------- */
.comments-section { margin-top: 1rem; }
.comment-row {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}
.comment-row:last-of-type { border-bottom: none; }

/* ---------- Analytics ---------- */
.analytics-row { padding: .9rem 0; border-bottom: 1px dashed var(--line); }
.analytics-row:last-child { border-bottom: none; }
.analytics-row-top { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.analytics-views { color: var(--gold); font-weight: 600; white-space: nowrap; }
.analytics-bar-track { background: var(--paper); border-radius: 3px; height: 8px; overflow: hidden; }
.analytics-bar-fill { background: linear-gradient(90deg, var(--indigo), var(--gold)); height: 100%; }
.analytics-meta { font-size: .8rem; color: #8a8f99; margin-top: .3rem; }

/* ---------- Admin role badge (sidebar) ---------- */
.role-badge {
  display: block;
  margin: -.5rem 1.5rem 1rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 3px;
  width: fit-content;
}
.role-badge.role-super { background: var(--gold); color: #2b2410; }
.role-badge.role-editor { background: rgba(255,255,255,.12); color: #cfd3dc; }
.admin-sidebar a .badge { margin-left: .4rem; }

/* ---------- Accessible light/dark themes ---------- */
body[data-theme="dark"] {
  --ink: #e7eaf0;
  --indigo: #b9c9ff;
  --indigo-deep: #dbe4ff;
  --gold: #f1c46a;
  --gold-soft: #ffe3a1;
  --paper: #121722;
  --card: #1b2332;
  --line: #3b4659;
}
body[data-theme="dark"] .text-muted { color: #b8c1d1 !important; }
body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] textarea { background: #202a3a; color: var(--ink); border-color: var(--line); }
body[data-theme="dark"] .form-control::placeholder { color: #aab4c5; }
body[data-theme="dark"] .card,
body[data-theme="dark"] .sidebar-box,
body[data-theme="dark"] .list-group-item { background: var(--card); color: var(--ink); border-color: var(--line); }
body[data-theme="dark"] .site-footer { background: #0b1019; color: #f3f4f6; }
body[data-theme="dark"] .footer-links a { color: #dbe4ff; }
.site-footer { background: #172033; color: #f8fafc; }
.footer-heading { color: #fff; font-weight: 700; }
.footer-links li { margin: .45rem 0; }
.footer-links a { color: #e5e7eb; text-decoration: none; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
