/* ==========================================================================
   1. Global Design Tokens & Base Styles
   ========================================================================== */
:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --bg: #f8fafc;
  --text: #0f172a;
  --card-bg: #ffffff;
  --border: #e2e8f0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: relative;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  position: relative;
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.8rem;
}

header p {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}

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

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ==========================================================================
   2. Shared Markdown Body Formatting
   ========================================================================== */
.markdown-body {
  line-height: 1.7;
  color: #1e293b;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.markdown-body p {
  margin-top: 0;
  margin-bottom: 1rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-body blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 4px solid var(--primary);
  color: #475569;
  font-style: italic;
}

/* ==========================================================================
   3. Chat Assistant UI (index.njk)
   ========================================================================== */
.chat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.chat-card h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #64748b;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

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

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 0.8rem 2.2rem 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.input-wrapper input:focus {
  border-color: var(--primary);
}

.clear-btn {
  position: absolute;
  right: 0.6rem;
  background: #cbd5e1;
  color: #475569;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: #94a3b8;
  color: #fff;
}

.input-row button[type="submit"] {
  padding: 0.8rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.input-row button[type="submit"]:hover {
  background: var(--primary-hover);
}

.input-row button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.response-area {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.35rem;
}

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

/* ==========================================================================
   4. Sermon Badges & Citations
   ========================================================================== */
.sources {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: #64748b;
}

.sermon-badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.sermon-badge {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sermon-badge:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ==========================================================================
   5. Sermon Detail Page (sermon.njk)
   ========================================================================== */
.sermon-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 1rem;
}

.back-link:hover {
  text-decoration: underline;
}

.sermon-header h1 {
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
}

.sermon-meta {
  color: #64748b;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.media-section {
  margin-bottom: 2rem;
  background: #f8fafc;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.media-section h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.transcript-section {
  margin-top: 1.5rem;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.transcript-header h2 {
  margin: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

