/* ========== Reset & token-uri ========== */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #14101e;
  --bg-elev: #1f1a2e;
  --bg-card: #281f3d;
  --bg-card-hover: #322750;
  --border: #3a2f55;
  --text: #f0ebf8;
  --text-muted: #a89cc4;
  --text-dim: #7a6e96;
  --accent: #ffb347;
  --accent-soft: rgba(255, 179, 71, 0.15);
  --success: #6dc77a;
  --success-soft: rgba(109, 199, 122, 0.18);
  --danger: #e07a7a;

  --z-palat: #d4824f;
  --z-centru: #5fa8d3;
  --z-bolyai: #8aac7d;
  --z-cetate: #b6705a;
  --z-altele: #9b7cb6;

  --radius: 14px;
  --radius-sm: 10px;

  --nav-h: 64px;
  --header-h: 70px;
  --filter-h: 96px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

a { color: var(--accent); }

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ========== Header ========== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: linear-gradient(180deg, #221a36 0%, #1a142a 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header__title h1 {
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.app-header__title p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.app-header__clock {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: right;
  min-width: 84px;
}

.app-header__clock #clockTime {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
}

.app-header__clock-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-header__clock.is-simulated #clockTime { color: #ff9ed5; }

.sim-banner {
  position: sticky;
  top: var(--header-h);
  z-index: 25;
  background: linear-gradient(90deg, rgba(255, 158, 213, 0.18), rgba(255, 179, 71, 0.18));
  border-bottom: 1px solid rgba(255, 158, 213, 0.4);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text);
}

.sim-banner[hidden] { display: none; }

