/* ---------------------------------------
   Layout & Message Box
--------------------------------------- */
:root {
  --howtolive-page-offset: -80px;
  --howtolive-content-max-width: 1100px;
  --howtolive-content-padding-x: 10px;
  --howtolive-section-shift-x: 65px;
  --howtolive-section-padding-y: 20px;
  --howtolive-date-width: 60px;
  --howtolive-column-gap: 5px;
  --howtolive-right-inset: 60px;
  --howtolive-left-col-width: 43%;
  --howtolive-right-col-width: 43%;
  --howtolive-findings-size: 20px;
  --howtolive-header-title-size: 40px;
  --howtolive-header-subtitle-size: 30px;
  --howtolive-header-margin-top: -10px;
  --howtolive-header-margin-bottom: 60px;
  --howtolive-divider-margin-top: -38px;
  --howtolive-divider-margin-bottom: 6px;
  --howtolive-header-shift-x: -150px;
  --howtolive-divider-width: 90%;
  --howtolive-divider-shift-x: 70px;
  --howtolive-menu-top: 130px;
  --howtolive-menu-left: max(
    20px,
    calc((100vw - var(--howtolive-content-max-width)) / 2 + var(--howtolive-content-padding-x))
  );
  --howtolive-menu-width: 240px;
  --howtolive-menu-title-font-size: 20px;
  --howtolive-menu-item-font-size: 16px;
  --howtolive-menu-arrow-size: 20px;
  --howtolive-menu-item-padding-y: 6px;
  --howtolive-menu-item-padding-x: 6px;
  --howtolive-menu-z: 2500;
  --howtolive-menu-nav-z: 2501;
  --howtolive-menu-title-z: 2502;
  --howtolive-menu-shift-x: 50px;
  --howtolive-menu-shift-y: -22px;    /*Adjust the values at the top of the file 
                                    (negative = left/up, positive = right/down).*/
  --howtolive-menu-primary: #1f8f3a;
  --howtolive-menu-hover: #176e2d;
  --howtolive-menu-bg: rgba(230, 247, 234, 0.98);
  --howtolive-menu-separator: rgba(23, 110, 45, 0.32);
  --howtolive-text-color: #333333;
  --howtolive-red: #e61e1e;
}

.page-howtolive .howtolive-section {
  max-width: var(--howtolive-content-max-width);
  margin: 0 auto;
  padding: var(--howtolive-section-padding-y) var(--howtolive-content-padding-x);
  font-family: "Segoe UI", SegoeUI, system-ui, -apple-system, sans-serif;
  transform: translateX(var(--howtolive-section-shift-x));
  margin-top: var(--howtolive-page-offset);
}

#howtolive-local-menu,
.howtolive-local-menu-slot {
  position: relative;
  margin-top: var(--howtolive-menu-top);
  margin-left: var(--howtolive-menu-left);
  z-index: var(--howtolive-menu-nav-z);
  width: var(--howtolive-menu-width);
  isolation: isolate;
  transform: translate(var(--howtolive-menu-shift-x), var(--howtolive-menu-shift-y));
}

.howtolive-local-menu {
  position: relative;
  width: var(--howtolive-menu-width);
}

.howtolive-menu-title {
  font-family: "Segoe UI", SegoeUI, system-ui, -apple-system, sans-serif;
  font-size: var(--howtolive-menu-title-font-size);
  font-weight: 600;
  color: var(--howtolive-menu-primary);
  margin: 0;
  padding: 8px 32px 8px 12px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 6px;
  border: 2px solid var(--howtolive-menu-primary);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  background: transparent;
  border: none;
  z-index: var(--howtolive-menu-title-z);
}

.howtolive-menu-title::after {
  content: "\25BE";
  font-size: var(--howtolive-menu-arrow-size);
  transition: transform 0.3s;
  position: absolute;
  right: 12px;
}

.howtolive-menu-title:hover {
  background: rgba(31, 143, 58, 0.08);
}

.howtolive-menu-nav {
  display: none;
  background: var(--howtolive-menu-bg);
  border-color: var(--howtolive-menu-primary);
  border: 2px solid var(--howtolive-menu-primary);
  border-radius: 6px;
  padding: 5px 0;
  margin-top: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  max-height: 400px;
  overflow-y: auto;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--howtolive-menu-z);
  width: var(--howtolive-menu-width);
}

