/* ==========================================================================
   Discipleship Learning Platform - Mobile-First Stylesheet
   Optimized for Smartphones, Touch Interactions & Reading Ergonomics
   ========================================================================== */

:root {
  --disp-bg: #f8fafc;
  --disp-card-bg: #ffffff;
  --disp-text-main: #1e293b;
  --disp-text-muted: #64748b;
  --disp-accent: #4f46e5;
  --disp-accent-hover: #4338ca;
  --disp-accent-light: rgba(79, 70, 229, 0.08);
  --disp-border: #e2e8f0;
  --disp-nav-height: 58px;
  --disp-safe-bottom: env(safe-area-inset-bottom, 0px);
  --disp-safe-top: env(safe-area-inset-top, 0px);
}

/* ==========================================================================
   CRITICAL: Override biblia.css body-lock rules.
   biblia.css sets: html { overflow: hidden } and
   body { position: fixed; overflow-y: hidden; height: 100vh }
   These completely freeze scrolling on mobile.
   discipleship.css loads AFTER biblia.css so !important wins here.
   ========================================================================== */
html {
  width: 100% !important;
  height: auto !important;
  /* Explicitly undo biblia.css's shorthand overflow: hidden */
  overflow: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scroll-behavior: smooth !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

body {
  width: 100% !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  /* Explicitly undo biblia.css's height: 100vh; position: fixed */
  height: auto !important;
  max-height: none !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
  /* Explicitly undo biblia.css's overflow-y: hidden and shorthand overflow */
  overflow: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  background-color: #0f172a !important;
  color: var(--disp-text-main) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* Body Scroll Lock for Overlays */
body.asmt-modal-open,
body.asmt-drawer-open {
  overflow: hidden !important;
  touch-action: none;
}


/* Main Reading Document Container */
#document {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem calc(var(--disp-nav-height) + var(--disp-safe-bottom) + 2rem) 1.1rem;
  background: var(--disp-card-bg);
  min-height: 100vh;
  box-sizing: border-box;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
  font-size: 1.05rem;
  line-height: 1.74;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#document p {
  margin: 1rem 0;
  color: #334155;
  word-break: break-word;
}

#document strong {
  color: #0f172a;
  font-weight: 700;
}

#document em {
  color: #475569;
}

/* Links & Scroll Anchors */
#document a {
  color: var(--disp-accent);
  text-decoration: none;
  transition: color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(79, 70, 229, 0.15);
}

#document a:hover,
#document a:active {
  color: var(--disp-accent-hover);
  text-decoration: underline;
}

#document a[id] {
  scroll-margin-top: 1.5rem;
}

/* Table of Contents & Lists Indentation on Mobile */
#document ol,
#document ul {
  padding-inline-start: 1.4rem;
  margin: 0.6rem 0;
}

#document li {
  margin-bottom: 0.45rem;
  line-height: 1.6;
}

/* Responsive Tables */
figure.wp-block-table,
.wp-block-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.25rem 0;
  border: 1px solid var(--disp-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

figure.wp-block-table table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  text-align: left;
}

figure.wp-block-table td,
figure.wp-block-table th {
  padding: 10px 14px;
  border: 1px solid var(--disp-border);
  font-size: 0.94rem;
  color: #334155;
}

/* Mobile Fixed Bottom Navigation Bar */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--disp-nav-height);
  padding-bottom: var(--disp-safe-bottom);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 9000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  height: 100%;
  min-height: 48px;
  cursor: pointer;
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 4px 0;
}

.mobile-nav-item:active {
  transform: scale(0.92);
  color: #818cf8;
}

.mobile-nav-item.nav-item-active {
  color: #818cf8;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Mobile Quick Assessment Drawer / Bottom Sheet */
.asmt-drawer-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: drawerFadeIn 0.2s ease;
}

@keyframes drawerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.asmt-drawer-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.75rem 1.1rem calc(1.5rem + var(--disp-safe-bottom)) 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: drawerSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

@keyframes drawerSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.asmt-drawer-handle {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 auto;
}

