/**
 * Wayflo Tours – Offline Tour Styles
 *
 * Eigenständige UI für Offline-Modus mit Leaflet-Karte.
 * Ersetzt die normale Tour-View komplett wenn aktiv.
 */

/* ============================================================
   ROOT CONTAINER (Vollbild)
============================================================ */
/* WICHTIG: hidden-Attribut MUSS display:flex überschreiben */
.wayflo-offline-tour[hidden] {
  display: none !important;
}
.wayflo-offline-tour {
  --wot-primary: #2a7c6f;
  --wot-accent:  #b8956a;

  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #faf6ef;
  font-family: var(--wayflo-font-body, 'Outfit', system-ui, sans-serif);
  display: flex;
  flex-direction: column;
}
body.wayflo-offline-active {
  overflow: hidden;
}

/* ============================================================
   HEADER
============================================================ */
.wot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e1d8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  z-index: 2;
}
.wot-title {
  margin: 0;
  font-family: var(--wayflo-font-display, 'Instrument Serif', serif);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: #1a1815;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wot-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fbbf24;
  color: #1a1815;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.wot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a1815;
}
.wot-close {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #6b6357;
  cursor: pointer;
  padding: 0 6px;
}
.wot-close:hover { color: #1a1815; }

/* ============================================================
   BODY (Map + Sidebar)
============================================================ */
.wot-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;   /* sonst überschreitet die Map den Container */
}
@media (max-width: 760px) {
  .wot-body {
    grid-template-columns: 1fr;
    grid-template-rows: 55% 45%;
  }
}

.wot-map-wrap {
  position: relative;
  background: #ddd;
}
.wot-map {
  position: absolute;
  inset: 0;
}

/* GPS-Locate-Button */
.wot-locate {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 401;  /* über Leaflet-Controls */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  color: var(--wot-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 200ms ease;
}
.wot-locate:hover {
  transform: scale(1.05);
}
.wot-locate.is-active {
  background: var(--wot-primary);
  color: #ffffff;
}

/* ============================================================
   SIDEBAR
============================================================ */
.wot-sidebar {
  background: #ffffff;
  border-left: 1px solid #e5e1d8;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 760px) {
  .wot-sidebar {
    border-left: none;
    border-top: 1px solid #e5e1d8;
  }
}

.wot-stops {
  list-style: none;
  margin: 0;
  padding: 8px;
}

.wot-stop {
  display: grid;
  grid-template-columns: 36px 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
  margin-bottom: 4px;
}
.wot-stop:hover {
  background: rgba(42, 124, 111, 0.05);
}
.wot-stop:active {
  transform: scale(0.99);
}
.wot-stop.is-active {
  background: rgba(42, 124, 111, 0.08);
  outline: 1.5px solid var(--wot-primary);
  outline-offset: -1.5px;
}

.wot-stop-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wot-primary), #236a5e);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.wot-stop-thumb {
  width: 64px;
  height: 48px;
  background-color: #f0ece2;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
}
.wot-stop-text {
  min-width: 0;
}
.wot-stop-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1815;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wot-stop-meta {
  font-size: 11px;
  color: #6b6357;
  margin-top: 2px;
}

/* ============================================================
   MARKER PINS (in der Karte)
============================================================ */
.wot-pin {
  background: transparent !important;
  border: none !important;
}
.wot-pin-bubble {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  box-shadow:
    0 0 0 3px #ffffff,
    0 2px 8px rgba(0, 0, 0, 0.25);
}
.wot-pin-tail {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 12px solid #ffffff;
}

/* ============================================================
   MODAL
============================================================ */
.wot-modal[hidden] {
  display: none !important;
}
.wot-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: wot-modal-fade 200ms ease;
}
@keyframes wot-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.wot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 24, 21, 0.6);
  backdrop-filter: blur(4px);
}
.wot-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: wot-modal-slide 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes wot-modal-slide {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.wot-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #1a1815;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.wot-modal-body {
  padding: 0 0 24px;
}
.wot-modal-images {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px 14px 0 0;
}
.wot-modal-images img {
  width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  height: 280px;
  object-fit: cover;
  display: block;
}
.wot-modal-title {
  font-family: var(--wayflo-font-display, 'Instrument Serif', serif);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: #1a1815;
  margin: 20px 24px 12px;
  line-height: 1.15;
}
.wot-modal-desc {
  padding: 0 24px;
  color: #3a3530;
  line-height: 1.6;
  font-size: 15px;
}
.wot-modal-desc p { margin: 0 0 12px; }
.wot-modal-desc img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.wot-modal-audio {
  width: calc(100% - 48px);
  margin: 16px 24px 0;
  display: block;
}

body.wot-modal-open .wayflo-offline-tour {
  overflow: hidden;
}

/* ============================================================
   PWA-BAR im Offline-Modus verstecken (Save-Button verwirrt dort)
============================================================ */
body.wayflo-offline-active .wayflo-pwa-bar {
  display: none;
}
