/* ═══════════════════════════════════════════════════════════════
   EventMap – Festival-Style Mobile-First CSS
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0D0D1A;
  --surface:     #14142B;
  --surface-2:   #1E1E3A;
  --surface-3:   #272748;
  --border:      rgba(255,255,255,0.08);
  --border-acc:  rgba(255,77,109,0.4);
  --pink:        #FF4D6D;
  --pink-dim:    rgba(255,77,109,0.15);
  --cyan:        #00D4FF;
  --cyan-dim:    rgba(0,212,255,0.12);
  --yellow:      #FFD166;
  --green:       #06D6A0;
  --text:        #F0EEFF;
  --text-2:      #9B9BBD;
  --text-3:      #5A5A7A;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-pill: 100px;
  --shadow:      0 8px 32px rgba(0,0,0,0.6);
  --shadow-pink: 0 0 24px rgba(255,77,109,0.3);
  --font-head:   'Bebas Neue', 'Impact', sans-serif;
  --font-body:   'Nunito', 'Segoe UI', sans-serif;
  --header-h:    56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  width: 100%; height: 100%;
}

body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

/* ── Dekorative Elemente ──────────────────────────────────────── */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}
.glow-orb { position: fixed; border-radius: 50%; pointer-events: none; filter: blur(80px); z-index: 0; }
.glow-1 { width:340px;height:340px;background:radial-gradient(circle,rgba(255,77,109,0.2) 0%,transparent 70%);top:-80px;right:-80px; }
.glow-2 { width:260px;height:260px;background:radial-gradient(circle,rgba(0,212,255,0.15) 0%,transparent 70%);bottom:-60px;left:-60px; }

/* ── Screens ──────────────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 10;
}
.screen.active { display: flex; }

/* ── Passwort-Screen ──────────────────────────────────────────── */
#screen-password {
  background: linear-gradient(160deg,#0D0D1A 0%,#0F0F26 50%,#140D1A 100%);
}
.pw-wrap {
  position: relative; z-index: 1;
  text-align: center; padding: 2rem 1.5rem;
  width: 100%; max-width: 380px;
  animation: fadeSlideUp 0.5s ease both;
}
.pw-logo  { font-size:4.5rem;margin-bottom:.5rem;filter:drop-shadow(0 0 20px rgba(255,77,109,0.5)); }
.pw-title { font-family:var(--font-head);font-size:3.5rem;letter-spacing:.08em;color:var(--text);text-shadow:0 0 40px rgba(255,77,109,0.4);line-height:1; }
.pw-sub   { color:var(--text-2);font-size:.9rem;margin:.5rem 0 2rem;letter-spacing:.05em; }

/* ── Felder & Buttons ─────────────────────────────────────────── */
.pw-form  { display:flex;flex-direction:column;gap:.75rem; }
.field {
  width:100%;padding:.9rem 1.1rem;
  background:var(--surface-2);
  border:1.5px solid var(--border);
  border-radius:var(--radius);
  color:var(--text);font-size:1rem;outline:none;
  transition:border-color .2s,box-shadow .2s;
}
.field:focus { border-color:var(--pink);box-shadow:0 0 0 3px rgba(255,77,109,0.15); }
.field::placeholder { color:var(--text-3); }

