/* UK Counties & Councils - Stage 1 drill slice. Layout/breadcrumb/label
   rules adapted directly from postcode-areas.css's own proven pattern
   (tool-container/tool-sidebar/breadcrumb/map), same values, cc- prefix
   instead of pa- - no shared class exists across tools yet, per this
   estate's established per-tool-CSS-file convention. */

/* Three top-level grid children (2026-09-15, ported from counties-
   councils.css - see that file's own comment for the full reasoning
   and the desktop trade-off accepted: two independently-sized cards,
   not one shared 700px scrollbox spanning find+browse and details). */
.tool-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-areas:
    "find map"
    "details map";
  gap: var(--spacing-md, 16px);
  align-items: start;
  min-height: 640px;
}

.cc-find-browse {
  grid-area: find;
}

.tool-sidebar {
  grid-area: details;
  max-height: 700px;
  overflow-y: auto;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.cc-find-browse {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.cc-map-wrap {
  grid-area: map;
}

.sidebar-content {
  padding: 20px;
}

.tool-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-muted, #6b7280);
  font-weight: 600;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.cc-lookup-result {
  margin-top: 12px;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-muted, #f3f4f6);
  color: var(--text-body, #1f2937);
  line-height: 1.6;
}

.cc-lookup-error {
  background: #fef2f2;
  color: #991b1b;
}

/* Sidebar index (2026-09-14) - ported directly from counties-councils.css.
   With 650 constituencies to filter, its own bounded, internally
   scrolling box matters even more here than at the other two tools. */
#cc-index-filter {
  margin-bottom: 8px;
}

.cc-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
}

.cc-index-row {
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-body, #1f2937);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

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

.cc-index-row:hover,
.cc-index-row:focus {
  background: var(--surface-muted, #f3f4f6);
  outline: none;
}

.cc-index-row[hidden] {
  display: none;
}

.cc-index-empty {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}

.cc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 6px;
  background: var(--surface-muted, #f3f4f6);
  border-radius: 8px;
}

/* Real button chrome and a real 44px touch target - Postcode Areas'
   own hard-won mobile lesson (a bare link-styled breadcrumb read as
   not-clickable and sat under the touch-target floor), built in from
   this file's first commit rather than found broken a second time. */
.cc-breadcrumb button {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  color: var(--link-color, #2563eb);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
}

.cc-breadcrumb button:disabled {
  background: var(--surface-muted, #e5e7eb);
  color: var(--text-primary, #111827);
  border-color: transparent;
  cursor: default;
  font-weight: 600;
}

.cc-breadcrumb .cc-breadcrumb-sep {
  color: var(--text-muted, #6b7280);
}

.cc-stats {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
}

.cc-map-wrap .map {
  width: 100%;
  height: 640px;
  border-radius: 8px;
}

.cc-label {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-weight: 700;
  font-size: 12px;
  color: #1a1a1a;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.85),
    1px -1px 0 rgba(255,255,255,0.85),
    -1px 1px 0 rgba(255,255,255,0.85),
    1px 1px 0 rgba(255,255,255,0.85);
  pointer-events: none;
}

.cc-label::before {
  display: none;
}

html[data-theme="dark"] .cc-label {
  color: #f5f5f5;
  text-shadow:
    -1px -1px 0 rgba(0,0,0,0.85),
    1px -1px 0 rgba(0,0,0,0.85),
    -1px 1px 0 rgba(0,0,0,0.85),
    1px 1px 0 rgba(0,0,0,0.85);
}

@media (max-width: 640px) {
  .tool-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "find"
      "map"
      "details";
  }

  .tool-sidebar {
    max-height: none;
    overflow-y: visible;
  }
}

.cc-pin-label {
  font-size: 11px;
}

.cc-export-count {
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  margin-bottom: 8px;
}

.cc-export-error {
  background: #fef2f2;
  color: #991b1b;
}

@media print {
  .tool-sidebar,
  .cc-find-browse {
    display: none !important;
  }

  .tool-container {
    display: block;
  }

  .cc-map-wrap .map {
    height: 70vh;
    page-break-inside: avoid;
  }
}

#cc-export-pdf-button,
#cc-geojson-button {
  margin-bottom: 8px;
}
