/* ── Fonts ────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-semibold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/static/fonts/playfair-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/static/fonts/playfair-bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f0ede8;
  color: #3a3830;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

#app { position: relative; height: 100vh; overflow: hidden; }

/* ── Floating panel ───────────────────────────────────────────────────────── */

#sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: auto;
  width: auto;
  max-width: 1000px;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  background: rgb(243,230,221);
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.14);
  overflow: hidden;
  max-height: 600px;
}

/* Left editorial column */
#sidebar-editorial {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #e2ddd6;
}

#sidebar-hint {
  flex-shrink: 0;
  padding: 8px 20px;
  background: rgba(0,0,0,0.06);
  border-bottom: 1px solid #d8d3cc;
  font-size: 0.7rem;
  color: #5a5648;
  text-align: center;
  letter-spacing: 0.1px;
}

#sidebar-header {
  flex-shrink: 0;
  padding: 20px 24px 18px;
}

.page-title {
  font-size: 2.6rem;
  font-weight: 700;
  color: #ed1834;
  font-family: 'RosDisplay', 'Playfair Display', serif;
  line-height: 1.05;
  margin-bottom: 12px;
}

.ingress {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.5;
  color: #3a3830;
  margin-bottom: 8px;
}

#sidebar-header p {
  font-size: 0.82rem;
  line-height: 1.55;
  color: #5a5648;
}

/* Right detail column */
#sidebar-detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* ── Location detail ──────────────────────────────────────────────────────── */

#location-detail {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #ffffff;
  transition: opacity 150ms ease, transform 150ms ease;
}

/* ── Questions grid (desktop 3-column) ───────────────────────────────────── */

.questions-grid {
  display: grid;
  grid-template-columns: 140px 1.4fr 1fr;
  background: #ffffff;
}

.q-cell {
  padding: 9px 14px;
  background: #ffffff;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #3a3830;
}

/* Party header row */
.q-party {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  color: #1a1814;
  background: #ffffff;
  padding-top: 12px;
  padding-bottom: 10px;
}

.q-party-s {
  color: #ed1834;
  border-right: 1px solid #e2ddd6;
}

.q-party-m { color: #1a1814; }

/* Topic label column */
.q-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a1814;
  background: #ffffff;
}

/* Answer columns — vertical divider between S and M */
.q-answer-s {
  background: #ffffff;
  border-right: 1px solid #e2ddd6;
}

