:root {
  --bg: #0a0a0f;
  --bg2: #13131a;
  --bg3: #1c1c26;
  --card: #1a1a24;
  --border: #2a2a38;
  --accent: #e8a020;
  --accent2: #c47d10;
  --text: #f0f0f8;
  --muted: #8888aa;
  --green: #3ecf8e;
  --blue: #4fa3e0;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 15px; overflow: hidden; }

/* NAV */
#nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg2); border-top: 1px solid var(--border); z-index: 1000; padding-bottom: var(--safe-bottom); }
#nav button { flex: 1; padding: 10px 4px 8px; background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: color .2s; }
#nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
#nav button.active { color: var(--accent); }

/* VIEWS */
#app { height: 100%; display: flex; flex-direction: column; }
.view { display: none; flex: 1; overflow-y: auto; padding-bottom: calc(60px + var(--safe-bottom)); }
.view.active { display: flex; flex-direction: column; }

/* BUILD BANNER */
#build-banner { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 4px); right: 8px; z-index: 2000; background: rgba(0,0,0,0.5); border-radius: 6px; padding: 3px 8px; font-size: 10px; font-family: monospace; color: var(--muted); pointer-events: none; }

/* HEADER */
.hdr { padding: calc(env(safe-area-inset-top, 0px) + 52px) 16px 12px; background: linear-gradient(180deg, #1a1208 0%, var(--bg) 100%); }
.hdr h1 { font-size: 22px; font-weight: 700; color: var(--accent); }
.hdr p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* SEARCH */
.search-wrap { padding: 0 16px 12px; position: sticky; top: 0; z-index: 10; background: var(--bg); }
.search-wrap input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 10px 38px; color: var(--text); font-size: 15px; outline: none; }
.search-wrap input::placeholder { color: var(--muted); }
.search-icon { position: absolute; left: 27px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-icon svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 2; }

/* FILTER BAR */
.filter-bar { padding: 0 16px 10px; display: flex; gap: 8px; align-items: center; }
.date-strip { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.date-strip::-webkit-scrollbar { display: none; }
.date-chip { flex-shrink: 0; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg3); color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .2s; }
.date-chip.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.filter-icon-btn { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg3); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; transition: all .2s; }
.filter-icon-btn svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.filter-icon-btn.has-filters { border-color: var(--accent); background: var(--accent); }
.filter-icon-btn.has-filters svg { stroke: #000; }
.filter-badge { position: absolute; top: -4px; right: -4px; background: var(--accent); color: #000; font-size: 10px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ACTIVE FILTER PILLS */
.active-filters { padding: 0 16px 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.active-pill { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; background: var(--accent); color: #000; font-size: 12px; font-weight: 600; cursor: pointer; }
.active-pill span { font-size: 14px; line-height: 1; }

/* TIME STRIP — spejler filter-bar/date-strip mønsteret */
.time-strip-outer { display: flex; padding: 0 16px 10px; }
.time-strip { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.time-strip::-webkit-scrollbar { display: none; }
.time-chip { flex-shrink: 0; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg3); color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .2s; }
.time-chip.active { background: #2a1f00; border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* MAP POPUP CONCERTS */
.map-popup-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; border-bottom: 1px solid #333; padding-bottom: 6px; }
.map-popup-concert { padding: 5px 0; border-bottom: 1px solid #222; cursor: pointer; }
.map-popup-concert:last-child { border-bottom: none; }
.map-popup-concert:hover { color: var(--accent); }
.map-popup-time { font-size: 11px; color: #888; margin-bottom: 1px; }
.map-popup-name { font-size: 13px; }

/* FILTER SHEET */
#filter-sheet { position: fixed; inset: 0; z-index: 300; display: none; }
#filter-sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-panel { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg2); border-radius: 20px 20px 0 0; padding: 0 0 calc(20px + var(--safe-bottom)); max-height: 80vh; overflow-y: auto; transform: translateY(100%); transition: transform .3s ease; }
#filter-sheet.open .sheet-panel { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 16px; }
.sheet-title { font-size: 17px; font-weight: 700; padding: 0 20px 16px; border-bottom: 1px solid var(--border); }
.sheet-section { padding: 16px 20px 0; }
.sheet-section h4 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }
.sheet-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet-pill { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg3); color: var(--text); font-size: 14px; cursor: pointer; transition: all .2s; }
.sheet-pill.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }
.sheet-actions { display: flex; gap: 10px; padding: 20px 20px 0; }
.sheet-clear { flex: 1; padding: 13px; border-radius: 12px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 15px; cursor: pointer; }
.sheet-apply { flex: 2; padding: 13px; border-radius: 12px; border: none; background: var(--accent); color: #000; font-size: 15px; font-weight: 700; cursor: pointer; }

/* CONCERT LIST */
#concert-count { padding: 0 16px 8px; font-size: 13px; color: var(--muted); }
.concert-list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.concert-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; transition: transform .1s; active: transform .1s; }
.concert-card:active { transform: scale(0.98); }
.concert-card .thumb { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--bg3); }
.concert-card .body { padding: 12px; }
.concert-card .time-venue { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.concert-card .time-venue .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }
.concert-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.concert-card .artists { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.concert-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; }
.tag-free { background: #0d3320; color: var(--green); }
.tag-outdoor { background: #0d1f33; color: var(--blue); }
.tag-genre { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.fav-btn { float: right; background: none; border: none; cursor: pointer; padding: 0; margin-top: -2px; color: var(--muted); font-size: 20px; }
.fav-btn.on { color: var(--accent); }

/* DETAIL VIEW */
#detail { position: fixed; inset: 0; background: var(--bg); z-index: 200; overflow-y: auto; transform: translateX(100%); transition: transform .3s ease; }
#detail.open { transform: translateX(0); }
.detail-img { width: 100%; height: 220px; object-fit: cover; background: var(--bg3); }
.detail-back { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 16px; background: rgba(0,0,0,0.6); border: none; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: white; z-index: 10; }
.detail-back svg { width: 20px; height: 20px; stroke: white; fill: none; stroke-width: 2.5; }
.detail-body { padding: 16px 16px calc(40px + var(--safe-bottom)); }
.detail-body h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.detail-meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.detail-meta span { display: block; margin-bottom: 2px; }
.detail-desc { font-size: 15px; line-height: 1.65; color: #ccc; margin-bottom: 16px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-actions a, .detail-fav { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; }
.btn-ticket { background: var(--accent); color: #000; }
.btn-fb { background: #1877f2; color: white; }
.detail-fav { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.detail-fav.on { color: var(--accent); border-color: var(--accent); }
.detail-map { height: 180px; border-radius: 12px; margin-top: 16px; overflow: hidden; }

/* MAP VIEW */
#map-view { position: relative; }
#mapbox { height: calc(100vh - 60px - env(safe-area-inset-bottom, 0px)); width: 100%; }
.map-locate { position: absolute; bottom: calc(80px + var(--safe-bottom)); right: 16px; z-index: 50; background: var(--accent); border: none; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.map-locate svg { width: 22px; height: 22px; stroke: #000; fill: none; stroke-width: 2; }
.map-info { position: absolute; bottom: calc(80px + var(--safe-bottom)); left: 16px; right: 72px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; font-size: 13px; color: var(--muted); display: none; z-index: 50; }

/* FAVS */
#favs-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
#favs-empty .big { font-size: 48px; margin-bottom: 12px; }

/* NEARBY */
.nearby-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0 16px 10px; cursor: pointer; }
.nearby-dist { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }

/* AUTH */
.auth-banner { margin: 0 16px 12px; padding: 14px 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-banner p { font-size: 13px; color: var(--muted); margin: 0; flex: 1; }
.auth-btn { flex-shrink: 0; padding: 8px 14px; border-radius: 10px; border: none; background: var(--accent); color: #000; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-user-info { font-size: 12px; color: var(--green); font-weight: 500; }
.auth-signout { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.auth-synced { font-size: 11px; color: var(--green); margin-left: 6px; }

/* AUTH MODAL */
#auth-modal { position: fixed; inset: 0; z-index: 400; display: none; }
#auth-modal.open { display: block; }
.auth-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.7); }
.auth-panel { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg2); border-radius: 20px 20px 0 0; padding: 24px 20px calc(32px + var(--safe-bottom)); }
.auth-panel h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-panel p { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.auth-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; color: var(--text); font-size: 16px; outline: none; margin-bottom: 12px; }
.auth-submit { width: 100%; padding: 14px; border-radius: 12px; border: none; background: var(--accent); color: #000; font-size: 16px; font-weight: 700; cursor: pointer; }
.auth-msg { margin-top: 12px; font-size: 14px; text-align: center; color: var(--green); min-height: 20px; }
.auth-msg.err { color: #e05555; }

/* LEAFLET overrides */
.leaflet-container { background: #1a1a2e; }
.leaflet-popup-content-wrapper { background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
.leaflet-popup-tip { background: var(--bg2); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
