:root {
  --bg: #08111f;
  --panel: rgba(12, 22, 38, 0.9);
  --panel-alt: rgba(19, 31, 50, 0.95);
  --line: rgba(255, 255, 255, 0.08);
  --text: #edf3ff;
  --muted: #9bb0d1;
  --primary: #7c9cff;
  --primary-strong: #9c7bff;
  --event: #ff7a59;
  --activity: #39d0b8;
  --food: #ffd166;
  --shadow: 0 24px 40px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at top left, rgba(124, 156, 255, 0.25), transparent 30%), linear-gradient(135deg, #050b14, #111c2d 40%, #0b1422);
  color: var(--text);
}
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: rgba(7, 15, 24, 0.94);
  border-left: 1px solid var(--line);
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: -18px 0 28px rgba(0,0,0,0.18);
  position: relative;
  z-index: 2;
  order: -1;
}
.brand-block { display: flex; align-items: center; gap: 14px; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong)); box-shadow: var(--shadow); font-weight: 800;
}
.brand-block h1, .topbar h2, .list-header h2 { margin: 0; }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; color: var(--muted); }
.search-panel { background: var(--panel-alt); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.search-panel label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 0.82rem; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, select, textarea {
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  color: var(--text); padding: 10px 12px; width: 100%;
}
button { border: none; border-radius: 12px; cursor: pointer; transition: transform 0.2s ease, opacity 0.2s ease; }
button:hover { transform: translateY(-1px); }
.secondary, .ghost { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--line); }
.secondary { padding: 10px 12px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-btn {
  background: rgba(255, 255, 255, 0.04); color: var(--muted); padding: 10px 14px; border: 1px solid var(--line);
}
.filter-btn.active {
  background: linear-gradient(135deg, rgba(124, 156, 255, 0.3), rgba(156, 123, 255, 0.25));
  color: var(--text); border-color: rgba(124, 156, 255, 0.45);
}
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat-card { background: var(--panel-alt); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 0.74rem; }
.stat-card strong { font-size: 1.4rem; }
.list-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list-header h2 { font-size: 1.12rem; }
.ghost { padding: 8px 10px; }
.results-list { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-right: 6px; max-height: 56vh; }
.empty-state { color: var(--muted); font-size: 0.88rem; line-height: 1.5; padding: 12px 2px; }
.result-card {
  background: rgba(18, 31, 48, 0.96); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 12px; backdrop-filter: blur(8px);
  cursor: pointer;
}
.result-card.active { border-color: rgba(124, 156, 255, 0.7); box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.28); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.tag-event { background: rgba(255, 122, 89, 0.15); color: #ffb7a8; }
.tag-activity { background: rgba(57, 208, 184, 0.15); color: #9ef5e8; }
.tag-food { background: rgba(255, 209, 102, 0.15); color: #ffe6a0; }
.distance-badge { color: var(--muted); font-size: 0.82rem; }
.result-card h3 { margin: 0; font-size: 1.06rem; }
.meta-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 0.8rem; }
.result-card p { margin: 0; color: #dfeafc; font-size: 0.9rem; line-height: 1.5; }
.map-panel { display: flex; flex-direction: column; padding: 22px 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(57, 208, 184, 0.15); color: #abf3e6; border: 1px solid rgba(57, 208, 184, 0.35); border-radius: 999px; padding: 8px 12px; font-size: 0.8rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #39d0b8; box-shadow: 0 0 0 0 rgba(57, 208, 184, 0.8); animation: pulse-dot 1.8s infinite; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgba(57, 208, 184, 0.8); } 70% { box-shadow: 0 0 0 10px rgba(57, 208, 184, 0); } 100% { box-shadow: 0 0 0 0 rgba(57, 208, 184, 0); } }
#map {
  flex: 1;
  min-height: 560px;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.leaflet-container { background: #dfeafc; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgba(12, 22, 38, 0.96); color: var(--text); }

/* Map markers */
.map-marker {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
  background: var(--primary);
}
.map-marker > * { transform: rotate(-45deg); }
.map-marker.cat-food { background: var(--food); }
.map-marker.cat-activity, .map-marker.cat-music { background: var(--activity); }
.map-marker.cat-event { background: var(--event); }
.map-marker.add-preview { background: var(--primary-strong); opacity: 0.85; }
.map-marker.is-live { animation: marker-pulse 1.6s infinite; }
@keyframes marker-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45), 0 8px 16px rgba(0, 0, 0, 0.35); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0), 0 8px 16px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 8px 16px rgba(0, 0, 0, 0.35); }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-left: none; border-top: 1px solid var(--line); box-shadow: none; order: 1; }
  #map { min-height: 420px; }
}

/* Info panel (details + add-event form) */
.info-panel {
  position: fixed;
  top: 0;
  right: -380px;

  width: 350px;
  height: 100vh;

  background: linear-gradient(180deg, #111827, #1f2937);
  color: white;

  padding: 20px;

  transition: right 0.35s ease;

  z-index: 9999;

  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);

  overflow-y: auto;
}

.info-panel.open {
  right: 0;
}

.info-panel h2 {
  margin: 12px 0 16px;
  font-size: 1.4rem;
}

#closePanel, #closeAddPanel {
  background: #2563eb;
  color: white;

  border: none;
  border-radius: 10px;

  padding: 10px 14px;

  cursor: pointer;

  float: right;
}

#closePanel:hover, #closeAddPanel:hover {
  background: #1d4ed8;
}

#panelEmoji {
  font-size: 60px;
  text-align: center;

  margin-top: 44px;
  margin-bottom: 14px;

  background: rgba(255,255,255,0.08);
  border-radius: 20px;

  padding: 20px;
}

.live-badge {
  display: none;
  background: rgba(255, 122, 89, 0.2);
  color: #ffb7a8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 8px;
}

#panelTitle {
  margin: 12px 0 6px;
  font-size: 26px;
  font-weight: bold;
}

#panelTime {
  color: #9bb0d1;
  font-size: 0.85rem;
  justify-content: flex-start;
  gap: 6px;
}

#panelDescription {
  margin-top: 15px;
  line-height: 1.6;
  color: #d1d5db;
}

.info-panel strong {
  color: white;
}

/* Add-event form */
#addEventForm { margin-top: 44px; display: flex; flex-direction: column; gap: 14px; }
#addEventForm label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: #9bb0d1; }
.field-hint { color: #9bb0d1; font-size: 0.78rem; line-height: 1.5; margin: 0; }
.form-actions { margin-top: 4px; }
.form-actions .primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  width: 100%;
}
