/* ============================================================
   CDMS – Public App Stylesheet
   Stack: Bootstrap 5 + Custom Design System
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --primary:       #1e3a5f;
  --primary-light: #2e5484;
  --secondary:     #c8a951;
  --accent:        #e63946;
  --dark:          #0d1b2e;
  --light-bg:      #f8f9fc;
  --body-font:     'Poppins', sans-serif;
  --serif-font:    'Playfair Display', serif;
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.14);
  --transition:    .25s ease;
}

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

html { scroll-behavior: smooth; }

body.cdms-body {
  font-family: var(--body-font);
  color: #2d3748;
  background: #fff;
  line-height: 1.7;
}

h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.3; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-light); }

img { max-width: 100%; height: auto; }

.py-6 { padding-top: 5rem !important; padding-bottom: 5rem !important; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  background: var(--dark);
  padding: .4rem 0;
  font-size: .8rem;
}

/* ── Navbar ───────────────────────────────────────────────── */
.cdms-navbar {
  background: var(--primary);
  padding: .75rem 0;
  box-shadow: var(--shadow-md);
  transition: background var(--transition), padding var(--transition);
}

.cdms-navbar.scrolled {
  padding: .45rem 0;
  background: rgba(30,58,95,.97);
  backdrop-filter: blur(8px);
}

.cdms-navbar .navbar-brand { gap: .6rem; }

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}

.brand-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  display: flex; align-items: center; justify-content: center;
  color: var(--dark); font-size: 1.1rem; font-weight: 700;
}

.cdms-navbar .nav-link {
  color: rgba(255,255,255,.85) !important;
  font-weight: 500;
  font-size: .88rem;
  padding: .45rem .85rem !important;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.cdms-navbar .nav-link:hover,
.cdms-navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.12);
}

.cdms-navbar .dropdown-menu {
  border-radius: var(--radius-md);
  font-size: .88rem;
  padding: .5rem;
  min-width: 200px;
}

.cdms-navbar .dropdown-item {
  border-radius: var(--radius-sm);
  padding: .45rem .85rem;
  font-weight: 500;
}

.cdms-navbar .dropdown-item:hover { background: var(--light-bg); }

/* ── Section Helpers ──────────────────────────────────────── */
.section-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--secondary);
  display: block;
  margin-bottom: .5rem;
}

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1rem;
  font-family: var(--serif-font);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: .5rem;
}

/* ── Hero Slider ──────────────────────────────────────────── */
.hero-slider { position: relative; }

.hero-slide {
  background-size: cover;
  background-position: center;
  min-height: 620px;
}

@media (max-width: 768px) { .hero-slide { min-height: 480px; } }

.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(13,27,46,.82) 0%, rgba(13,27,46,.42) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 580px;
}

.hero-badge {
  display: inline-block;
  background: var(--secondary);
  color: var(--dark);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: .3rem .9rem;
  border-radius: 30px;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.15;
  font-family: var(--serif-font);
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,.82);
  margin-bottom: 2rem;
  max-width: 440px;
}

/* ── Livestream Banner ────────────────────────────────────── */
.livestream-banner { background: var(--accent); }

.live-badge {
  background: #fff;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: .25rem .7rem;
  border-radius: 30px;
}

.pulse { animation: pulse 1.4s infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* ── Stats Section ────────────────────────────────────────── */
.stat-item { padding: 1rem; }

.stat-number {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  display: block;
  line-height: 1;
  font-family: var(--serif-font);
}

.stat-label {
  font-size: .82rem;
  opacity: .8;
  margin-top: .3rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Pastor Card ──────────────────────────────────────────── */
.pastor-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--light-bg);
}

.pastor-photo {
  width: 100%; height: 480px;
  object-fit: cover;
  display: block;
}

.pastor-info {
  padding: 1.25rem 1.5rem;
  background: var(--primary);
  color: #fff;
}

.pastor-info small { color: rgba(255,255,255,.7); }

.pastor-message-excerpt {
  font-size: .98rem;
  color: #4a5568;
  line-height: 1.8;
  border-left: 4px solid var(--secondary);
  padding-left: 1.25rem;
}

/* ── Event Cards ──────────────────────────────────────────── */
.event-card { border-radius: var(--radius-md) !important; overflow: hidden; }

