:root {
  --ink: #0f1b2d;
  --paper: #f4f6fa;
  --white: #fff;
  --line: #dfe4ee;
  --muted: #5b6678;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--paper);
  display: flex; flex-direction: column; height: 100dvh;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

header {
  position: relative; z-index: 1500; gap: 10px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
header h1 { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.brand { line-height: 0; flex: none; }
.brand a { display: inline-block; background: #fff; border-radius: 10px; padding: 3px 8px; }
.brand img { display: block; height: 44px; width: auto; max-width: 100%; }
@media (max-width: 380px) { .brand img { height: 38px; } }
/* ===== Area search (header + events list) ===== */
.areasearch { flex: 1 1 auto; min-width: 0; max-width: 460px; margin: 0 auto; display: flex; gap: 6px; }
.as-field { position: relative; flex: 1; min-width: 0; }
.as-field input {
  width: 100%; height: 44px; padding: 0 34px 0 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 600;   /* 16px = no zoom on iPhone */
}
.as-field input:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
header .as-field input { border-color: #ffffff55; background: #ffffff1a; color: #fff; }
header .as-field input::placeholder { color: #ffffffb3; font-weight: 600; }
header .as-field input:focus-visible { outline-color: #fdb913; }
.as-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1rem;
}
header .as-clear { color: #fff; }
.as-clear.hidden { display: none; }
.as-go {
  flex: none; height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
  background: #fdb913; color: var(--ink); font-weight: 800; font-size: .95rem;
}
.as-go:hover { background: #ffc83a; }
/* mobile: a bit smaller search so the burger has room to breathe */
@media (max-width: 480px) {
  header { gap: 8px; }
  .areasearch { max-width: 170px; }
  header .as-field input { height: 38px; padding: 0 28px 0 10px; border-radius: 10px; }
  header .as-clear { width: 28px; height: 28px; right: 3px; }
}

.as-suggest {
  position: fixed; z-index: 2500; margin: 0; padding: 6px; list-style: none;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px #0f1b2d55; max-height: min(50vh, 340px); overflow-y: auto;
}
.as-suggest.hidden { display: none; }
.as-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%;
  padding: 11px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 1rem;
}
.as-item small { color: var(--muted); font-size: .8rem; }
.as-item:hover, .as-item.hi { background: var(--paper); }

.leaflet-tooltip.area-tip {
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 4px 10px;
  font-weight: 800; font-size: .8rem; box-shadow: 0 2px 8px #0f1b2d55;
}
.leaflet-tooltip.area-tip::before { display: none; }
.pin.out { opacity: .38; }   /* events outside the searched area */

.list-search { display: flex; gap: 6px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.list-filter { margin: 12px 4px 0; font-weight: 800; font-size: .9rem; }

.burger {
  width: 44px; height: 44px; padding: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  background: none; border: 1px solid #ffffff55; border-radius: 12px;
}
.burger span { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: #fff; }
.burger:hover { background: #ffffff22; }
.burger:focus-visible { outline-color: #fff; }
.lang { display: flex; border: 1px solid #ffffff55; border-radius: 999px; overflow: hidden; }
.lang button { background: none; border: 0; color: #fff; padding: 6px 12px; font-weight: 600; font-size: .85rem; }
.lang button.active { background: #fff; color: var(--ink); }

#controls { background: var(--white); border-bottom: 1px solid var(--line); padding: 8px 12px; display: grid; gap: 8px; }
.row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
#timeTabs { background: var(--paper); padding: 3px; border-radius: 999px; }
#timeTabs button {
  flex: 1; white-space: nowrap; border: 0; background: none; border-radius: 999px;
  padding: 8px 12px; font-weight: 600; font-size: .9rem;
}
#timeTabs button.active { background: var(--ink); color: #fff; }
.chip {
  white-space: nowrap; background: var(--white); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85rem;
}
.chip.active { border-color: var(--ink); background: var(--ink); color: #fff; }

#stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; }

#topleft, #legend, #count, #locate, #card, #toast, #modal, #installModal { z-index: 1100; }
#topleft { position: absolute; left: 10px; top: 10px; display: grid; gap: 8px; justify-items: start; }
#legend {
  display: grid; gap: 4px;
  background: #ffffffee; padding: 8px 10px; border-radius: 10px; font-size: .72rem;
  box-shadow: 0 2px 10px #0f1b2d22;
}
#installBtn.hidden { display: none; }
#legend span { display: flex; align-items: center; gap: 6px; }
#legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#count {
  position: absolute; right: 10px; top: 10px; background: var(--ink); color: #fff;
  padding: 4px 9px; border-radius: 999px; font-weight: 700; font-size: .68rem; line-height: 1.2;
  max-width: calc(100% - 140px);   /* να μην πέφτει πάνω στο legend αριστερά */
  text-align: center;
}
#locate {
  position: absolute; right: 10px; top: 52px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #fff; font-size: 1.6rem; box-shadow: 0 2px 10px #0f1b2d33;
}
#count.big { font-size: .85rem; padding: 6px 12px; }

/* Pins */
.pin-wrap { background: none; border: 0; }
.pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  display: grid; place-items: center; border: 2.5px solid #fff; box-shadow: 0 3px 8px #0006;
}
.pin span { transform: rotate(45deg); font-size: 15px; line-height: 1; }
.pin.sel { outline: 3px solid var(--ink); }

/* Promoted (paid) event: bigger pin, animated flame, pulsing glow */
.pin.promo { width: 42px; height: 42px; border-color: #fdb913; animation: promoGlow 1.6s ease-in-out infinite; }
.pin.promo span { font-size: 21px; line-height: 1; display: block; transform-origin: 50% 50%; animation: flame 1.1s ease-in-out infinite; }
@keyframes flame {   /* scale only, around the center, so the flame stays in the middle of the pin */
  0%, 100% { transform: rotate(45deg) scale(1); }
  25%      { transform: rotate(45deg) scale(1.12, 1.04); }
  50%      { transform: rotate(45deg) scale(.94, 1.14); }
  75%      { transform: rotate(45deg) scale(1.08, .98); }
}
@keyframes promoGlow {
  0%, 100% { box-shadow: 0 3px 8px #0006, 0 0 0 0 #f9731688; }
  50%      { box-shadow: 0 3px 8px #0006, 0 0 14px 7px #f9731655; }
}
.offer-box { padding: 10px 12px; border-radius: 12px; background: #fff8e1; border: 1.5px solid #fdb913; line-height: 1.4; }
.badge.promo { background: #fff1e0; color: #c2410c; }
@media (prefers-reduced-motion: reduce) { .pin.promo, .pin.promo span { animation: none; } .pin.promo span { transform: rotate(45deg); } }
.me { background: #2563eb; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 6px #2563eb33; }

/* Event card: bottom sheet on mobile, side panel on desktop */
#card {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 72%; overflow-y: auto;
  background: var(--white); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 30px #0f1b2d40;
  animation: rise .22s ease-out;
}
#card.hidden { display: none; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.cover { width: 100%; height: auto; max-height: 200px; object-fit: contain; background: var(--paper); display: block; border-radius: 20px 20px 0 0; }
.cover.ph { height: 170px; display: grid; place-items: center; font-size: 3rem; background: var(--paper); }
.card-body { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.card-body h2 { margin: 0; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.01em; }
.when { font-weight: 700; }
.until { color: var(--muted); font-size: .9rem; }
.card-body p { margin: 0; line-height: 1.5; color: #2a3547; }
.badge {
  display: inline-block; vertical-align: top; max-width: 100%;
  padding: 5px 12px; border-radius: 14px; background: var(--paper);
  font-weight: 700; font-size: .85rem; line-height: 1.4;
  white-space: pre-line;          /* σέβεται τις αλλαγές γραμμής της τιμής */
  overflow-wrap: anywhere;        /* μεγάλο κείμενο σπάει μέσα στο πλαίσιο, δεν βγαίνει έξω */
  text-align: left;
}
.badge.free { background: #dcfce7; color: #166534; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--ink);
  background: #fff; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.close-x {
  position: sticky; top: 10px; z-index: 5; float: right; margin: 10px 10px 0 0; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: #ffffffdd; font-size: 1.1rem; box-shadow: 0 1px 6px #0004;
}

@media (min-width: 800px) {
  #card { left: auto; right: 14px; top: 56px; bottom: 14px; width: 380px; max-height: none; border-radius: 18px; }
  .cover { border-radius: 18px 18px 0 0; }
  #stage.has-card #locate, #stage.has-card #count { right: 404px; }
}

#toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

#modal { position: fixed; inset: 0; background: #0f1b2d99; display: grid; place-items: center; padding: 16px; }
#modal.hidden { display: none; }
#installModal { position: fixed; inset: 0; background: #0f1b2d99; display: grid; place-items: center; padding: 16px; }
#installModal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 18px; padding: 20px; max-width: 380px; width: 100%; display: grid; gap: 10px; }
.modal-box h2 { margin: 0; }
.modal-box p { margin: 0; color: var(--muted); line-height: 1.5; }
.leaflet-control-attribution {
  font-size: 8px;
  opacity: .7;
  background: #ffffff99;
}

#welcome {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1200;
  max-width: 80%; text-align: center; background: var(--ink); color: #fff;
  padding: 14px 20px; border-radius: 16px; font-weight: 700; font-size: 1.05rem;
  box-shadow: 0 6px 24px #0f1b2d55; pointer-events: none; transition: opacity .5s;
}
#welcome.hide { opacity: 0; }

@media (prefers-reduced-motion: reduce) { #card { animation: none; } }

/* ===== Side menu (burger) + events list ===== */
#scrim {
  position: fixed; inset: 0; z-index: 1900; background: #0f1b2d99;
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s;
}
#scrim.show { opacity: 1; visibility: visible; transition: opacity .25s; }
#drawer, #listPanel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 2000;
  width: min(340px, 86vw); background: #fff; color: var(--ink);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 30px #0f1b2d55;
  transform: translateX(100%); visibility: hidden;
  transition: transform .25s ease, visibility 0s .25s;
  padding-bottom: env(safe-area-inset-bottom);
}
#listPanel { width: min(420px, 100vw); }
#drawer.open, #listPanel.open { transform: none; visibility: visible; transition: transform .25s ease; }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--ink); color: #fff;
}
.drawer-head b { font-size: 1.05rem; }
.drawer-x {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #ffffff55;
  background: none; color: #fff; font-size: 1.1rem;
}
.drawer-x:hover { background: #ffffff22; }
.drawer-x:focus-visible { outline-color: #fff; }
.drawer-nav { display: grid; gap: 2px; padding: 8px; }
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 12px;
  border: 0; border-radius: 12px; background: none; color: var(--ink);
  font-weight: 700; font-size: 1rem; text-align: left; text-decoration: none;
}
.mi:hover { background: var(--paper); }
.mi-ico { width: 26px; text-align: center; font-size: 1.2rem; }
.drawer-lang {
  margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; font-weight: 700;
}
#drawer .lang { border-color: var(--line); }
#drawer .lang button { color: var(--ink); }
#drawer .lang button.active { background: var(--ink); color: #fff; }

#listBody { flex: 1; overflow-y: auto; padding: 4px 12px 24px; overscroll-behavior: contain; }
.list-day { margin: 18px 4px 6px; font-size: .85rem; font-weight: 800; color: var(--muted); }
.list-item {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px;
  margin-bottom: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left;
}
.list-item:hover { background: var(--paper); }
.li-img { width: 76px; height: 76px; flex: none; object-fit: cover; border-radius: 10px; background: var(--paper); }
.li-img.ph { display: grid; place-items: center; font-size: 1.8rem; }
.list-item { align-items: center; }
.li-time { font-weight: 800; min-width: 3.2em; }
.li-main { display: grid; gap: 2px; min-width: 0; }
.li-main b { line-height: 1.25; }
.li-main small { color: var(--muted); }
.list-empty { padding: 20px 8px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  #scrim, #drawer, #listPanel { transition: none !important; }
}