.btn-primary {
  width:100%;padding:.9rem 1.5rem;
  background:var(--pink);color:#fff;border:none;
  border-radius:var(--radius);
  font-size:1rem;font-weight:700;letter-spacing:.05em;
  box-shadow:var(--shadow-pink);
  transition:transform .15s,box-shadow .15s,background .15s;
}
.btn-primary:active { transform:scale(0.97);box-shadow:none;background:#e03358; }

.err-msg  { color:#ff8fa0;font-size:.85rem;min-height:1.4rem;margin-top:.5rem; }
.link-btn {
  background:none;border:none;color:var(--text-3);
  font-size:.85rem;text-decoration:underline;
  margin-top:1rem;padding:.5rem;transition:color .2s;
}
.link-btn:hover { color:var(--text-2); }

/* ── Modus- & Name-Screen ─────────────────────────────────────── */
#screen-mode,#screen-name {
  background: linear-gradient(160deg,#0D0D1A 0%,#0F0F26 50%,#140D1A 100%);
}
.flow-wrap {
  position:relative;z-index:1;
  width:100%;max-width:400px;padding:2rem 1.5rem;
  animation:fadeSlideUp .4s ease both;
}
.flow-title { font-family:var(--font-head);font-size:2rem;letter-spacing:.05em;color:var(--text);margin-bottom:.5rem;text-align:center; }
.flow-sub   { color:var(--text-2);font-size:.9rem;text-align:center;margin-bottom:1.5rem; }

.mode-cards { display:flex;flex-direction:column;gap:.75rem;margin-top:1.5rem; }
.mode-card {
  display:flex;align-items:center;gap:1rem;
  padding:1.1rem 1.2rem;
  background:var(--surface-2);
  border:1.5px solid var(--border);
  border-radius:var(--radius-lg);
  text-align:left;color:var(--text);
  transition:all .2s;width:100%;
}
.mode-card:active { transform:scale(0.98);border-color:var(--border-acc); }
.mode-card--accent { border-color:rgba(255,77,109,0.3);background:var(--pink-dim); }
.mode-icon  { font-size:2rem;flex-shrink:0; }
.mode-text  { flex:1; }
.mode-text strong { display:block;font-size:1.05rem;font-weight:800; }
.mode-text span   { font-size:.82rem;color:var(--text-2); }
.mode-arrow { font-size:1.5rem;color:var(--text-3);flex-shrink:0; }

/* ── App-Shell ────────────────────────────────────────────────── */
#screen-app {
  background: var(--bg);
  /* Überschreibe .screen – App braucht column-Layout */
  align-items: stretch;
  justify-content: flex-start;
}

/* ── Header ───────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.75rem 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 500;
}
.app-header-title {
  font-family: var(--font-head);
  font-size: 1.5rem; letter-spacing: .08em;
  color: var(--pink);
  text-shadow: 0 0 16px rgba(255,77,109,0.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tab-nav  { display:flex;gap:.4rem;flex-shrink:0; }
.tab {
  padding:.45rem .8rem;
  background:transparent;
  border:1.5px solid var(--border);
  border-radius:var(--radius-pill);
  color:var(--text-2);font-size:.82rem;font-weight:700;
  transition:all .2s;
}
.tab.active    { background:var(--pink-dim);border-color:var(--pink);color:var(--pink); }
.tab-logout    { padding:.45rem .65rem;font-size:.9rem; }
.tab-logout:hover { border-color:var(--pink);color:var(--pink); }

/* ── Views ────────────────────────────────────────────────────── */
.view {
  display: none;
  flex: 1;
  min-height: 0;          /* wichtig für Flexbox-Kinder mit overflow */
  overflow: hidden;
  position: relative;
  flex-direction: column;
}
.view.active { display: flex; }

/* ── Karte ────────────────────────────────────────────────────── */
#map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Leaflet-Überschreibungen */
.leaflet-control-attribution {
  font-size:.6rem!important;
  background:rgba(13,13,26,.8)!important;
  color:var(--text-3)!important;
  backdrop-filter:blur(4px);
}
.leaflet-control-attribution a { color:var(--text-2)!important; }
.leaflet-control-zoom a {
  background:var(--surface-2)!important;
  color:var(--text)!important;
  border-color:var(--border)!important;
}
.leaflet-control-zoom a:hover { background:var(--surface-3)!important; }

/* ── Beacon-Bar ───────────────────────────────────────────────── */
.beacon-bar {
  position:absolute;top:.6rem;left:50%;transform:translateX(-50%);
  background:var(--surface-2);
  border:1px solid var(--border);
  border-radius:var(--radius-pill);
  padding:.35rem 1rem;
  font-size:.8rem;color:var(--text-2);
  display:flex;align-items:center;gap:.5rem;
  white-space:nowrap;z-index:400;
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
}
.beacon-bar.scanning { border-color:rgba(0,212,255,.4);color:var(--cyan); }
.beacon-bar.located  { border-color:rgba(6,214,160,.4); color:var(--green); }
.beacon-bar.error    { border-color:rgba(255,77,109,.4); color:var(--pink); }

.bt-start-btn {
  background:var(--cyan);color:#000;
  border:none;border-radius:var(--radius-pill);
  padding:.2rem .75rem;font-size:.75rem;font-weight:800;
  margin-left:.25rem;
}

/* ── Position-Pille ───────────────────────────────────────────── */
.pos-pill {
  position:absolute;bottom:.75rem;left:50%;transform:translateX(-50%);
  background:rgba(6,214,160,.12);
  border:1px solid rgba(6,214,160,.4);
  border-radius:var(--radius-pill);
  padding:.35rem 1rem;
  font-size:.8rem;color:var(--green);
  white-space:nowrap;z-index:400;
  backdrop-filter:blur(8px);
}

/* ── Listen-View ──────────────────────────────────────────────── */
.list-header {
  background:var(--surface);
  border-bottom:1px solid var(--border);
  padding:.6rem .75rem;
  flex-shrink:0;
}
.search-field {
  width:100%;padding:.7rem 1rem;
  background:var(--surface-2);
  border:1.5px solid var(--border);
  border-radius:var(--radius-pill);
  color:var(--text);font-size:.95rem;outline:none;
  transition:border-color .2s;
}
.search-field:focus { border-color:var(--pink); }
.search-field::placeholder { color:var(--text-3); }

.cat-filters {
  display:flex;gap:.4rem;margin-top:.5rem;
  overflow-x:auto;padding-bottom:2px;scrollbar-width:none;
}
.cat-filters::-webkit-scrollbar { display:none; }
.cat-chip {
  flex-shrink:0;padding:.25rem .7rem;
  border-radius:var(--radius-pill);
  border:1px solid var(--border);
  background:transparent;
  color:var(--text-2);font-size:.75rem;font-weight:700;
  transition:all .15s;
}
.cat-chip.active { color:var(--text);border-color:currentColor; }

.poi-list {
  flex:1;min-height:0;overflow-y:auto;
  padding:.6rem .75rem;
}
.poi-list::-webkit-scrollbar { width:3px; }
.poi-list::-webkit-scrollbar-thumb { background:var(--surface-3);border-radius:2px; }

.poi-item {
  display:flex;align-items:center;gap:.9rem;
  padding:.8rem .9rem;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  margin-bottom:.5rem;cursor:pointer;
  transition:all .2s;
  position:relative;overflow:hidden;
}
.poi-item::before {
  content:'';position:absolute;left:0;top:0;bottom:0;
  width:3px;background:var(--item-color,var(--pink));border-radius:2px 0 0 2px;
}
.poi-item:active { border-color:var(--border-acc);background:var(--surface-2);transform:scale(0.99); }

.poi-icon-box {
  width:46px;height:46px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
  background:var(--item-bg,var(--pink-dim));
  overflow:hidden;
}
.poi-icon-box img  { width:28px;height:28px;object-fit:contain; }
.poi-icon-box .poi-emoji { font-size:1.6rem;line-height:1; }
.poi-info   { flex:1;min-width:0; }
.poi-name   { font-weight:800;font-size:.95rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.poi-cat    { font-size:.78rem;color:var(--text-2);margin-top:.15rem; }
.poi-chevron { color:var(--text-3);font-size:1.2rem;flex-shrink:0; }

/* ── Bottom Sheet ─────────────────────────────────────────────── */
.sheet {
  position:fixed;inset:0;z-index:1000;
  background:rgba(0,0,0,0.6);
  display:flex;align-items:flex-end;
  backdrop-filter:blur(4px);
}
.sheet.hidden { display:none!important; }

.sheet-panel {
  background:var(--surface);
  border-radius:24px 24px 0 0;
  width:100%;max-height:75vh;overflow-y:auto;
  padding:1rem 1.25rem 1.5rem;
  position:relative;
  animation:slideUp .32s cubic-bezier(.34,1.56,.64,1) both;
}
.sheet-panel::-webkit-scrollbar { width:3px; }
.sheet-panel::-webkit-scrollbar-thumb { background:var(--surface-3); }

.sheet-drag-handle {
  width:40px;height:4px;background:var(--surface-3);
  border-radius:2px;margin:0 auto 1rem;
}
.sheet-close {
  position:absolute;top:1rem;right:1rem;
  width:30px;height:30px;
  background:var(--surface-3);border:none;
  border-radius:50%;color:var(--text-2);font-size:.85rem;
}

#sheet-body h3 {
  font-family:var(--font-head);font-size:1.8rem;letter-spacing:.05em;
  color:var(--text);margin-bottom:.3rem;padding-right:2.5rem;
}
#sheet-body .sheet-cat-badge {
  display:inline-block;padding:.2rem .6rem;
  border-radius:var(--radius-pill);
  font-size:.75rem;font-weight:800;margin-bottom:1rem;letter-spacing:.05em;
}
#sheet-body p        { color:var(--text-2);line-height:1.7;font-size:.92rem;margin-bottom:.75rem; }
#sheet-body h4       { color:var(--text);font-size:.9rem;font-weight:800;margin:.75rem 0 .35rem; }
#sheet-body ul       { padding-left:1.2rem;color:var(--text-2);font-size:.9rem;line-height:1.8; }
#sheet-body strong   { color:var(--text); }
#sheet-body .poi-image { width:100%;border-radius:var(--radius);margin-bottom:1rem;aspect-ratio:16/7;object-fit:cover; }

