/* ============================================================
   AFC BOTSWANA — SITE ENHANCEMENTS
   Navbar, live editor, motion, buttons, footer
   ============================================================ */

/* ── NAVBAR: always fixed, always blue ── */
#navbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9000 !important;
  background: var(--navy-800) !important;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.28);
  transform: none !important;
  padding-top: 0;
}

#navbar.nav-pinned,
#navbar.scrolled {
  background: var(--navy-700) !important;
}

/* Hamburger must always sit above the logo/brand and be easy to tap */
.hamburger {
  position: relative;
  z-index: 1300;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

body {
  padding-top: 72px;
}

body.has-live-admin-bar {
  padding-top: 112px;
}

/* ── PAGE TRANSITIONS — soft crossfade + veil ── */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(212, 175, 55, 0.12), transparent 50%),
    #060a12;
  opacity: 0;
  transition: opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

html.page-leaving .page-veil {
  opacity: 1;
  pointer-events: auto;
}

body.page-enter {
  animation: pageEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.page-exit {
  animation: pageExit 0.42s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Opacity-only: transform/filter on body breaks position:sticky (e.g. locations toolbar). */
@keyframes pageEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pageExit {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .page-veil {
    display: none;
  }
  body.page-enter,
  body.page-exit {
    animation: none;
  }
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── SCROLL REVEAL ── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Lucide icons ── */
[data-lucide] {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.afc-icon {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.event-card-date,
.event-card-loc,
.contact-item .contact-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.contact-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  align-items: center;
  justify-content: center;
}

/* ── BUTTONS — unified ── */
.btn-primary,
.btn-gold,
.social-join-btn {
  color: var(--navy-900) !important;
  text-shadow: none;
}

.btn-on-dark,
.section-dark .btn-primary,
.event-card .btn-primary {
  color: var(--navy-900) !important;
  background: var(--gold) !important;
  border-color: var(--gold) !important;
  font-weight: 700;
}

.btn-outline {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.75) !important;
}

.section-light .btn-outline,
.section-mid .btn-outline,
.about-links .btn-outline,
.home-band-light .btn-outline {
  color: var(--navy-700) !important;
  border-color: var(--navy-500) !important;
}

.section-light .btn-outline:hover,
.section-mid .btn-outline:hover,
.about-links .btn-outline:hover,
.home-band-light .btn-outline:hover {
  color: #fff !important;
  background: var(--navy-700) !important;
  border-color: var(--navy-700) !important;
}

.social-join-btn {
  min-height: 2.25rem;
  padding: 0.45rem 1rem !important;
  font-size: 0.72rem !important;
  background: var(--gold) !important;
  border: 2px solid var(--gold) !important;
  border-radius: 6px;
}

.resource-link {
  color: var(--navy-800) !important;
  background: transparent;
  border: 2px solid var(--gold);
  padding: 0.55rem 1.1rem !important;
  min-height: 2.4rem;
  font-size: 0.75rem !important;
  margin-top: 0.75rem;
}
.resource-link:hover {
  background: var(--gold) !important;
  color: var(--navy-900) !important;
  transform: translateY(-2px);
}

.prayer-btn {
  color: var(--navy-900) !important;
  background: var(--gold) !important;
  border-color: var(--gold) !important;
}

.contact-section .btn-primary {
  width: auto;
  display: inline-flex;
}
.contact-form .btn-primary,
.prayer-form .btn-primary {
  width: 100%;
}

/* ── FOOTER LAYOUT ── */
.footer {
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: center;
  justify-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.footer-brand {
  justify-content: center;
}

.footer-socials a svg {
  display: block;
}

.footer-motto .afc-icon {
  vertical-align: middle;
}

/* ── LIVE ADMIN BAR ── */
.live-admin-bar {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 8999;
  background: linear-gradient(90deg, #1a3a6b, #2551a0);
  border-bottom: 2px solid var(--gold);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.live-admin-bar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.live-admin-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.45rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.live-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.live-admin-email {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  flex: 1;
}

.live-admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.live-admin-btn {
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--navy-900);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.live-admin-btn-ghost {
  background: transparent;
  color: #fff;
}

/* ── EDIT BUTTON ON CARDS — placement-aware, no text overlap ── */
.live-editable {
  position: relative;
}

.live-edit-btn {
  position: absolute;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: rgba(10, 22, 40, 0.92);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Inline text — float above the block, never on top of words */
.is-live-admin .live-editable--float-above {
  margin-top: 2.25rem;
}

.live-editable--float-above .live-edit-btn {
  top: auto;
  bottom: calc(100% + 6px);
  right: 0;
}

.is-live-admin .live-editable--float-above[style*="text-align:center"] .live-edit-btn {
  right: 50%;
  transform: translateX(50%);
}

/* Cards, panels, districts — reserved strip at top */
.is-live-admin .live-editable--card-top {
  padding-top: 2.65rem;
}

.live-editable--card-top .live-edit-btn {
  top: 8px;
  right: 8px;
}

.is-live-admin .live-editable--card-top.social-item {
  padding-right: 0.5rem;
}

/* Section headings — edit control above title block */
.is-live-admin .live-editable--section-header {
  padding-top: 2.65rem;
}

.live-editable--section-header .live-edit-btn {
  top: 0;
  right: 0;
}

/* Small cycle chips — centered above */
.is-live-admin .live-editable--chip {
  margin-top: 2.25rem;
}

.live-editable--chip .live-edit-btn {
  top: auto;
  bottom: calc(100% + 6px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  padding: 0.3rem 0.55rem;
}

.live-editable--chip .live-edit-btn-label {
  display: none;
}

/* Contact values — room on the right, button in corner */
.is-live-admin .live-editable--contact-value {
  padding-right: 4.75rem;
  min-height: 1.75rem;
}

.live-editable--contact-value .live-edit-btn {
  top: 0;
  right: 0;
}

/* Gallery / images — corner overlay on media */
.live-editable--media .live-edit-btn {
  top: 8px;
  right: 8px;
}

/* Ticker & full-width bars */
body.is-live-admin .ticker-wrap {
  padding-top: 2.75rem;
}

.live-editable--bar-top .live-edit-btn {
  top: auto;
  bottom: calc(100% + 8px);
  right: 0;
}

/* Timeline — mirror button to the open side of each card */
.is-live-admin .timeline-card.live-editable--card-top {
  padding-top: 2.65rem;
}

.timeline-card.live-editable--card-top:nth-child(odd) .live-edit-btn {
  right: auto;
  left: 8px;
}

.timeline-card.live-editable--card-top:nth-child(even) .live-edit-btn {
  right: 8px;
  left: auto;
}

.live-editable:hover .live-edit-btn,
.is-live-admin .live-edit-btn {
  opacity: 1;
}

.live-edit-btn:hover {
  background: var(--gold);
  color: var(--navy-900);
  transform: scale(1.04);
}

.live-editable--chip .live-edit-btn:hover {
  transform: translateX(-50%) scale(1.04);
}

.is-live-admin .live-editable--float-above[style*="text-align:center"] .live-edit-btn:hover {
  transform: translateX(50%) scale(1.04);
}

.live-edit-btn-label {
  pointer-events: none;
}

body.modal-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
  touch-action: none;
}

/* ── LIVE EDIT MODAL ── */
.live-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 22, 40, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overscroll-behavior: contain;
}

.live-edit-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.live-edit-dialog {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.live-edit-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
}

.live-edit-hint {
  font-size: 0.82rem;
  color: #667;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  padding: 0.65rem 0.85rem;
  background: #f5f8fc;
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
}

.live-edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.live-edit-actions .btn-primary {
  flex: 1;
  min-width: 140px;
  text-align: center;
}

/* Image upload preview in live editor */
.img-upload-preview {
  margin-bottom: 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8edf5;
  background: #f8fafc;
}

.img-upload-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.img-upload-preview-label {
  display: block;
  font-size: 0.72rem;
  color: #8899aa;
  padding: 0.35rem 0.75rem;
  border-top: 1px solid #e8edf5;
}

/* Ticker star icon */
.ticker-track .afc-icon {
  margin: 0 0.35rem;
}

@media (max-width: 768px) {
  body.has-live-admin-bar {
    padding-top: 128px;
  }

  .live-admin-bar {
    top: 72px;
  }

  .live-edit-btn-label {
    display: none;
  }

  .is-live-admin .live-editable--card-top,
  .is-live-admin [data-list-item-id].live-editable {
    padding-top: 2.35rem;
  }

  .list-delete-btn {
    right: 2.75rem;
  }

  .timeline-card.live-editable--card-top:nth-child(odd) .live-edit-btn,
  .timeline-card.live-editable--card-top:nth-child(even) .live-edit-btn {
    right: 8px;
    left: auto;
  }
}

/* JSON / calendar admin block — visible only when live editor is active */
.is-live-admin .cal-admin-json,
.is-live-admin [data-edit-type="json"] {
  display: block !important;
  visibility: visible;
  position: relative;
  max-width: 720px;
  margin: -2rem auto 2rem;
  padding: 0.85rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold, #d4af37);
  background: rgba(212, 175, 55, 0.12);
  border: 1px dashed rgba(212, 175, 55, 0.45);
  border-radius: 10px;
}

/* ── Section list admin toolbars (live editor) ── */
[data-edit-list] {
  position: relative;
}

.list-admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.65rem 1rem;
  background: rgba(10, 22, 40, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
}

.list-admin-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold, #d4af37);
}

.list-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--gold, #d4af37);
  background: transparent;
  color: var(--gold, #d4af37);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.list-add-btn:hover {
  background: var(--gold, #d4af37);
  color: var(--navy-900, #0a1628);
}

/* List cards — edit/delete sit in top strip, not on content */
.is-live-admin [data-list-item-id].live-editable {
  padding-top: 2.65rem;
}

.list-delete-btn {
  position: absolute;
  top: 8px;
  right: 5.25rem;
  left: auto;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #e05252;
  background: rgba(10, 22, 40, 0.92);
  color: #e05252;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.live-editable:hover .list-delete-btn,
.is-live-admin .list-delete-btn {
  opacity: 1;
}

.list-delete-btn:hover {
  background: #e05252;
  color: #fff;
}

.list-empty-hint {
  text-align: center;
  color: #8899aa;
  font-size: 0.9rem;
  padding: 2rem;
  font-style: italic;
}
