/* ─── Floating Action Button (always visible) ──────────────────────────────── */
.agent-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 12px 14px;
  background: #2c6e49;
  color: #fff;
  border: 0;
  border-radius: 999px;
  font: 600 0.9rem/1 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(44, 110, 73, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.agent-fab:hover {
  background: #1f5235;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(44, 110, 73, 0.45);
}
.agent-fab:active { transform: translateY(0); }
.agent-fab[hidden] { display: none; }
.agent-fab svg { display: block; }
.agent-fab-label { white-space: nowrap; }

/* ─── Chat Panel (hidden until FAB is clicked) ─────────────────────────────── */
.agent-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.22);
  border: 1px solid #e6e0d4;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  transform-origin: bottom right;
  animation: agent-pop-in 0.18s ease-out;
}
.agent-widget[hidden] { display: none; }

@keyframes agent-pop-in {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #2c6e49 0%, #1f5235 100%);
  color: #fff;
}
.agent-header-info { display: flex; align-items: center; gap: 10px; }
.agent-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(255,255,255,0.4);
}
.agent-header-title { font-weight: 600; font-size: 0.95rem; }
.agent-header-sub {
  font-size: 0.72rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
}
.agent-close {
  background: transparent;
  color: #fff;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.agent-close:hover { background: rgba(255,255,255,0.15); }

.agent-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  font-size: 0.92rem;
  background: #faf9f7;
}
.agent-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #eee;
  background: #fff;
}
.agent-input {
  flex: 1;
  border: 1px solid #e6e0d4;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.92rem;
  outline: 0;
  background: #fff;
}
.agent-input:focus { border-color: #2c6e49; box-shadow: 0 0 0 3px rgba(44,110,73,0.12); }
.agent-send {
  border: 0;
  background: #2c6e49;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background 0.2s;
}
.agent-send:hover { background: #1f5235; }
.agent-send:disabled { background: #b8c9bf; cursor: not-allowed; }
.agent-msg {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.4;
}
.agent-msg-user {
  background: #2c6e49;
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.agent-msg-tishaz {
  background: #fff;
  color: #222;
  border: 1px solid #e6e0d4;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}
.agent-msg-error {
  background: #fef2f2;
  color: #991b1b;
  margin-right: auto;
  border: 1px solid #fecaca;
  border-bottom-left-radius: 4px;
  font-size: 0.9em;
}
.agent-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px;
  background: #f3f6f9;
  width: fit-content;
}
.agent-typing {
  background: #fff;
  border: 1px solid #e6e0d4;
}
.agent-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2c6e49;
  opacity: 0.4;
  animation: agent-bounce 1.2s infinite ease-in-out;
}
.agent-typing span:nth-child(2) { animation-delay: 0.15s; }
.agent-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes agent-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
/* ─── CSS Custom Properties ─────────────────────────────────────────────────── */
:root {
  --color-bg: #faf9f7;
  --color-surface: #ffffff;
  --color-surface-alt: #f5f3ef;
  --color-border: #e8e4dc;
  --color-border-light: #f0ede6;

  --color-text: #1a1714;
  --color-text-muted: #6b6460;
  --color-text-light: #9c9490;

  --color-accent: #2c6e49;
  --color-accent-light: #4a9968;
  --color-accent-pale: #e8f5ee;
  --color-accent-hover: #245c3c;

  --color-amber: #d4860a;
  --color-amber-pale: #fef3dc;

  --color-error: #c0392b;
  --color-error-pale: #fdecea;
  --color-success: #2c6e49;
  --color-success-pale: #e8f5ee;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-deva: 'Noto Serif Devanagari', serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);

  --max-width: 1200px;
  --content-width: 760px;

  --transition: 0.2s ease;
}

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

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
  font-family: inherit;
}

/* ─── Site Header ───────────────────────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--color-accent);
  user-select: none;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 6px rgba(44, 110, 73, 0.25));
  transition: transform var(--transition);
}

.brand:hover .brand-logo {
  transform: translateY(-1px);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-text);
}

.brand-tagline {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--color-accent);
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background: var(--color-accent-pale);
  color: var(--color-accent);
}

/* ─── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1a3c2a 0%, #2c6e49 60%, #3a8a5c 100%);
  color: white;
  padding: 72px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") center / 60px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  padding: 6px 18px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.85;
  max-width: 540px;
  margin: 0 auto 32px;
  line-height: 1.65;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 100px;
  padding: 12px 20px;
  max-width: 460px;
  margin: 0 auto;
  color: var(--color-text-muted);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero-search svg {
  flex-shrink: 0;
}

.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--color-text);
  font-family: var(--font-sans);
}

.hero-search input::placeholder {
  color: var(--color-text-light);
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px;
  width: 100%;
}

/* ─── Section Header ────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text);
}

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

/* ─── Posts Grid ────────────────────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent);
}

.post-card-accent {
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
}

.post-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.post-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: var(--color-accent-pale);
  padding: 3px 8px;
  border-radius: 100px;
}

.post-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-summary {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 20px;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.post-author {
  font-weight: 500;
  color: var(--color-text-muted);
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-border);
  display: inline-block;
}

.post-card-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
}

.pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-amber);
  background: var(--color-amber-pale);
  padding: 3px 8px;
  border-radius: 100px;
}

/* ─── Loading & Empty States ────────────────────────────────────────────────── */
.loading-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-muted);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--color-text);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 24px;
}