.asmt-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.asmt-drawer-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #ffffff;
  font-weight: 700;
}

.asmt-drawer-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

.asmt-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow-y: auto;
  max-height: 60vh;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.asmt-drawer-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #f1f5f9;
  cursor: pointer;
  text-align: left;
  min-height: 52px;
  transition: all 0.18s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  box-sizing: border-box;
}

.asmt-drawer-item:active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  transform: scale(0.98);
}

.asmt-drawer-item-icon {
  font-size: 1.4rem;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.asmt-drawer-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.asmt-drawer-item-info strong {
  font-size: 0.95rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asmt-drawer-item-info span {
  font-size: 0.78rem;
  color: #94a3b8;
}

.asmt-drawer-item-arrow {
  font-size: 0.9rem;
  color: #818cf8;
  margin-left: auto;
  flex-shrink: 0;
}

/* Bible Panel & Popup Defaults */
#biblia,
.search-window-cover {
  display: none;
  z-index: 25000 !important;
}

#verse-popup,
.verse-popup {
  z-index: 30000 !important;
}

/* Mobile Verse Popup Bottom Sheet */
@media (max-width: 640px) {
  #document {
    padding: 1rem 0.9rem calc(var(--disp-nav-height) + var(--disp-safe-bottom) + 1.5rem) 0.9rem;
    font-size: 1.02rem;
    line-height: 1.68;
  }

  #document ol,
  #document ul {
    padding-inline-start: 1rem;
  }

  #document li {
    font-size: 0.98rem;
    margin-bottom: 0.35rem;
  }

  .verse-popup {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(var(--disp-nav-height) + var(--disp-safe-bottom) + 8px) !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: 52vh !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    z-index: 30000 !important;
    animation: versePopSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes versePopSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .verse-popup__title {
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
    border-radius: 15px 15px 0 0 !important;
  }

  .verse-popup__body {
    padding: 1rem !important;
    font-size: 1.05rem !important;
    line-height: 1.65 !important;
    max-height: 36vh !important;
  }

  .verse-popup__more {
    padding: 0.65rem 1rem !important;
    font-size: 0.95rem !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    border-radius: 0 0 15px 15px !important;
  }
}

/* ==========================================================================
   #biblia Bible Panel Modal - Sticky Header & Non-Scrollable Container
   Keeps the original color palette and styles while preventing header from scrolling out of view
   ========================================================================== */

/* Outer Panel Cover - Fixed position, strictly non-scrolling */
#biblia.search-window-cover {
  position: fixed !important;
  display: none;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 25000 !important;
  background-color: #FAF8FF !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Open state when activated via inline style or JS */
#biblia.search-window-cover:not([style*="display: none"]):not([style*="display:none"]) {
  display: flex !important;
}

/* Dismissed / closed state */
#biblia.search-window-cover[style*="display: none"],
#biblia.search-window-cover[style*="display:none"] {
  display: none !important;
}

/* Desktop & Tablet Viewport (min-width: 641px) */
@media (min-width: 641px) {
  #biblia.search-window-cover {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(94vw, 820px) !important;
    max-width: 820px !important;
    height: min(88vh, 800px) !important;
    max-height: 88vh !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35) !important;
  }
}

/* Mobile Viewport (max-width: 640px) */
@media (max-width: 640px) {
  #biblia.search-window-cover {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* Sticky Search Input Bar - Original Light Appearance */
#biblia #search_content {
  flex-shrink: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 60 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 42px !important;
  box-sizing: border-box !important;
  background-color: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #cbd5e1 !important;
  border-bottom: 2px solid #94a3b8 !important;
  padding: 8px 14px !important;
  font-size: 16px !important; /* Prevents auto-zoom on mobile */
  outline: none !important;
  border-radius: 0 !important;
}

#biblia #search_content::placeholder {
  color: #64748b !important;
}

/* Sub-window container (active tool view) */
#biblia .search-window {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: calc(100% - 42px) !important;
  max-height: calc(100% - 42px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  background-color: #FAF8FF !important;
  color: #000000 !important;
}