.howtolive-local-menu:hover .howtolive-menu-nav,
.howtolive-local-menu:focus-within .howtolive-menu-nav {
  display: block;
}

.howtolive-local-menu:hover .howtolive-menu-title::after,
.howtolive-local-menu:focus-within .howtolive-menu-title::after {
  transform: rotate(180deg);
}

.howtolive-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.howtolive-menu-list li {
  margin: 0;
  padding: 0;
}

.howtolive-menu-list li.howtolive-menu-separator {
  list-style: none;
  height: 2px;
  margin: 2px 2px;
  background: var(--howtolive-menu-separator);
}

.howtolive-menu-list li a {
  display: block;
  padding: var(--howtolive-menu-item-padding-y) var(--howtolive-menu-item-padding-x);
  font-family: "Segoe UI", SegoeUI, system-ui, -apple-system, sans-serif;
  font-size: var(--howtolive-menu-item-font-size);
  font-weight: 500;
  color: var(--howtolive-menu-primary);
  text-decoration: none;
  transition: background 0.2s;
  line-height: 1.4;
  text-align: left;
}

.howtolive-menu-list li a:hover,
.howtolive-menu-list li a.active {
  background: var(--howtolive-menu-hover);
  color: #fff;
}

.howtolive-menu-divider {
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #4f6b59;
  background: #eef5ef;
  border-top: 1px solid #d5e2d7;
  border-bottom: 1px solid #d5e2d7;
}

.howtolive-menu-nav::-webkit-scrollbar {
  width: 6px;
}

.howtolive-menu-nav::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.howtolive-menu-nav::-webkit-scrollbar-thumb {
  background: var(--howtolive-menu-primary);
  border-radius: 3px;
}

.howtolive-menu-nav::-webkit-scrollbar-thumb:hover {
  background: var(--howtolive-menu-hover);
}

.page-howtolive .howtolive-header-section {
  padding: 0;
  margin: var(--howtolive-header-margin-top) 0 var(--howtolive-header-margin-bottom);
  text-align: right;
  max-width: 100%;
  transform: translateX(var(--howtolive-header-shift-x));
}

.page-howtolive .howtolive-header-title {
  font-family: "Arial Narrow", Arial, sans-serif;
  font-weight: 350;
  color: #5a0a87;
  margin: 0;
  line-height: 1.2;
  font-size: var(--howtolive-header-title-size);
}

.page-howtolive .howtolive-header-subtitle {
  font-family: "Arial Narrow", Arial, sans-serif;
  font-weight: 350;
  color: #5a0a87;
  margin: 0;
  line-height: 1.2;
  font-size: var(--howtolive-header-subtitle-size);
}

.page-howtolive .howtolive-header-divider {
  margin-top: var(--howtolive-divider-margin-top);
  margin-bottom: var(--howtolive-divider-margin-bottom);
  border: none;
  border-top: 2px solid var(--howtolive-menu-primary);
  width: var(--howtolive-divider-width);
  transform: translateX(var(--howtolive-divider-shift-x));
}

.howtolive-main-content {
  display: flex;
  gap: var(--howtolive-column-gap);
  margin: 30px 0;
  align-items: stretch;
  max-width: 100%;
}

.howtolive-leftbox {
  flex: 0 0 var(--howtolive-left-col-width);
  max-width: var(--howtolive-left-col-width);
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
  min-width: 0;
}

.howtolive-rightbox {
  flex: 0 0 var(--howtolive-right-col-width);
  max-width: var(--howtolive-right-col-width);
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
  min-width: 0;
}

/* Independent layout for doors pages */
.howtolive-doors-columns {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: stretch;
  margin-top: 15px;
}

.howtolive-doors-left,
.howtolive-doors-right {
  flex: 0 0 calc((100% - 18px) / 2);
  max-width: calc((100% - 18px) / 2);
  min-width: 0;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.howtolive-doors-bottombox {
  margin-top: 30px;
  padding: 18px;
  background: #f7f6f3;
  border-top: 2px solid #ccc;
  text-align: center;
}

.highlight-green {
  color: var(--howtolive-menu-primary);
  font-weight: 600;
}

.highlight-red {
  color: var(--howtolive-red);
  font-weight: 600;
}


.date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.date-label {
  font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 500;
  font-size: 25px;
  color: #19a82c;
}

.date-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 10px;
}

.control-btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1.1;
}

.control-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.date-picker {
  width: var(--howtolive-date-width);
  max-width: 100%;
  flex: 0 0 auto;
}

