/* ============================================================
   Bishop John Kobina Louis — Sermon Library
   Single-page no-scroll layout
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --deep:     #1a1209;
  --gold:     #b8912a;
  --gold-lt:  #d4a845;
  --cream:    #fdf8f0;
  --cream-dk: #f5ede0;
  --ink:      #2c2416;
  --muted:    #7a6a54;
  --border:   #e4d8c4;
  --white:    #ffffff;
  --green:    #27ae60;
  --radius:   8px;
  --shadow:   0 2px 12px rgba(26,18,9,0.08);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── NAV ── */
.site-nav {
  height: 46px;
  background: var(--deep);
  border-bottom: 2px solid var(--gold);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  flex-shrink: 0;
}
.nav-inner {
  width: 100%; display: flex;
  align-items: center; justify-content: space-between;
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--cream);
  font-size: 0.95rem;
}
.nav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--gold);
}
.nav-links { display: flex; gap: 0.5rem; }
.nav-btn {
  padding: 0.3rem 0.85rem;
  border: 1.5px solid rgba(184,145,42,0.5);
  border-radius: 20px;
  color: var(--cream-dk); font-size: 0.8rem;
  transition: all 0.2s;
}
.nav-btn:hover, .nav-btn.active {
  background: var(--gold); color: var(--deep);
  border-color: var(--gold);
}

/* ── HERO STRIP ── */
.hero-strip {
  height: 80px;
  display: flex;
  align-items: center;
  background: var(--deep);
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
  overflow: hidden;
}
.hero-strip-img {
  width: 110px; height: 80px;
  flex-shrink: 0; overflow: hidden;
}
.hero-strip-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 15%;
}
.hero-strip-text {
  padding: 0 1.5rem; flex: 1;
}
.hero-strip-text h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem; color: var(--cream);
  margin-bottom: 0.2rem; line-height: 1.2;
}
.hero-strip-text h1 em { color: var(--gold); font-style: italic; }
.hero-strip-text p { font-size: 0.75rem; color: rgba(253,248,240,0.5); font-style: italic; }
.hero-strip-text p span { color: var(--gold); opacity: 0.8; }

/* ── PAGE BODY ── */
.page-body {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 46px - 80px);
  overflow: hidden;
}

/* ── FILTER BAR ── */
.filter-bar {
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.filter-form {
  display: flex; align-items: center;
  gap: 0.6rem; flex-wrap: wrap;
}
.search-wrap { display: flex; gap: 0.4rem; flex: 1; min-width: 200px; }
.search-input {
  flex: 1; padding: 0.38rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem; font-family: inherit;
  color: var(--ink); background: var(--white);
}
.search-input:focus { outline: none; border-color: var(--gold); }
.search-btn {
  padding: 0.38rem 1rem;
  background: var(--gold); color: var(--deep);
  border: none; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.filter-selects { display: flex; align-items: center; gap: 0.6rem; }
.filter-selects select {
  padding: 0.35rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem; font-family: inherit;
  color: var(--ink); background: var(--white);
}
.sermon-count { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.clear-filter { color: var(--muted); font-size: 0.82rem; }

/* ── SERMON GRID ── */
.sermon-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.75rem;
  background: var(--cream);
}
.sermon-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.sermon-card-sm {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  transition: box-shadow 0.15s, transform 0.15s;
}
.sermon-card-sm:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--gold);
}
.card-sm-thumb {
  width: 46px; height: 36px;
  flex-shrink: 0; border-radius: 5px;
  overflow: hidden; background: var(--deep);
}
.card-sm-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-sm-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(184,145,42,0.5); font-size: 1rem;
}
.card-sm-body { flex: 1; min-width: 0; }
.card-sm-series {
  display: block;
  font-size: 0.62rem; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 0.1rem;
}
.card-sm-title {
  font-size: 0.82rem; font-weight: 600;
  line-height: 1.3; color: var(--ink);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}
