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

html, body, #app {
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

#app {
  display: flex;
  position: relative;
}

#map {
  flex: 1;
  height: 100vh;
}

/* ── Controls panel ── */

#controls {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  padding: 12px 14px;
  width: 210px;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
}

#controls h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1a1a2e;
}

.control-group {
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.control-group:last-of-type {
  border-bottom: none;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 5px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  cursor: pointer;
  color: #333;
}

.checkbox-row input[type="checkbox"] {
  cursor: pointer;
}

.disabled-layer {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Grade color indicators */
.grade-1 { color: #1a6b1a; }
.grade-2 { color: #2d9e2d; }
.grade-3 { color: #e07b00; }
.grade-4 { color: #c0392b; }
.grade-notjudged { color: #4a90d9; }
.grade-null { color: #888; }

.btn-apply {
  width: 100%;
  padding: 7px;
  margin-top: 8px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-apply:hover { background: #1d4ed8; }

#status-bar {
  margin-top: 8px;
  font-size: 11px;
  color: #777;
  text-align: center;
}

/* ── Sidebar / school card ── */

#sidebar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1000;
  width: 340px;
  height: 100vh;
  background: #f7f8fa;
  box-shadow: -2px 0 12px rgba(0,0,0,0.15);
  overflow-y: auto;
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

#sidebar.hidden {
  transform: translateX(100%);
}

#close-sidebar {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #555;
  z-index: 1;
}

/* ── Card header ── */

.card-name {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 36px 16px 16px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.card-name .card-urn {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 2px;
}

/* ── Collapsible blocks ── */

.card-block {
  border-bottom: 1px solid #e0e3e8;
  background: #fff;
}

.block-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

.block-header:hover {
  background: #f0f2f5;
}

.block-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #888;
  width: 80px;
  flex-shrink: 0;
}

.block-value {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #111;
}

.block-arrow {
  font-size: 10px;
  color: #aaa;
  transition: transform 0.2s;
  margin-left: 6px;
}

.block-header.open .block-arrow {
  transform: rotate(90deg);
}

.block-body {
  display: none;
  padding: 10px 14px 14px;
  background: #fafbfc;
  border-top: 1px solid #eee;
}

.block-body.open {
  display: block;
}

/* ── Card rows inside blocks ── */

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}

.card-row:last-child { border-bottom: none; }

.card-row .label {
  color: #888;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-row .value {
  color: #111;
  font-size: 12px;
  text-align: right;
  word-break: break-word;
}

/* ── Ofsted badge ── */

.ofsted-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}

.badge-outstanding  { background: #1a6b1a; }
.badge-good         { background: #2d9e2d; }
.badge-ri           { background: #e07b00; }
.badge-inadequate   { background: #c0392b; }
.badge-notjudged    { background: #4a90d9; }
.badge-unknown      { background: #aaa; }

/* ── Parent view question bars ── */

.pv-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 10px;
}

.pv-question {
  margin-bottom: 12px;
}

.pv-q-text {
  font-size: 11px;
  color: #444;
  margin-bottom: 4px;
  font-style: italic;
}

.pv-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0;
}

.pv-bar-label {
  font-size: 10px;
  color: #777;
  width: 105px;
  flex-shrink: 0;
  text-align: right;
}

.pv-bar-track {
  flex: 1;
  background: #eee;
  border-radius: 2px;
  height: 8px;
  overflow: hidden;
}

.pv-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.pv-bar-pct {
  font-size: 10px;
  color: #555;
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.fill-strongly-agree    { background: #1a6b1a; }
.fill-agree             { background: #78c878; }
.fill-dont-know         { background: #ccc; }
.fill-disagree          { background: #e07b00; }
.fill-strongly-disagree { background: #c0392b; }
.fill-not-applicable    { background: #bbb; }
.fill-yes               { background: #2d9e2d; }
.fill-no                { background: #c0392b; }

.card-links {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-links a {
  font-size: 12px;
  color: #2563eb;
}

.maps-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #2563eb;
}


/* ── School name labels ── */

.school-name-label {
  background: none;
  border: none;
  white-space: nowrap;
  pointer-events: none;
}

.school-name-label span {
  font-size: 10px;
  font-weight: 600;
  color: #222;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
  letter-spacing: 0.1px;
}
