/* =========================================================
   Bible Explorer: shared stylesheet
   A warm, kid-friendly design system used across every page.
   ========================================================= */

:root {
  /* Palette */
  --color-bg: #fffbf3;
  --color-bg-alt: #fff3dc;
  --color-surface: #ffffff;
  --color-primary: #e07a2c;
  --color-primary-dark: #b85e1a;
  --color-secondary: #2c4a6e;
  --color-secondary-dark: #1c324c;
  --color-accent: #4fa787;
  --color-accent-dark: #357a5f;
  --color-text: #2b2320;
  --color-text-muted: #6b5c50;
  --color-border: #f0e1c9;
  --color-danger: #c0392b;

  /* Type */
  --font-heading: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;

  /* Layout */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --shadow-soft: 0 8px 24px rgba(43, 35, 32, 0.08);
  --shadow-lift: 0 14px 34px rgba(43, 35, 32, 0.14);
  --max-width: 1140px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--color-secondary-dark);
}

h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }

a {
  color: var(--color-primary-dark);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85em 1.7em;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-lift); }

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
  box-shadow: var(--shadow-soft);
}
.btn-secondary:hover { background: var(--color-secondary-dark); box-shadow: var(--shadow-lift); }

.btn-outline {
  background: transparent;
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}
.btn-outline:hover { background: var(--color-secondary); color: #fff; }

.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 251, 243, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-secondary-dark);
}
.nav-brand:hover { text-decoration: none; }
.nav-brand img { height: 36px; width: auto; max-width: 64px; object-fit: contain; }

.nav-brand .logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-accent);
}
.nav-brand .logo-badge img {
  height: 30px;
  width: 30px;
  max-width: none;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.7rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.97rem;
}
.nav-links a.active { color: var(--color-primary-dark); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--color-secondary-dark);
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 420px; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding: 0.9rem 1.5rem;
    width: 100%;
    border-top: 1px solid var(--color-border);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 4.5rem 0 4rem;
  background: radial-gradient(circle at 85% 20%, var(--color-bg-alt), var(--color-bg) 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
}

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

.eyebrow {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  background: rgba(79, 167, 135, 0.14);
  padding: 0.35em 0.9em;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.6rem;
}

.hero-art {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--color-border);
}

/* ---------- Sections ---------- */
.section { padding: 4rem 0; }
.section-alt { background: var(--color-bg-alt); }
.section-header { max-width: 640px; margin: 0 auto 2.5rem; text-align: center; }
.section-header p { color: var(--color-text-muted); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow-soft);
}

.card .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: var(--color-secondary);
  color: #fff;
  letter-spacing: 0.02em;
}

/* ---------- Lesson / verse cards ---------- */
.lesson-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 1.8rem;
  box-shadow: var(--shadow-soft);
}
.lesson-card .ref {
  font-family: var(--font-heading);
  color: var(--color-primary-dark);
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.lesson-card blockquote {
  margin: 0.8rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-accent);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ---------- Forms ---------- */
.form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-lift);
  max-width: 520px;
  margin: 0 auto;
}

.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.75em 0.9em;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.field-hint { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 0.3rem; }

.form-message {
  margin-top: 1rem;
  padding: 0.8em 1em;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  display: none;
}
.form-message.success {
  display: block;
  background: rgba(79, 167, 135, 0.14);
  color: var(--color-accent-dark);
}
.form-message.error {
  display: block;
  background: rgba(192, 57, 43, 0.1);
  color: var(--color-danger);
}

/* ---------- Buy page regions ---------- */
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}
.region-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
}
.region-card .flag { font-size: 2rem; margin-bottom: 0.5rem; }

/* ---------- Forum ---------- */
.forum-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 860px) {
  .forum-layout { grid-template-columns: 1fr; }
}

.post {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-soft);
}
.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}
.post-author { font-weight: 700; color: var(--color-secondary-dark); }

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

.auth-box {
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 1.4rem;
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 2rem 1rem;
}

/* ---------- Buy page: share-a-friend box ---------- */
.share-box:empty { margin: 0; }
.share-form {
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.6rem;
  text-align: left;
}
.share-form .field { margin-bottom: 0.8rem; }
.share-form .field label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.share-message { margin-top: 0.6rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-secondary-dark);
  color: #f2e9d8;
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.site-footer h4 { color: #fff; font-size: 1rem; }
.site-footer a { color: #d8c9ae; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.5rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 1.2rem;
  font-size: 0.85rem;
  color: #b9ac95;
  text-align: center;
}

.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }

/* =========================================================
   Admin page: dashboard look, distinct from the marketing site
   ========================================================= */

.admin-body {
  background: #f2f3f6;
}

/* ---------- Top bar ---------- */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-secondary-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.admin-topbar .nav {
  padding: 0.8rem 0;
}
.admin-topbar .nav-brand {
  color: #fff;
}
.admin-topbar .badge {
  background: var(--color-primary);
}
.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  color: #d8c9ae;
}
.admin-user .btn {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}
.admin-user .btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.admin-view-site {
  color: #d8c9ae;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---------- Sign-in / denied / error states ---------- */
.admin-gate {
  max-width: 480px;
  margin: 3rem auto;
}
.admin-gate .auth-box,
.admin-gate.text-center {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 2.2rem;
}
.admin-gate-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

/* ---------- Dashboard stats ---------- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.admin-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  box-shadow: var(--shadow-soft);
}
.admin-stat .num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-secondary-dark);
  line-height: 1;
}
.admin-stat .label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

/* ---------- Tabs ---------- */
.admin-tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.8rem;
}
.admin-tab {
  padding: 0.7em 1.3em;
  border: none;
  background: none;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.95rem;
}
.admin-tab:hover { color: var(--color-secondary-dark); }
.admin-tab.active {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}
.admin-tab .count {
  display: inline-block;
  margin-left: 0.4em;
  background: var(--color-bg-alt);
  color: var(--color-secondary-dark);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  vertical-align: middle;
}

.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

/* ---------- Panel chrome (shared by both tabs) ---------- */
.admin-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 2rem;
}
.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.admin-panel-head h2 { margin-bottom: 0.3rem; }
.admin-panel-head p { margin: 0; }

/* ---------- Volume cards ---------- */
.volume-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem;
  margin-bottom: 0.5rem;
}

.volume-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.volume-card-top {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.volume-card-thumb {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.volume-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.volume-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.volume-card .vol-days {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.volume-card .field {
  margin-bottom: 0;
}
.volume-card .field label {
  font-size: 0.74rem;
  margin-bottom: 0.2rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.volume-card .field input {
  padding: 0.55em 0.7em;
  font-size: 0.88rem;
}

.file-btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.4em 0.8em;
  border-radius: 999px;
  border: 1.5px dashed var(--color-border);
  background: var(--color-bg-alt);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-secondary-dark);
  cursor: pointer;
  white-space: nowrap;
}
.file-btn:hover { border-color: var(--color-primary); }
.file-btn input[type="file"] {
  display: none;
}
.file-btn.has-file {
  border-style: solid;
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.volume-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.add-volume-toggle-wrap { text-align: right; }

.add-volume-panel {
  display: none;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-top: 1.4rem;
}
.add-volume-panel.open { display: block; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  align-items: end;
}

.field-inline {
  margin-bottom: 0;
}

/* ---------- Moderation table ---------- */
.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.75em 0.7em;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--color-bg-alt);
}

.admin-table th {
  font-family: var(--font-heading);
  color: var(--color-secondary-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.post-author-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}
.post-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-secondary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.post-content-cell {
  max-width: 340px;
  white-space: normal;
  line-height: 1.4;
}

.admin-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-bg-alt);
  display: block;
}

.admin-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.4em 0.9em;
  font-size: 0.82rem;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: #a3291d; }

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2em 0.65em;
  border-radius: 999px;
}
.status-pill.visible { background: rgba(79, 167, 135, 0.16); color: var(--color-accent-dark); }
.status-pill.hidden { background: rgba(192, 57, 43, 0.12); color: var(--color-danger); }
.status-pill.pending { background: rgba(224, 122, 44, 0.16); color: var(--color-primary-dark); }
.status-pill.sent { background: rgba(79, 167, 135, 0.16); color: var(--color-accent-dark); }

/* ---------- Toast ---------- */
.admin-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  max-width: 340px;
  padding: 0.85em 1.2em;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  font-weight: 700;
  font-size: 0.88rem;
  z-index: 300;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.admin-toast.success { background: var(--color-accent); color: #fff; }
.admin-toast.error { background: var(--color-danger); color: #fff; }

@media (max-width: 640px) {
  .admin-toast {
    left: 16px;
    right: 16px;
    max-width: none;
    bottom: 16px;
  }

  .admin-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-panel-head .btn {
    width: 100%;
  }
  .admin-tab {
    padding: 0.7em 0.9em;
    font-size: 0.88rem;
  }
}