.q-answer-m { background: #ffffff; }

#location-detail.fading { opacity: 0; transform: translateY(6px); }

.location-header {
  padding: 16px 20px 14px;
  border-bottom: 2px solid #e2ddd6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

@media (min-width: 601px) {
  .location-header { border-bottom-color: #ed1834; }
  .location-name   { font-size: 1.5rem; }
}

.location-header-info { flex: 1; min-width: 0; }

.location-address {
  font-size: 0.72rem;
  color: #a09880;
  margin-top: 3px;
}

.location-edit-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #6dbfa8;
  background: transparent;
  color: #6dbfa8;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms;
  padding: 0;
  font-family: inherit;
}
.location-edit-btn:hover { background: #6dbfa8; color: #ffffff; }

/* ── Question blocks (vertical stacked) ─────────────────────────────────── */

.question-block {
  border-bottom: 1px solid #e2ddd6;
}

.q-topic-label {
  padding: 6px 18px;
  background: #6dbfa8;
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.q-party-section {
  padding: 8px 18px 10px;
  border-bottom: 1px solid #f0ede8;
}
.q-party-section:last-child { border-bottom: none; }

.q-party-name {
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: 0.1px;
}
.q-s { color: #ed1834; }
.q-m { color: #005b99; }

.q-answer-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #3a3830;
}
@font-face{
  font-family:"RosDisplay";
  font-display:swap;
  font-weight:700;
  font-style:normal;
  src: url("RosDisplay-Bold.woff2") format("woff2");
}
h1 {
  color: #ed1834;
  font-family: 'RosDisplay', sans-serif;
}

.location-name {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1814;
  line-height: 1.2;
  margin-bottom: 8px;
}


/* ── Map (full viewport) ─────────────────────────────────────────────────── */

#map { position: absolute; inset: 0; }
#map.pick-mode,
#map.pick-mode .leaflet-grab,
#map.pick-mode .leaflet-dragging { cursor: crosshair !important; }

/* ── Leaflet overrides ───────────────────────────────────────────────────── */

.leaflet-control-attribution {
  background: rgba(255,255,255,0.8) !important;
  color: #a09880 !important;
  font-size: 0.62rem !important;
}
.leaflet-control-attribution a { color: #78716c !important; }

.leaflet-control-zoom a {
  background: #ffffff !important;
  border-color: #e2ddd6 !important;
  color: #5a5648 !important;
}
.leaflet-control-zoom a:hover {
  background: #f5f2ed !important;
  color: #1a1814 !important;
}

/* ── Markers ─────────────────────────────────────────────────────────────── */

.map-pin {
  cursor: pointer;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.30));
  user-select: none;
}

/* ── Admin panel ─────────────────────────────────────────────────────────── */

#admin-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 40%;
  border-top: 1px solid #e2ddd6;
  background: #faf9f6;
}

#admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid #e2ddd6;
}

.admin-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #b45309;
}

#admin-content { overflow-y: auto; flex: 1; min-height: 0; }

.marker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid #ece9e3;
}
.marker-item:hover    { background: #f5f2ed; }
.marker-item.selected { background: #f0ede8; }

.marker-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6dbfa8;
}

.marker-item-name {
  flex: 1;
  font-size: 0.78rem;
  color: #3a3830;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-item-actions { display: flex; gap: 4px; }

.admin-btn {
  background: #ffffff;
  border: 1px solid #d6d0c8;
  border-radius: 4px;
  color: #5a5648;
  font-size: 0.68rem;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms, border-color 120ms;
}

.admin-btn:hover   { background: #f5f2ed; color: #1a1814; border-color: #b8b0a4; }
.add-btn           { border-color: #d97706; color: #b45309; background: #fff8ed; }
.add-btn:hover     { background: #fef3c7; border-color: #b45309; }
.delete-btn:hover  { border-color: #db2777; color: #9d174d; background: #fdf2f8; }
.save-btn          { background: #2563eb; border-color: #2563eb; color: #ffffff; flex: 1; }
.save-btn:hover    { background: #1d4ed8; border-color: #1d4ed8; }

.admin-empty {
  padding: 18px;
  font-size: 0.78rem;
  color: #a09880;
  text-align: center;
}

/* ── Edit form ───────────────────────────────────────────────────────────── */

.edit-form { padding: 12px 14px 14px; overflow-y: auto; }

.form-group { margin-bottom: 9px; }

.form-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a09880;
  margin-bottom: 4px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d6d0c8;
  border-radius: 4px;
  color: #1a1814;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 5px 8px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.form-textarea      { resize: vertical; min-height: 68px; }
.form-select        { cursor: pointer; }

.coords-row  { display: flex; gap: 6px; align-items: flex-end; }
.coord-input { flex: 1; }

.form-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ── Pick hint ───────────────────────────────────────────────────────────── */

.pick-active-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(37,99,235,0.92);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.82rem;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #sidebar {
    flex-direction: column;
    left: 8px; right: 8px; bottom: 0; top: auto;
    width: auto;
    max-height: 30vh;
    max-width: none;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
  }

  #sidebar-editorial {
    width: auto;
    border-right: none;
    border-bottom: 1px solid #e2ddd6;
    overflow-y: visible;
    flex-shrink: 0;
  }

  #sidebar-detail {
    overflow-y: visible;
    flex-shrink: 0;
  }

  #sidebar-hint { display: none; }
  .page-title { font-size: 1.8rem; margin-bottom: 6px; }
  #sidebar-header { padding: 14px 18px 12px; }
  .ingress { font-size: 0.82rem; margin-bottom: 4px; }
  #sidebar-header p { font-size: 0.78rem; }

  #sidebar.marker-open {
    max-height: 75vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide editorial when detail is showing, to maximise space */
  #sidebar.marker-open #sidebar-editorial { display: none; }

  #admin-panel { display: none; }
}