#biblia .search-window[style*="display: none"],
#biblia .search-window[style*="display:none"] {
  display: none !important;
}

/* Sticky Header with Options and Close Button - Restored to Original Header Colors */
#biblia .search-window__header {
  flex-shrink: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background-color: var(--main-color, #232946) !important;
  color: #ffffff !important;
  padding: 8px 12px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  gap: 4px !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15) !important;
}

@media (max-width: 640px) {
  #biblia .search-window__header {
    padding-top: calc(8px + var(--disp-safe-top, 0px)) !important;
  }
}

#biblia .search-window__header::-webkit-scrollbar {
  display: none !important;
}

#biblia .search-window__header > div {
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

/* Header Close Button - Red icon on original header, easily accessible */
#biblia .search-window__header > div:last-child {
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 40px !important;
  min-height: 40px !important;
  padding: 4px 6px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  background: transparent !important;
  transition: background-color 0.15s ease, transform 0.15s ease !important;
}

#biblia .search-window__header > div:last-child:hover,
#biblia .search-window__header > div:last-child:active {
  background-color: rgba(239, 68, 68, 0.25) !important;
  transform: scale(1.08) !important;
}

#biblia .search-window__header > div:last-child svg {
  color: #ef4444 !important;
  fill: #ef4444 !important;
  width: 24px !important;
  height: 24px !important;
}

/* Search dropdown heading */
#biblia .search-window .heading {
  flex-shrink: 0 !important;
  background-color: #d1cfcf !important;
  color: #000000 !important;
  padding: 8px 12px !important;
}

/* Scrollable Body - ONLY THIS CONTAINER SCROLLS - Original Light Background */
#biblia .search-window__body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  padding: 12px 14px 32px 14px !important;
  box-sizing: border-box !important;
  background-color: #ffffff !important;
  color: #000000 !important;
}

@media (max-width: 640px) {
  #biblia .search-window__body {
    padding-bottom: calc(32px + var(--disp-safe-bottom, 0px)) !important;
  }
}

/* Scripture Chapter & Verse Content Styling - Original Black Text on White */
#biblia .bible-chapter > div,
#biblia .verse-content > div {
  color: #000000 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 10px 6px !important;
  font-size: 1rem !important;
  line-height: 1.6 !important;
}

/* Context / Highlighted Verses - Crisp Black Font on Soft Lavender Highlight */
#biblia .context,
#biblia .bible-chapter > div.context,
#biblia .verse-content > div.context {
  background-color: #d6cee5 !important;
  color: #000000 !important;
  border-left: 3px solid #6b21a8 !important;
  padding-left: 8px !important;
  border-radius: 4px !important;
}

#biblia .context *,
#biblia .bible-chapter > div.context *,
#biblia .verse-content > div.context * {
  color: #000000 !important;
}

#biblia a.context,
#biblia .context a {
  color: #1d4ed8 !important;
  font-weight: bold !important;
  text-decoration: underline !important;
}

/* Panels (e.g. search panels) - Original Light Look */
#biblia .search-window__body .panel {
  color: #000000 !important;
}

#biblia .search-window__body .panel > div {
  color: #000000 !important;
}

#biblia .search-window__body .panel > a {
  color: #1d4ed8 !important;
}

/* ─── Discipleship & Disciplers Top Navigation Bar ─────────────────────── */
.discipleship-top-bar {
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.discipleship-top-bar-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  box-sizing: border-box;
  gap: 0.75rem;
}

.disp-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.disp-nav-back:hover,
.disp-nav-back:active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.disp-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.2rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.disp-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.disp-nav-link:hover {
  color: #ffffff;
}

.disp-nav-link.active {
  background: #4f46e5;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

@media (max-width: 540px) {
  .discipleship-top-bar-inner {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  .disp-nav-back span {
    display: none;
  }
  .disp-nav-back {
    padding: 0.4rem;
  }
  .disp-nav-link {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }
}