.card-sm-meta {
  display: flex; align-items: center;
  gap: 0.4rem; flex-wrap: wrap;
  font-size: 0.68rem; color: var(--muted);
}
.badge {
  padding: 1px 5px; border-radius: 3px;
  font-size: 0.62rem; font-weight: 600;
}
.badge.video { background: rgba(26,18,9,0.85); color: var(--gold); }
.badge.audio { background: rgba(26,18,9,0.85); color: #88ccff; }

/* ── EMPTY STATE ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center; padding: 3rem 2rem;
  color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ── SERMON DETAIL PAGE ── */
.sermon-page { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.sermon-header { margin-bottom: 1.5rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.sermon-series-tag { color: var(--gold); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.4rem; }
.sermon-title { font-family: 'Playfair Display', serif; font-size: clamp(1.5rem, 4vw, 2.4rem); line-height: 1.2; margin-bottom: 0.75rem; }
.sermon-meta-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.meta-item { color: var(--muted); font-size: 0.85rem; }

.media-section { margin-bottom: 1.75rem; }
.media-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; color: var(--gold); margin-bottom: 0.6rem; }
.video-wrap { background: #000; border-radius: var(--radius); overflow: hidden; }
.video-wrap video { width: 100%; max-height: 480px; display: block; }

.audio-section .audio-player-wrap {
  display: flex; gap: 1.2rem; align-items: flex-start;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
}
.audio-art { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.audio-art-placeholder {
  width: 90px; height: 90px; border-radius: 6px;
  background: var(--deep); display: flex; align-items: center;
  justify-content: center; color: var(--gold); font-size: 1.8rem; flex-shrink: 0;
}
.audio-info { flex: 1; min-width: 0; }
.audio-title { font-family: 'Playfair Display', serif; font-size: 1rem; margin-bottom: 0.2rem; }
.audio-preacher { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.6rem; }
.audio-el { width: 100%; margin-bottom: 0.6rem; }
.download-btn {
  display: inline-block; padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--gold); color: var(--gold);
  border-radius: 5px; font-size: 0.82rem; transition: all 0.2s;
}
.download-btn:hover { background: var(--gold); color: var(--deep); }

.sermon-description { margin-bottom: 2rem; }
.sermon-description h3 { font-family: 'Playfair Display', serif; margin-bottom: 0.6rem; }
.sermon-description p { color: var(--muted); line-height: 1.8; }

.related-sermons { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.related-sermons h3 { font-family: 'Playfair Display', serif; margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.related-card {
  display: flex; gap: 0.6rem; background: var(--white);
  border: 1px solid var(--border); border-radius: 7px;
  overflow: hidden; padding: 0.65rem; color: var(--ink);
  transition: box-shadow 0.15s;
}
.related-card:hover { box-shadow: var(--shadow); }
.related-thumb { width: 52px; height: 40px; flex-shrink: 0; border-radius: 5px; overflow: hidden; background: var(--deep); }
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-thumb-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 1.2rem; }
.related-title { font-size: 0.82rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.2rem; }
.related-ref { color: var(--muted); font-size: 0.72rem; }

/* ── SITE FOOTER (detail page only) ── */
.site-footer {
  background: var(--deep); color: rgba(253,248,240,0.5);
  text-align: center; padding: 1.5rem;
  font-size: 0.82rem; border-top: 2px solid var(--gold);
}

/* ── BACK LINK (detail page) ── */
.back-link { color: var(--cream-dk); font-size: 0.85rem; }
.back-link:hover { color: var(--gold-lt); }

/* ── ADMIN STYLES ── */
.admin-login-page {
  min-height: 100vh; background: var(--deep);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.login-box {
  background: var(--white); border-radius: 12px;
  padding: 2.5rem; width: 100%; max-width: 380px;
}
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: 0.5rem; }
.login-box h1 { font-family: 'Playfair Display', serif; text-align: center; font-size: 1.6rem; margin-bottom: 0.2rem; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: 0.88rem; }

.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; background: #1e3a5f; color: var(--cream);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-brand { padding: 1.2rem; font-family: 'Playfair Display', serif; font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); color: var(--gold-lt); }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.sidebar-link { display: block; padding: 0.65rem 1.2rem; color: rgba(253,248,240,0.75); font-size: 0.9rem; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-link:hover, .sidebar-link.active { background: rgba(255,255,255,0.08); color: var(--cream); border-left-color: var(--gold); }
.sidebar-footer { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: rgba(253,248,240,0.6); }
.logout-link { color: rgba(253,248,240,0.5); font-size: 0.8rem; }

.admin-main { flex: 1; padding: 1.75rem; background: #f4f6f9; min-width: 0; overflow-y: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.admin-topbar h1 { font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--deep); }

.stats-row { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 1.1rem 1.6rem; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,0.05); flex: 1; min-width: 90px; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: #1e3a5f; font-family: 'Playfair Display', serif; }
.stat-label { color: var(--muted); font-size: 0.8rem; }

.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: 0 2px 6px rgba(0,0,0,0.05); overflow-x: auto; }
.sermon-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.sermon-table th { background: #1e3a5f; color: var(--cream); padding: 0.65rem 1rem; text-align: left; font-weight: 500; font-size: 0.8rem; }
.sermon-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sermon-table tr:last-child td { border-bottom: none; }
.sermon-table tr:hover td { background: var(--cream); }
.td-title { font-weight: 600; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-actions { white-space: nowrap; display: flex; gap: 0.35rem; }

.status-badge { padding: 2px 9px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; }
.status-badge.published { background: #d4f4e0; color: #1a7a3a; }
.status-badge.draft { background: #fdecea; color: #8b2a1d; }

.action-btn { padding: 3px 10px; border-radius: 5px; font-size: 0.78rem; cursor: pointer; font-family: inherit; border: 1.5px solid transparent; background: none; transition: all 0.15s; }
.action-btn.edit { border-color: #1e3a5f; color: #1e3a5f; }
.action-btn.edit:hover { background: #1e3a5f; color: #fff; }
.action-btn.toggle { border-color: var(--gold); color: #8a6a10; }
.action-btn.toggle:hover { background: var(--gold); color: var(--deep); }
.action-btn.delete { border-color: #c0392b; color: #c0392b; }
.action-btn.delete:hover { background: #c0392b; color: #fff; }

.sermon-form { max-width: 780px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.75rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.span-2 { grid-column: 1 / -1; }
.form-group label { font-weight: 600; font-size: 0.88rem; color: var(--ink); }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.6rem 0.85rem; border: 1.5px solid var(--border);
  border-radius: 6px; font-size: 0.9rem; font-family: inherit; color: var(--ink); background: var(--white);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: #1e3a5f; }
.form-group small { color: var(--muted); font-size: 0.78rem; }
.toggle-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

.upload-section { background: var(--cream); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.75rem; }
.upload-section h3 { font-family: 'Playfair Display', serif; margin-bottom: 1rem; font-size: 1.1rem; }
.upload-field { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.upload-field:last-child { border-bottom: none; margin-bottom: 0; }
.upload-field > label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.88rem; }
.current-media { margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.6rem; }
.thumb-preview { width: 72px; height: 46px; object-fit: cover; border-radius: 4px; }
.current-label { color: var(--green); font-size: 0.82rem; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.btn-primary { padding: 0.6rem 1.4rem; background: #1e3a5f; color: var(--white); border: none; border-radius: 6px; font-size: 0.9rem; font-family: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.2s; }
.btn-primary:hover { background: #2c5282; color: var(--white); }
.btn-secondary { padding: 0.6rem 1.2rem; border: 1.5px solid var(--border); color: var(--muted); border-radius: 6px; font-size: 0.9rem; font-family: inherit; background: var(--white); cursor: pointer; text-decoration: none; display: inline-block; transition: all 0.2s; }
.btn-secondary:hover { border-color: #1e3a5f; color: #1e3a5f; }
.full-width { width: 100%; }

#upload-progress { margin-top: 1rem; }
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 0.4rem; }
.progress-bar-fill { height: 100%; background: var(--gold); border-radius: 3px; width: 0; transition: width 0.3s; }
#progress-text { color: var(--muted); font-size: 0.85rem; }

.alert { padding: 0.75rem 1.1rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: 0.9rem; }
.alert-success { background: #d4f4e0; color: #1a7a3a; border: 1px solid #8dd4aa; }
.alert-error { background: #fdecea; color: #8b2a1d; border: 1px solid #e8a09a; }

.settings-card { background: var(--white); border-radius: var(--radius); padding: 1.75rem; max-width: 460px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.settings-card h3 { font-family: 'Playfair Display', serif; margin-bottom: 1.25rem; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar-nav { display: flex; padding: 0; }
  .sidebar-link { padding: 0.65rem 0.9rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span-2 { grid-column: 1; }
}
@media (max-width: 700px) {
  html, body { overflow: auto; height: auto; }
  .page-body { height: auto; overflow: visible; }
  .sermon-grid-wrap { overflow: visible; }
  .sermon-grid-2col { grid-template-columns: 1fr; }
  .hero-strip { height: auto; padding: 0.6rem 1rem; }
  .hero-strip-img { width: 64px; height: 56px; }
  .hero-strip-text h1 { font-size: 0.95rem; }
}

/* ==============================
   RESPONSIVE & WHITESPACE FIX
   ============================== */

/* Remove empty space below sermon grid */
.sermon-grid-wrap {
  padding: 0.5rem 0.75rem !important;
}

/* Auto-fit columns: 2 on desktop, 1 on mobile */
.sermon-grid-2col {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important;
  gap: 0.45rem !important;
  align-content: start !important;
}

/* Card height consistent, no stretching */
.sermon-card-sm {
  height: auto !important;
  align-items: flex-start !important;
}

/* Title wraps on small screens */
.card-sm-title {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

/* Phone — single column, full width */
@media (max-width: 600px) {
  .sermon-grid-2col {
    grid-template-columns: 1fr !important;
  }
  .filter-form {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
  .search-wrap { width: 100% !important; }
  .filter-selects { width: 100% !important; justify-content: space-between !important; }
  .hero-strip { height: auto !important; min-height: 60px !important; }
  .hero-strip-img { width: 70px !important; height: 60px !important; }
  .hero-strip-text h1 { font-size: 0.9rem !important; }
  .hero-strip-text p { display: none !important; }
  .nav-brand span { font-size: 0.82rem !important; }
  .page-body {
    height: auto !important;
    overflow: visible !important;
  }
  html, body { overflow: auto !important; height: auto !important; }
}

/* Tablet — comfortable 2 columns */
@media (min-width: 601px) and (max-width: 900px) {
  .sermon-grid-2col {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
