/* ==========================================================================
   Flood Risk Tool - Tool-Specific Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tool Container Layout
   -------------------------------------------------------------------------- */
.tool-container {
  display: flex;
  max-height: 700px;
  background-color: var(--bg);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.tool-sidebar {
  width: 380px;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.sidebar-content {
  padding: 20px;
}

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

.sidebar-content label:first-of-type {
  margin-top: 0;
}

.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;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Input Section
   -------------------------------------------------------------------------- */
.input-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card) 100%);
  margin: -20px -20px 28px -20px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Suggestions Dropdown
   -------------------------------------------------------------------------- */
.input-with-suggestions {
  position: relative;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

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

.suggestions .item:hover {
  background: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   Result Card
   -------------------------------------------------------------------------- */
.result-card {
  background: var(--glass);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.result-card.risk-high {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.result-card.risk-medium {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
}

.result-card.risk-low {
  border-color: #eab308;
  background: rgba(234, 179, 8, 0.1);
}

.result-card.risk-very-low {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.result-card.risk-none {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.result-postcode {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.risk-indicator {
  margin-bottom: 16px;
}

.risk-level {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.risk-high .risk-level { color: #ef4444; }
.risk-medium .risk-level { color: #f97316; }
.risk-low .risk-level { color: #eab308; }
.risk-very-low .risk-level { color: #22c55e; }
.risk-none .risk-level { color: #3b82f6; }

.risk-description {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.risk-details {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-item {
  text-align: center;
}

.detail-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Nearby List
   -------------------------------------------------------------------------- */
.results-badge {
  background: var(--primary);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}

.nearby-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nearby-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nearby-item:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
}

.nearby-item.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}

.nearby-risk-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nearby-risk-dot.high { background: #ef4444; }
.nearby-risk-dot.medium { background: #f97316; }
.nearby-risk-dot.low { background: #eab308; }
.nearby-risk-dot.very-low { background: #22c55e; }

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

.nearby-postcode {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.nearby-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nearby-risk-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.nearby-risk-label.high { color: #ef4444; }
.nearby-risk-label.medium { color: #f97316; }
.nearby-risk-label.low { color: #eab308; }
.nearby-risk-label.very-low { color: #22c55e; }

/* --------------------------------------------------------------------------
   Legend
   -------------------------------------------------------------------------- */
.legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.legend-item.high .legend-color { background: #ef4444; }
.legend-item.medium .legend-color { background: #f97316; }
.legend-item.low .legend-color { background: #eab308; }
.legend-item.very-low .legend-color { background: #22c55e; }

.legend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-text strong {
  font-size: 0.85rem;
  color: var(--text);
}

.legend-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Tool Info / Attribution
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.tool-info p:last-child {
  margin-bottom: 0;
}

.tool-info a {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Button Groups
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

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

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 500px;
  max-height: 700px;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* --------------------------------------------------------------------------
   Mobile FAB
   -------------------------------------------------------------------------- */
.fab {
  display: none;
  width: 56px;
  height: 56px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tool-container {
    flex-direction: column;
    max-height: none;
    height: auto;
  }

  .tool-sidebar {
    width: 100%;
    max-height: none;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .tool-sidebar.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .map-container {
    flex: none;
    height: 400px;
    min-height: 350px;
    max-height: 400px;
  }

  .map {
    min-height: 350px;
    height: 400px;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
  }

  .nearby-list {
    max-height: 180px;
  }
}

@media (max-width: 600px) {
  .sidebar-content {
    padding: 16px;
  }

  .input-section {
    margin: -16px -16px 24px -16px;
    padding: 16px;
  }

  .tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }

  .map-container {
    height: 350px;
    min-height: 300px;
    max-height: 350px;
  }

  .map {
    min-height: 300px;
    height: 350px;
  }

  .risk-level {
    font-size: 1.75rem;
  }

  .risk-details {
    flex-direction: column;
    gap: 12px;
  }
}
