/* Body */
body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Info Icon and Popup */
.info-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  background-color: #1f3c88;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  cursor: help;
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
}

.info-icon:hover {
  background-color: #2a4fa0;
}

.info-popup {
  position: fixed;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 400px;
  min-width: 350px;
  font-size: 0.85em;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.info-popup.visible {
  opacity: 1;
  pointer-events: auto;
}

.info-popup p {
  margin: 0 0 8px 0;
}

.info-popup a {
  color: #1f3c88;
  text-decoration: none;
  font-weight: 500;
}

.info-popup a:hover {
  text-decoration: underline;
}

h3 {
  position: relative;
  display: inline-block;
}

/* Not Available label for missing metric fields */
.not-available {
  color: #999;
  font-style: italic;
}

/* Source attribution links shown beneath data sections */
.source-link {
  font-size: 0.8em;
  color: #888;
  margin-top: 4px;
}

.source-link a {
  color: #888;
}

/* Header */
header {
  background: #1f3c88;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 25px 20px;
}

header h1 {
  font-family: "Rubik", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

header h1 a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

header h1 a:hover {
  opacity: 0.8;
  cursor: pointer;
}

#logo-container {
  display: flex;
  align-items: center;
  position: absolute;
  left: 20px;
  margin-top: -40px;
}

#logo {
  height: 100px;
}

#header-controls,
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  right: 20px;
}

/* Dashboard / Search for a School links in header (info pages) */
header .header-controls a {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

header .header-controls a:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.dropdown-menu a:last-child {
  border-bottom: none;
}

.dropdown-menu a:hover {
  background: #f5f5f5;
}

/* Back button */
#back-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: none;
}

#back-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Dashboard button */
#dashboard-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

#dashboard-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Search Functionality */
#search-container {
  position: relative;
  background: rgb(255, 255, 255);
  border-radius: 20px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
}

#search-input {
  border: none;
  outline: none;
  font-size: 14px;
  padding: 6px;
  width: 250px;
  color: black;
  font-weight: 700;
}

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
}

#search-results.show {
  display: block;
}

.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  color: black;
}

.search-result-item:hover {
  background: #f5f5f5;
}

.search-result-item:last-child {
  border-bottom: none;
}

/* Main Content Area */
main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Map container - displays D3.js SVG map */
#map {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8f9fa;
  min-width: 300px;
}

/* Resize handle - draggable divider */
#resize-handle {
  width: 8px;
  background: #ddd;
  cursor: col-resize;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

#resize-handle:hover {
  background: #1f3c88;
}

#resize-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  background: #999;
  border-radius: 1px;
}

#resize-handle:hover::before {
  background: white;
}

/* Info Panel (Right Sidebar) */
#info-panel {
  width: 550px;
  min-width: 300px;
  max-width: 80%;
  background: #f2f2f2;
  border-left: 1px solid #ddd;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Explore button - shown when district is selected */
#explore-button {
  width: 100%;
  padding: 12px 24px;
  background: #1f3c88;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin: 0 auto 20px auto;
  display: none;
  transition: background 0.2s;
}

#explore-button:hover {
  background: #2a4fa3;
}

#explore-button:active {
  background: #1a3266;
}

/* Tab navigation (Overview, Policies, Data) */
.tabs {
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid #ccc;
  margin-bottom: 12px;
}

.tabs button {
  background: none;
  border: none;
  font-weight: 600;
  color: #666;
  padding: 8px 0;
  cursor: pointer;
}

.tabs button.active {
  color: #000;
  border-bottom: 2px solid #1f3c88;
}

/* Policy filter dropdown (in Policies tab) */
.policy-filter-container {
  position: relative;
  margin-bottom: 15px;
}

.policy-filter-dropdown {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 8px 10px;
}

.policy-filter-dropdown:focus {
  outline: none;
  border-color: #1f3c88;
  box-shadow: 0 0 0 2px rgba(31, 60, 136, 0.2);
}

/* Map / SVG Styles */
svg {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

/* Tooltip & Loading Indicator */
#tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

#tooltip.visible {
  opacity: 1;
}

#loading {
  position: absolute;
  top: 10px;
  left: 10px;
  background: white;
  border: 1px solid #ccc;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

/* Property Display (School/District Details) */
.property-item {
  margin: 8px 0;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}

.property-key {
  font-weight: bold;
  color: #333;
  margin-right: 8px;
}

.property-value {
  color: #666;
}