.page-howtolive input[type="date"] {
  width: auto;
}

.display-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tts-note {
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  margin: 4px 0 8px;
  color: #333;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.search-label {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;;
  font-weight: 500;
  font-size: 22px;
  color: #19a82c;
}

.search-input {
  width: 240px;
  max-width: 100%;
  flex: 1 1 220px;
}

.search-btn {
  width: 50px;
  padding: 10px 0;
  align-self: center;
}

.search-count {
  color: #5a0a87;
  font-size: var(--howtolive-findings-size);
  font-weight: 600;
  margin-top: 2px;
}

.search-note {
  color: #4b4b4b;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 2px;
}

.search-result-item {
  padding: 10px 6px;
  border-bottom: 1px solid #e3deee;
}

.search-result-date {
  font-weight: 600;
  color: #2c3e80;
  text-decoration: none;
}

.search-result-date:hover {
  text-decoration: underline;
}

.search-result-snippet {
  margin-top: 6px;
  color: #333;
  font-size: 14px;
  line-height: 1.5;
}

.highlight-sky {
  background: #87ceeb;
  padding: 0 2px;
  border-radius: 3px;
}

.sermon-meta {
  color: #0a0c84;
  font-size: 24px;
  font-weight: 400px;
  margin-bottom: 12px;
  text-align: right;
}
.sermon-meta-bottom {
  margin-top: 12px;
  margin-bottom: 0;
}

.message-box {
  background: #fdfcf9;
  border: 1px solid #e0d8b0;
  padding: 20px;
  border-radius: 8px;
  line-height: 1.7;
  text-align: justify;
  font-size: 16px;
}


/* ---------------------------------------
   Navigation Buttons (Prev / Today / Next)
--------------------------------------- */
.nav-btns {
  display: flex;
  justify-content: center;
  gap: 14px;              /* even spacing between all buttons */
  margin: 15px 0 20px;
  flex-wrap: nowrap;      /* keeps them in a single row */
}