/* ─── Upload Section ────────────────────────────────────────────────────────── */
.upload-container {
  max-width: 700px;
  margin: 0 auto;
}

.upload-header {
  margin-bottom: 36px;
}

.upload-header h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 16px;
}

.upload-header p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color var(--transition);
  margin-bottom: 8px;
}

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

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--color-surface-alt);
  transition: all var(--transition);
  margin-bottom: 28px;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--color-accent);
  background: var(--color-accent-pale);
}

.dropzone.has-file {
  border-color: var(--color-accent);
  background: var(--color-accent-pale);
}

.dropzone-icon {
  color: var(--color-text-light);
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.dropzone.has-file .dropzone-icon {
  color: var(--color-accent);
}

.dropzone-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.dropzone-text strong {
  color: var(--color-accent);
  text-decoration: underline;
}

.dropzone-hint {
  font-size: 0.82rem;
  color: var(--color-text-light);
}

.dropzone.has-file .dropzone-text {
  color: var(--color-accent);
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.required {
  color: var(--color-error);
}

.optional {
  font-weight: 400;
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.form-group input,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
  font-family: var(--font-sans);
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(44, 110, 73, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-light);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 110, 73, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.btn-danger {
  background: transparent;
  color: var(--color-error);
  border: 1.5px solid rgba(192, 57, 43, 0.3);
}

.btn-danger:hover {
  background: var(--color-error-pale);
}

/* ─── Progress Bar ──────────────────────────────────────────────────────────── */
.upload-progress {
  margin-top: 20px;
  text-align: center;
}

.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
  border-radius: 100px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ─── Post Detail ───────────────────────────────────────────────────────────── */
.post-container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-detail-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.post-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.post-detail-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  margin-bottom: 16px;
}

.post-detail-summary {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  line-height: 1.7;
  font-style: italic;
  border-left: 3px solid var(--color-accent);
  padding-left: 16px;
  margin-bottom: 24px;
}

.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.meta-item svg {
  color: var(--color-text-light);
}

.post-detail-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text);
}

.post-detail-content h1,
.post-detail-content h2,
.post-detail-content h3 {
  font-family: var(--font-serif);
  margin-top: 2em;
  margin-bottom: 0.6em;
  color: var(--color-text);
}

.post-detail-content h2 {
  font-size: 1.5rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-light);
}

.post-detail-content h3 {
  font-size: 1.2rem;
}

.post-detail-content p {
  margin-bottom: 1.2em;
}

.post-detail-content ul,
.post-detail-content ol {
  margin: 0 0 1.2em 1.5em;
}