.sim-banner strong { color: #ff9ed5; font-variant-numeric: tabular-nums; }

.sim-banner__close {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ========== Filter bar ========== */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 6px;
}

.filter-bar.is-hidden { display: none; }

.filter-bar__search input {
  width: 100%;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9rem;
  -webkit-appearance: none;
}

.filter-bar__search input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-bar__chips {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin-top: 6px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.filter-bar__chips::-webkit-scrollbar { display: none; }

.filter-bar__chips--kind { margin-top: 6px; }
.filter-bar__chips--kind .chip { font-size: 0.78rem; padding: 5px 11px; }

.filter-bar__toggle {
  display: flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  padding: 2px;
  gap: 2px;
}

.seg {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.seg--active {
  background: var(--accent);
  color: #1a142a;
}

.chip {
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip--active {
  background: var(--accent);
  color: #1a142a;
  border-color: var(--accent);
}

.chip--star {
  padding: 6px 12px;
  font-size: 1rem;
  line-height: 1;
}

.chip--peek {
  background: transparent;
  border-style: dashed;
  color: var(--accent);
  border-color: rgba(255, 179, 71, 0.5);
}

.chip--peek:active {
  background: rgba(255, 179, 71, 0.1);
}

/* ========== Main / Views ========== */
.main { position: relative; }

.view { display: none; }
.view--active { display: block; }

/* ========== Location cards ========== */
#locationList {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.1s, background 0.15s;
}

.loc-card:active { transform: scale(0.99); }

.loc-card__zone-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.loc-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.loc-card__title-wrap {
  flex: 1;
  min-width: 0;
}

.loc-card__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

.loc-card__zone {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

.loc-card__star {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.1rem;
  padding: 0;
}

.loc-card__star.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.loc-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge--open {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(109, 199, 122, 0.4);
}

.badge--closed {
  background: rgba(224, 122, 122, 0.12);
  color: var(--danger);
  border-color: rgba(224, 122, 122, 0.3);
}

.badge--opens-soon {
  background: rgba(255, 179, 71, 0.12);
  color: var(--accent);
  border-color: rgba(255, 179, 71, 0.4);
}

.badge--time { font-variant-numeric: tabular-nums; }

.loc-card__desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

mark {
  background: rgba(255, 179, 71, 0.35);
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
}

.loc-card__preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.loc-card__preview-item {
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
}

/* ========== Hartă ========== */
#view-map { height: calc(100dvh - var(--header-h) - var(--nav-h)); padding: 0; }
#mapContainer { width: 100%; height: 100%; background: #1a142a; }

.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.leaflet-popup-tip { background: var(--bg-card); }
.leaflet-popup-content { margin: 10px 14px; min-width: 180px; }
.leaflet-popup-content strong { display: block; margin-bottom: 4px; font-size: 0.95rem; }
.leaflet-popup-content small { color: var(--text-muted); }
.leaflet-popup-content a {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}

/* ========== Plan ========== */
.plan-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.plan-header h2 { font-size: 1.1rem; }
.plan-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

#planContent { padding: 12px; }

.plan-section { margin-bottom: 24px; }
.plan-section__title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin: 0 0 10px;
  padding: 0 4px;
}

.timeline {
  position: relative;
  padding-left: 18px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline__item {
  position: relative;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline__time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
}

.timeline__title {
  font-size: 0.95rem;
  margin: 2px 0;
}

.timeline__loc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.timeline__item.is-past { opacity: 0.45; }

/* ========== Detail modal ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
}

.modal__panel {
  position: relative;
  background: var(--bg-elev);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  animation: slideUp 0.22s ease;
}

.modal__panel--full {
  border-radius: 0;
  height: 100dvh;
  max-height: 100dvh;
  padding-top: calc(var(--safe-top) + 16px);
}

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

.modal__close {
  position: absolute;
  top: calc(var(--safe-top) + 8px);
  right: 8px;
  background: var(--bg-card);
  color: var(--text);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text);
}

.btn--primary {
  background: var(--accent);
  color: #1a142a;
  border-color: var(--accent);
}

.btn--ghost { background: transparent; }

#simulatedTime {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 1rem;
  width: 100%;
  margin-top: 10px;
  color-scheme: dark;
}

.modal__hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 8px;
  font-style: italic;
}

/* ========== Detail content ========== */
.detail {
  padding-right: 36px;
}

.detail__title { font-size: 1.3rem; line-height: 1.2; }

.detail__zone {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin: 4px 0 12px;
}

.detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.detail__address {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  margin: 12px 0;
  transition: background 0.15s, border-color 0.15s;
}

.detail__address:active {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.detail__address-cta {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.detail__actions {
  display: flex;
  gap: 8px;
  margin: 14px 0 20px;
}

.detail__desc {
  margin: 0 0 18px;
  line-height: 1.55;
}

.detail__section {
  margin-bottom: 22px;
}

.detail__section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.detail__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

.detail__list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail__list-item__time {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.85rem;
  margin-right: 8px;
}

.detail__list-item__title {
  font-size: 0.92rem;
  font-weight: 500;
}

.detail__list-item__desc {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.detail__list-item__type {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border);
  margin-left: 8px;
  vertical-align: middle;
}

.detail__list-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 179, 71, 0.12);
  border: 1px solid rgba(255, 179, 71, 0.3);
  color: var(--accent);
  font-size: 0.78rem;
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
}

.detail__list-item {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.detail__list-item__body {
  flex: 1;
  min-width: 0;
}

.tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.tag--lang-ro { background: rgba(74, 144, 226, 0.18); color: #7ab8f5; }
.tag--lang-hu { background: rgba(220, 100, 100, 0.18); color: #e09a9a; }
.tag--kid     { background: rgba(255, 200, 100, 0.18); color: #ffc864; }
.tag--register { background: rgba(255, 179, 71, 0.2); color: var(--accent); }

.register-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.register-link::after { content: " →"; }

/* Timeline view în Listă */
.timeline-view {
  padding: 12px;
}

.timeline-view__hour {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 8px 4px 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
}

.timeline-view__hour:first-child { margin-top: 0; }

.timeline-act {
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
}

.timeline-act__zone-strip {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.timeline-act__body {
  flex: 1;
  min-width: 0;
}

.timeline-act__time {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.timeline-act__title {
  font-size: 0.9rem;
  margin: 2px 0;
}

.timeline-act__loc {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.timeline-act.is-past { opacity: 0.4; }
.timeline-act.is-now {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.detail__tips {
  background: rgba(255, 179, 71, 0.08);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 18px;
}

.detail__tips strong { color: var(--accent); }

.detail__history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.detail__contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  transition: background 0.15s, border-color 0.15s;
}

.contact-row:active {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.contact-row__icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

/* ========== Info page ========== */
.info-page {
  padding: 20px 18px;
  max-width: 560px;
  margin: 0 auto;
}

.info-page h2 { font-size: 1.2rem; margin-bottom: 12px; }
.info-page h3 { font-size: 0.95rem; margin: 18px 0 8px; color: var(--accent); }
.info-page ul { padding-left: 18px; color: var(--text-muted); }
.info-page li { margin-bottom: 6px; }
.info-page p { color: var(--text-muted); }
.info-page__footer { font-size: 0.8rem; color: var(--text-dim); margin-top: 24px; font-style: italic; }

/* ========== Bottom nav ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  height: calc(var(--nav-h) + var(--safe-bottom));
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  transition: color 0.15s;
}

.nav-btn--active { color: var(--accent); }

.nav-btn__icon {
  font-size: 1.3rem;
  line-height: 1;
}

.nav-btn__label {
  font-size: 0.7rem;
  font-weight: 500;
}

.nav-btn__badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: var(--accent);
  color: #1a142a;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ========== Tablet+ ========== */
@media (min-width: 720px) {
  #locationList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
  }
}