.event-card-img {
  height: 200px;
  object-fit: cover;
}

.event-date-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: .35rem .7rem;
  line-height: 1;
  font-weight: 700;
  min-width: 46px;
  text-align: center;
}

.event-date-badge .day   { font-size: 1.4rem; font-weight: 900; }
.event-date-badge .month { font-size: .62rem; text-transform: uppercase; letter-spacing: 1px; opacity: .85; }

/* ── Sermon Cards ─────────────────────────────────────────── */
.sermon-img { height: 260px; object-fit: cover; }

.sermon-img-placeholder,
.sermon-thumb-sm-placeholder {
  background: var(--light-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 2.5rem;
}

.sermon-img-placeholder { height: 260px; }
.sermon-thumb-sm-placeholder { width: 68px; height: 52px; border-radius: var(--radius-sm); font-size: 1.2rem; }

.sermon-thumbnail { position: relative; overflow: hidden; }

.sermon-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
  opacity: 0; transition: opacity var(--transition);
}

.sermon-thumbnail:hover .sermon-play-overlay { opacity: 1; }

.play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  transition: transform var(--transition);
}

.play-btn:hover { transform: scale(1.1); color: var(--dark); }

.sermon-provider-badge {
  position: absolute; top: .6rem; left: .6rem;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 4px;
  letter-spacing: 1px;
}

.sermon-thumb-sm { width: 68px; height: 52px; object-fit: cover; }

/* ── Campaigns ────────────────────────────────────────────── */
.campaign-img { height: 180px; object-fit: cover; }
.bg-white-10  { background: rgba(255,255,255,.1) !important; }
.border-white-15 { border-color: rgba(255,255,255,.15) !important; }

/* ── Sponsorship CTA ──────────────────────────────────────── */
.text-white-75 { color: rgba(255,255,255,.75) !important; }

.child-card { border-radius: var(--radius-md); overflow: hidden; }

.child-card-img {
  width: 100%; height: 140px;
  object-fit: cover; object-position: top;
  display: block;
}

.child-card-img-placeholder {
  height: 140px;
  background: var(--light-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 2rem;
}

/* ── Testimonies ──────────────────────────────────────────── */
.testimony-card { border-radius: var(--radius-md) !important; }

.testimony-quote {
  color: var(--secondary);
  font-size: 2.5rem;
  line-height: .8;
  margin-bottom: .75rem;
}

.testimony-text {
  font-style: italic;
  color: #4a5568;
  font-size: .93rem;
  flex-grow: 1;
}

.author-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}

/* ── Gallery Grid ─────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 220px 220px;
  gap: .75rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 992px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: 200px 200px; } }
@media (max-width: 576px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto; } }

.gallery-item { position: relative; overflow: hidden; background: var(--light-bg); }
.gallery-item-large { grid-column: span 2; grid-row: span 2; }

.gallery-link { display: block; width: 100%; height: 100%; }

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.gallery-item:hover img { transform: scale(1.06); }

.gallery-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 60%);
  display: flex; flex-direction: column;
  justify-content: flex-end; padding: 1rem;
  opacity: 0; transition: opacity var(--transition);
}

.gallery-item:hover .gallery-overlay { opacity: 1; }

.gallery-title { color: #fff; font-weight: 700; font-size: .95rem; }
.gallery-count { color: rgba(255,255,255,.7); font-size: .78rem; }

.gallery-placeholder {
  height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--light-bg); color: #ccc; font-size: 2rem;
}

/* ── Blog Cards ───────────────────────────────────────────── */
.blog-img { height: 200px; object-fit: cover; }
.blog-card { border-radius: var(--radius-md) !important; overflow: hidden; }

/* ── Newsletter ───────────────────────────────────────────── */
.newsletter-form .form-control {
  height: 52px;
  font-size: .93rem;
}

/* ── Video Section ───────────────────────────────────────── */
.video-card { border-radius: var(--radius-md) !important; overflow: hidden; }

.video-thumb-wrap { overflow: hidden; background: #000; }

.video-thumb {
  height: 200px;
  object-fit: cover;
  display: block;
  width: 100%;
  transition: transform .4s ease, opacity .3s ease;
}
.video-thumb-placeholder { height: 200px; }

.video-card:hover .video-thumb { transform: scale(1.04); opacity: .85; }

.video-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.video-play-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  transition: transform var(--transition), background var(--transition);
}
.video-play-btn:hover .video-play-icon {
  transform: scale(1.12);
  background: var(--secondary);
  color: var(--dark);
}

