/* แถบเมนูล่าง + แผงเมนูมือถือ (ไม่พึ่ง Tailwind CDN) */

.mobile-tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e2e8f0;
  border-radius: 1.25rem 1.25rem 0 0;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-tab-bar__inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  max-width: 32rem;
  margin: 0 auto;
  min-height: 4.5rem;
  padding: 0 0.25rem;
}

.mobile-tab-bar__link,
.mobile-tab-bar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.45rem 0.2rem 0.6rem;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: #64748b;
  text-align: center;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease;
}

.mobile-tab-bar__link:hover,
.mobile-tab-bar__btn:hover {
  color: var(--brand-700);
}

.mobile-tab-bar__link.is-active,
.mobile-tab-bar__btn.is-active {
  color: var(--brand-700);
  font-weight: 600;
}

.mobile-tab-bar__icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.75rem;
  transition: background 0.2s ease;
}

.mobile-tab-bar__link.is-active .mobile-tab-bar__icon,
.mobile-tab-bar__btn.is-active .mobile-tab-bar__icon {
  background: var(--brand-100);
}

.mobile-tab-bar__icon svg {
  width: 1.35rem !important;
  height: 1.35rem !important;
  max-width: 1.35rem !important;
  max-height: 1.35rem !important;
  display: block;
  flex-shrink: 0;
}

.mobile-tab-bar__label {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ปุ่มกลาง — บริจาค */
.mobile-tab-bar__link--center {
  padding-bottom: 0.35rem;
  margin-top: -1.25rem;
}

.mobile-tab-bar__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--fab-mid) 50%, var(--fab-end) 100%);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand-600) 45%, transparent);
  border: 3px solid #fff;
}

.mobile-tab-bar__fab svg {
  width: 1.4rem !important;
  height: 1.4rem !important;
  color: #fff;
}

.mobile-tab-bar__link--center.is-active .mobile-tab-bar__label {
  color: var(--brand-700);
  font-weight: 600;
}

/* แผงเมนูเพิ่มเติม */
.mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s ease;
}

.mobile-sheet.is-open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-sheet.is-open .mobile-sheet__backdrop {
  opacity: 1;
}

.mobile-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(85vh, 32rem);
  background: #fff;
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  padding: 0 1rem 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mobile-sheet.is-open .mobile-sheet__panel {
  transform: translateY(0);
}

.mobile-sheet__handle {
  width: 2.5rem;
  height: 0.25rem;
  background: #cbd5e1;
  border-radius: 9999px;
  margin: 0.75rem auto 0.5rem;
  flex-shrink: 0;
}

.mobile-sheet__title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  padding: 0 0.5rem 0.75rem;
  flex-shrink: 0;
}

.mobile-sheet__body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.mobile-sheet__links {
  /* ลิงก์อยู่ใน mobile-sheet__body ที่ scroll ได้ */
}

.mobile-sheet__tools {
  margin-top: 0.5rem;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.mobile-sheet__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.75rem;
  border-radius: 0.75rem;
  color: #334155;
  text-decoration: none;
  font-size: 0.9375rem;
  transition: background 0.15s ease;
}

.mobile-sheet__link:hover,
.mobile-sheet__link.is-active {
  background: var(--brand-50);
  color: var(--brand-700);
}

.mobile-sheet__link svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  flex-shrink: 0;
  color: var(--brand-600);
}

.mobile-sheet__link--cta {
  margin-top: 0.5rem;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--fab-mid) 50%, var(--fab-end) 100%);
  color: #fff !important;
  font-weight: 600;
}

.mobile-sheet__link--cta svg {
  color: #fff !important;
}

/* Admin drawer */
.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.admin-drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* Admin sidebar drawer (มือถือ) */
@media (max-width: 767px) {
  #sidebar {
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }
  #sidebar.admin-sidebar--open {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 16rem;
    max-width: 85vw;
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.15);
  }
}

@media (min-width: 768px) {
  .mobile-tab-bar,
  .mobile-sheet {
    display: none !important;
  }
  .admin-drawer-backdrop {
    display: none !important;
  }
  #sidebar.admin-sidebar--open {
    position: static;
    width: 16rem;
    max-width: none;
    box-shadow: none;
  }
}

@media (min-width: 1024px) {
  .mobile-tab-bar--public {
    display: none !important;
  }
}

body.mobile-sheet-open {
  overflow: hidden;
}

body.has-mobile-tab-bar {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  body.admin-app.has-mobile-tab-bar {
    padding-bottom: 0;
  }
}

@media (min-width: 1024px) {
  body.has-mobile-tab-bar:not(.admin-app) {
    padding-bottom: 0;
  }
}

/* Header brand — โลโก้สูงเท่าบล็อกข้อความ (JS ปรับขนาด), ชื่ออยู่กึ่งกลางแนวตั้ง */
.site-header-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.5rem;
  align-items: center;
}

@media (min-width: 640px) {
  .site-header-brand {
    column-gap: 0.75rem;
  }
}

.site-header-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-header-logo {
  flex-shrink: 0;
  aspect-ratio: 1;
  height: auto;
  width: auto;
  min-height: 2.75rem;
  min-width: 2.75rem;
}

@media (min-width: 640px) {
  .site-header-logo {
    min-height: 3.25rem;
    min-width: 3.25rem;
  }
}

.site-header-logo .site-header-logo__img {
  display: block;
  height: 100%;
  width: 100%;
}

/* แถบคำพระคัมภีร์ — ด้านบน Header ทุกหน้า */
.site-header-verse {
  background: var(--gradient-brand);
  color: #fff;
}

.site-header-verse__inner {
  display: flex;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  text-align: center;
}

@media (min-width: 640px) {
  .site-header-verse__inner {
    padding: 0.5rem 1rem;
  }
}

.site-header-verse__line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
}

@media (min-width: 640px) {
  .site-header-verse__line {
    gap: 0.625rem;
    font-size: 0.875rem;
    line-height: 1.5;
  }
}

.site-header-verse__icon {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  color: #fff;
  opacity: 0.92;
}

@media (min-width: 640px) {
  .site-header-verse__icon {
    width: 1.25rem;
    height: 1.25rem;
  }
}

.site-header-verse__content {
  min-width: 0;
  text-align: left;
}

.site-header-verse__ref {
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
}

.site-header-verse__sep {
  margin-inline: 0.35rem;
  font-style: normal;
  font-weight: 700;
  opacity: 0.65;
}

.site-header-verse__text {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}