.nav-btn {
  width: 130px;           /* same width for all buttons */
  text-align: center;
  white-space: nowrap;    /* no wrapping */
  background: linear-gradient(180deg, #c7a045, #b0872f);
  color: white;
  border: none;
  padding: 10px 0;        /* consistent vertical spacing */
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Segoe UI', sans-serif;
  transition: 0.2s ease-in-out;
}

/* Make the triangle icons (◄ ►) slightly larger */
.nav-btn span {
  font-size: 20px;         /* increase to 22px or 24px if you want larger arrows */
  vertical-align: middle;  /* keep aligned with text baseline */
}

.nav-btn:hover {
  background: linear-gradient(180deg, #d8b85a, #b58e32);
  transform: scale(1.05);
}

.today-btn {
  background: linear-gradient(180deg, #7b63b0, #604e91);
}
.nav-links {
  margin-top: 15px;
}
.nav-links button {
  margin-right: 10px;
  padding: 6px 12px;
  cursor: pointer;
}
/* ************************************************************************* */
/* --- Keep left/right column visually balanced --- */
.howtolive-main-content {
  display: flex;
  align-items: stretch;
  gap: var(--howtolive-column-gap);
}


/* ---------------------------------------
   Right Column Controls
--------------------------------------- */
.howtolive-leftbox{
  /* max-height: 95vh;     visually same height as left column */
  overflow-y: auto;
}

.howtolive-rightbox {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;        /* Keeps content inside right column boundary */
  margin: 0 auto;  
  /* max-height: 100vh;    visually same height as left column */
  overflow-y: auto;
  padding-right: 5px;
  transform: translateX(calc(-1 * var(--howtolive-right-inset)));
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;  
}

.date-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: 55%;
  box-sizing: border-box;  
}

.modern-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: 'Segoe UI', sans-serif;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.modern-btn {
  background: linear-gradient(180deg, #7b63b0, #604e91);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s ease-in-out;
}

.modern-btn:hover {
  background: linear-gradient(180deg, #8f78c2, #6756a2);
  font-weight: 500;
  transform: scale(1.15);
}

/* ************************************************************************ */
/* ---------------------------------------
   Search Results Box
--------------------------------------- */
.search-results {
  margin-top: -4px;
  background: #f6f4fb;
  border: 1px solid #d8d1e7;
  padding: 10px;
  border-radius: 6px;
  max-height: 1500px; /* 👈 same visual height as left column */
  overflow-y: auto;
}

button {
  background-color: #cba135;
  color: #fff;
  font-size: 15px;
  padding: 10px 18px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin: 4px 2px;
}

button:hover {
  background-color: #b58f1e;
}

input[type="date"],
input[type="text"] {
  font-size: 15px;
  padding: 8px;
  width: 90%;
  border: 1px solid #ccc;
  border-radius: 4px;
}


/* Match right column to left column height */
.rightcol {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
}

/* Search results scroll inside box instead of growing tall */
#searchResults {
  background: #f6f4fb;
  border: 1px solid #d8d1e7;
  padding: 10px;
  border-radius: 6px;
  /* max-height: 60vh; */
  overflow-y: auto;
  box-sizing: border-box;
}

#searchResults a:hover {
  text-decoration: underline;
}

/* Pause / Resume button */
.pause-btn {
  background: linear-gradient(180deg, #af4d4d, #8f3939);
}
.pause-btn:hover {
  background: linear-gradient(180deg, #c86464, #9e4646);
  transform: scale(1.05);
}

/* Speaker button special color */
.speaker-btn {
  background: linear-gradient(180deg, #4e9c5d, #3b7e4a);
}

.speaker-btn:hover {
  background: linear-gradient(180deg, #5eb76d, #459d55);
  transform: scale(1.05);
}

/* Word being spoken */
.tts-word.current-word {
  background-color: #aee7f8;  /* slightly softer blue */
  border-radius: 3px;
  transition: background-color 0.1s ease;
}


/* Keep sermon text visually identical when wrapped into spans */
.tts-word {
  display: inline-block;        /* maintains consistent line spacing */
  font-size: inherit;           /* same size as original text */
  line-height: inherit;         /* prevent text compression */
  font-family: inherit;
  white-space: pre-wrap;        /* keep natural spaces */
  scroll-margin: 120px;
  
}

.message-box { line-height: 1.7; }

@media (max-width: 900px) {
  :root {
    --howtolive-page-offset: 0px;
  }

  .page-howtolive .howtolive-section {
    padding-left: 14px;
    padding-right: 14px;
    transform: none;
  }

  #howtolive-local-menu,
  .howtolive-local-menu-slot {
    position: static;
    margin: calc(var(--header-height, 88px) + 8px) 0 20px 0;
    width: 100%;
    max-width: 100%;
    transform: none;
  }

  .howtolive-local-menu {
    width: 100%;
  }

  .howtolive-menu-title {
    width: 100%;
  }

  .howtolive-menu-nav {
    display: none;
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 6px;
    box-shadow: none;
  }

  .howtolive-local-menu.is-open .howtolive-menu-nav {
    display: block;
  }

  .howtolive-local-menu.is-open .howtolive-menu-title::after {
    transform: rotate(180deg);
  }

  .page-howtolive .howtolive-header-section {
    transform: none;
    margin: 0 0 18px 0;
    text-align: left;
  }

  .page-howtolive .howtolive-header-divider {
    width: 100%;
    transform: none;
  }

  .howtolive-main-content {
    flex-direction: column;
    align-items: stretch;
  }

  .howtolive-leftbox,
  .howtolive-rightbox {
    flex: 0 0 100%;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    transform: none;
    margin: 0;
  }

  .howtolive-doors-columns {
    flex-direction: column;
  }

  .howtolive-doors-left,
  .howtolive-doors-right {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .date-box,
  .search-box {
    max-width: 100%;
  }

  .nav-btns {
    flex-wrap: wrap;
  }

  .nav-btn {
    width: 100%;
    max-width: 220px;
  }
}

/* Keep doors pages side-by-side on touch devices in landscape */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (min-width: 700px) {
  .howtolive-doors-columns {
    flex-direction: row;
  }

  .howtolive-doors-left,
  .howtolive-doors-right {
    flex: 0 0 calc((100% - 18px) / 2);
    max-width: calc((100% - 18px) / 2);
  }
}

/* Fallback: enforce doors 2-column on landscape tablets regardless pointer type */
@media (orientation: landscape) and (min-width: 700px) {
  .howtolive-doors-columns {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 18px !important;
  }

  .howtolive-doors-left,
  .howtolive-doors-right {
    flex: 0 0 calc((100% - 18px) / 2) !important;
    max-width: calc((100% - 18px) / 2) !important;
    width: calc((100% - 18px) / 2) !important;
    min-width: 0 !important;
  }
}