.btn-go { display:block;width:100%;margin-top:1rem; }

/* ── Custom Marker ────────────────────────────────────────────── */
.cm-pin {
  display:flex;align-items:center;justify-content:center;
  border-radius:50% 50% 50% 0;
  transform:rotate(-45deg);
  border:3px solid rgba(255,255,255,0.9);
  box-shadow:0 3px 12px rgba(0,0,0,0.5),0 0 0 2px rgba(0,0,0,0.2);
}
.cm-pin-inner {
  transform:rotate(45deg);
  display:flex;align-items:center;justify-content:center;
  width:100%;height:100%;
}
.cm-pin img { object-fit:contain;border-radius:2px; }

.cm-user-label {
  background:var(--surface-2);
  border:2px solid var(--cyan);
  border-radius:var(--radius-pill);
  padding:.2rem .6rem;
  font-size:.72rem;font-weight:800;
  color:var(--cyan);white-space:nowrap;
  box-shadow:0 2px 8px rgba(0,0,0,0.5),0 0 8px rgba(0,212,255,0.2);
}
.cm-my-pos {
  width:18px;height:18px;
  background:var(--pink);
  border-radius:50%;border:3px solid #fff;
  box-shadow:0 0 0 4px rgba(255,77,109,0.3);
  animation:myPing 2s ease-in-out infinite;
}

/* ── Animationen ──────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity:0;transform:translateY(20px); }
  to   { opacity:1;transform:translateY(0); }
}
@keyframes slideUp {
  from { transform:translateY(100%); }
  to   { transform:translateY(0); }
}
@keyframes myPing {
  0%,100% { box-shadow:0 0 0 4px rgba(255,77,109,0.35); }
  50%     { box-shadow:0 0 0 10px rgba(255,77,109,0.08); }
}
@keyframes shake {
  0%,100% { transform:translateX(0); }
  20%,60% { transform:translateX(-6px); }
  40%,80% { transform:translateX(6px); }
}
.shake { animation:shake .4s ease; }

.hidden { display:none!important; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-header  { padding-top:env(safe-area-inset-top); }
  .sheet-panel { padding-bottom:calc(1.5rem + env(safe-area-inset-bottom)); }
}