.video-duration {
  position: absolute;
  bottom: .5rem; right: .6rem;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}

/* ── Hover Lift ───────────────────────────────────────────── */
.hover-lift {
  transition: transform var(--transition), box-shadow var(--transition);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg) !important;
}

/* ── Footer ───────────────────────────────────────────────── */
.cdms-footer { background: var(--dark); }

.footer-top { border-bottom: 1px solid rgba(255,255,255,.08); }

.footer-heading {
  color: #fff;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none; padding: 0; margin: 0;
}

.footer-links li { margin-bottom: .45rem; }

.footer-links a {
  color: rgba(255,255,255,.55);
  font-size: .88rem;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--secondary); }

.footer-newsletter .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.footer-newsletter .btn        { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  font-size: .95rem;
  transition: all var(--transition);
}

.social-link:hover { background: var(--secondary); color: var(--dark); }

.footer-bottom { border-top: 1px solid rgba(255,255,255,.06); }

/* ── Back to Top ──────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 999;
}

.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover   { transform: translateY(-3px); background: var(--primary-light); }

/* ── Utility / Bootstrap Overrides ───────────────────────── */
.bg-primary   { background-color: var(--primary) !important; }
.btn-primary  { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-light); border-color: var(--primary-light); }
.btn-warning  { color: var(--dark) !important; }
.text-primary { color: var(--primary) !important; }

.rounded-start-3 { border-top-left-radius: var(--radius-sm) !important; border-bottom-left-radius: var(--radius-sm) !important; }

/* ── Auth Pages ───────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo img { height: 52px; }
.auth-title { font-size: 1.5rem; font-weight: 800; text-align: center; margin-bottom: .3rem; }
.auth-subtitle { text-align: center; color: #718096; font-size: .9rem; margin-bottom: 1.75rem; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination .page-link { color: var(--primary); border-radius: var(--radius-sm); margin: 0 2px; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-actions .btn { margin-bottom: .5rem; }
  .pastor-photo { height: 320px; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

/* ── Dark Mode ────────────────────────────────────────────── */
[data-bs-theme="dark"] body.cdms-body {
  background: #0d1117;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .topbar {
  background: #010409;
}
[data-bs-theme="dark"] .cdms-navbar {
  background: #161b22;
}
[data-bs-theme="dark"] .cdms-footer {
  background: #010409;
}
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .card-body {
  background: #161b22;
  border-color: #30363d;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .section-bg,
[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .bg-white {
  background: #0d1117 !important;
}
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
  color: #f0f6fc;
}
[data-bs-theme="dark"] .text-muted {
  color: #8b949e !important;
}
[data-bs-theme="dark"] .text-dark {
  color: #f0f6fc !important;
}
[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item) {
  color: #58a6ff;
}
[data-bs-theme="dark"] .navbar-dark .nav-link,
[data-bs-theme="dark"] .cdms-navbar .nav-link {
  color: rgba(255,255,255,.85);
}
[data-bs-theme="dark"] .dropdown-menu {
  background: #161b22;
  border-color: #30363d;
}
[data-bs-theme="dark"] .dropdown-item {
  color: #c9d1d9;
}
[data-bs-theme="dark"] .dropdown-item:hover {
  background: #21262d;
  color: #f0f6fc;
}
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] hr {
  border-color: #30363d !important;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background: #0d1117;
  border-color: #30363d;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background: #161b22;
  border-color: #58a6ff;
  color: #f0f6fc;
}
[data-bs-theme="dark"] .badge.bg-light {
  background: #21262d !important;
  color: #c9d1d9 !important;
}
[data-bs-theme="dark"] .sermon-compact-item,
[data-bs-theme="dark"] .testimony-card {
  background: #161b22;
  border-color: #30363d;
}
[data-bs-theme="dark"] .stats-section {
  background: #161b22;
}
[data-bs-theme="dark"] .sermon-featured-card {
  background: #161b22;
}
[data-bs-theme="dark"] .btn-outline-secondary {
  border-color: #30363d;
  color: #c9d1d9;
}
[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background: #21262d;
  color: #f0f6fc;
}