.post-detail-content li {
  margin-bottom: 0.4em;
}

.post-detail-content strong {
  font-weight: 600;
  color: var(--color-text);
}

.post-detail-content em {
  font-style: italic;
}

.post-detail-content blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 1.5em 0;
  padding: 12px 20px;
  background: var(--color-accent-pale);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

/* ─── PDF Viewer ────────────────────────────────────────────────────────────── */
.pdf-viewer-section {
  margin-top: 48px;
  border-top: 1px solid var(--color-border);
  padding-top: 32px;
}

.pdf-viewer-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pdf-frame {
  width: 100%;
  height: 700px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  overflow: hidden;
}

.pdf-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-lg);
}

/* ─── Post Actions ──────────────────────────────────────────────────────────── */
.post-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

/* ─── Inline upload message (above Publish button) ─────────────────────────── */
.upload-message {
  display: none;
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.upload-message.show { display: block; }
.upload-message.success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.upload-message.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--color-text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 1000;
  max-width: 340px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--color-success);
}

.toast.error {
  background: var(--color-error);
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-text);
  color: rgba(255, 255, 255, 0.8);
  padding: 32px 24px;
  text-align: center;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: white;
  margin-bottom: 6px;
}

.footer-copy {
  font-size: 0.82rem;
  opacity: 0.6;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .brand-tagline {
    display: none;
  }

  .hero {
    padding: 48px 16px;
  }

  .site-main {
    padding: 32px 16px;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: 1;
  }

  .post-detail-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .pdf-frame {
    height: 500px;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .btn {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .agent-widget {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    height: 70vh;
  }
  .agent-fab {
    right: 16px;
    bottom: 16px;
    padding: 12px;
  }
  /* On phones, just show the icon — text label is redundant in a tight space */
  .agent-fab-label { display: none; }

  .nav-link span {
    display: none;
  }

  .hero-title {
    font-size: 1.9rem;
  }
}

/* ─── Devanagari support ────────────────────────────────────────────────────── */
.devanagari,
:lang(ne) {
  font-family: var(--font-deva);
}

/* ─── Utility ───────────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Auth modals (login + signup) ─────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 25, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
}
.auth-card {
  position: relative;
  background: var(--color-bg, #fefcf8);
  border-radius: 14px;
  padding: 32px 30px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.auth-card h2 {
  margin: 0 0 6px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.55rem;
  color: #1f5235;
}
.auth-sub {
  color: #555;
  margin: 0 0 20px;
  font-size: 0.92rem;
}
.auth-hint {
  font-size: 0.84rem;
  color: #666;
  text-align: center;
  margin: 16px 0 0;
}
.auth-hint a { color: #2c6e49; text-decoration: underline; }
.auth-error {
  color: #b3261e;
  font-size: 0.88rem;
  min-height: 1.2em;
  margin: 6px 0 10px;
}
.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.auth-close:hover { background: rgba(0,0,0,0.06); color: #333; }
#login-btn, #signup-btn, #signup-verify-btn { width: 100%; justify-content: center; }

/* Resend button — pronounced hover so users notice it's clickable */
#signup-resend-btn {
  width: 100%;
  margin-top: 10px;
  justify-content: center;
  border: 1.5px solid #2c6e49;
  color: #2c6e49;
  background: #fff;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
#signup-resend-btn:hover {
  background: #2c6e49;
  color: #fff;
  box-shadow: 0 4px 14px rgba(44, 110, 73, 0.30);
  transform: translateY(-1px);
}
#signup-resend-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(44, 110, 73, 0.30);
}
#signup-resend-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f5f5f5;
  color: #888;
  border-color: #ccc;
  transform: none;
  box-shadow: none;
}

/* ─── Nav: signup CTA ─────────────────────────────────────────────────────── */
.nav-cta {
  background: #2c6e49;
  color: #fff !important;
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-cta:hover { background: #1f5235; }

/* ─── Nav: user chip + logout ─────────────────────────────────────────────── */
.nav-user {
  font-size: 0.85rem;
  color: #2c6e49;
  background: rgba(44, 110, 73, 0.08);
  padding: 6px 12px;
  border-radius: 999px;
  margin-left: 8px;
  font-weight: 500;
}
.nav-user .role-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1f5235;
  margin-left: 6px;
  opacity: 0.8;
}

/* ─── Users admin panel ───────────────────────────────────────────────────── */
.users-section { padding: 32px 0; }
.users-container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.users-header h2 { margin: 18px 0 6px; }
.users-header p { color: #666; margin: 0 0 24px; }
.user-create-form {
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 32px;
}
.user-create-form h3 { margin: 0 0 16px; }
.users-list-wrap h3 { margin: 0 0 12px; }
.users-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 12px;
  overflow: hidden;
}
.users-table th, .users-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #f0eadd;
  font-size: 0.92rem;
}
.users-table th { background: #faf7ef; font-weight: 600; color: #444; }
.users-table tr:last-child td { border-bottom: none; }
.users-table select { padding: 4px 8px; font-size: 0.88rem; }
.users-table .btn-danger { padding: 5px 10px; font-size: 0.82rem; }

/* ─── Inline search (next to "Latest Blog") ────────────────────────────────── */
.section-header {
  align-items: center;
}
.section-header .post-count {
  /* push post-count next to the title; search sits on the far right */
  margin-right: auto;
}
.inline-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 999px;
  padding: 7px 14px;
  min-width: 220px;
  max-width: 320px;
  color: #888;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.inline-search:focus-within {
  border-color: #2c6e49;
  box-shadow: 0 0 0 3px rgba(44, 110, 73, 0.12);
  color: #2c6e49;
}
.inline-search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  flex: 1;
  min-width: 0;
  color: #222;
}
@media (max-width: 640px) {
  .section-header { flex-wrap: wrap; }
  .inline-search { width: 100%; max-width: none; }
}

/* ─── Reactions + comments ────────────────────────────────────────────────── */
.social-heading {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 32px 0 12px;
  color: #1f5235;
}
.comments-count { color: #888; font-weight: 400; font-size: 0.9rem; }

.reactions-section { margin-top: 32px; }
.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1.5px solid #e6e0d4;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
}
.reaction-btn:hover { border-color: #2c6e49; background: rgba(44,110,73,0.06); }
.reaction-btn:active { transform: scale(0.95); }
.reaction-btn.is-mine {
  background: rgba(44, 110, 73, 0.12);
  border-color: #2c6e49;
}
.reaction-emoji { font-size: 1.2rem; line-height: 1; }
.reaction-count { font-size: 0.85rem; color: #555; font-weight: 600; }
.reaction-btn.is-mine .reaction-count { color: #1f5235; }
.reactions-loading, .reactions-error { color: #888; font-size: 0.9rem; }

.comments-section { margin-top: 32px; }
.comment-form {
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.comment-form textarea {
  width: 100%;
  border: 1px solid #e6e0d4;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  min-height: 76px;
}
.comment-form textarea:focus,
.comment-form input:focus { outline: 0; border-color: #2c6e49; box-shadow: 0 0 0 3px rgba(44,110,73,0.12); }
.comment-as { font-size: 0.85rem; color: #666; margin: 0 0 12px; }

.comments-empty {
  color: #888;
  font-style: italic;
  padding: 12px 0;
}
.comments-list { display: flex; flex-direction: column; gap: 14px; }
.comment {
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 10px;
  padding: 12px 16px;
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 6px;
}
.comment-author { font-weight: 600; color: #1f5235; }
.comment-body { margin: 0; line-height: 1.5; color: #222; word-break: break-word; }
.comment-delete {
  margin-left: auto;
  background: transparent;
  border: 0;
  font-size: 1.2rem;
  color: #b3261e;
  cursor: pointer;
  line-height: 1;
  padding: 0 8px;
  border-radius: 6px;
}
.comment-delete:hover { background: rgba(179,38,30,0.08); }
