/* ==========================================================================
   Flood Zone Checker - Tool-Specific Styles
   ========================================================================== */

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Tool Container Layout
   -------------------------------------------------------------------------- */
.tool-container {
  display: flex;
  height: calc(100vh - 160px);
  min-height: 500px;
  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;
}

.tool-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  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;
}

/* --------------------------------------------------------------------------
   Instructions
   -------------------------------------------------------------------------- */
.instructions-section {
  background: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px !important;
  margin-bottom: 20px !important;
  border: 1px solid var(--border);
  text-align: center;
}

.instructions-text {
  font-size: 14px;
  color: var(--text);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Search Input
   -------------------------------------------------------------------------- */
.input-with-suggestions {
  position: relative;
}

.input-with-suggestions input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}

.input-with-suggestions input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.suggestions {
  display: none;
  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) var(--radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}

.suggestion-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

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

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

.search-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.search-actions .btn {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Result Card
   -------------------------------------------------------------------------- */
.result-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  border-left: 5px solid var(--border);
  background: var(--bg);
  transition: all 0.3s ease;
}

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

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

.result-card.risk-minimal {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.06);
}

.result-card.risk-undetermined {
  border-left-color: #94a3b8;
  background: rgba(148, 163, 184, 0.06);
}

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

.result-zone {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.risk-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 2rem;
  font-size: 13px;
  font-weight: 600;
  color: white;
  margin-bottom: 12px;
}

.risk-badge.risk-high { background: #ef4444; }
.risk-badge.risk-moderate { background: #f97316; }
.risk-badge.risk-minimal { background: #22c55e; }
.risk-badge.risk-undetermined { background: #94a3b8; }
.risk-badge.risk-nodata { background: #3b82f6; }
.risk-badge.risk-unknown { background: #94a3b8; }

.result-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.result-insurance {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--glass);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.result-bfe {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-coords {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 4px;
}

.result-place {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-fema-link {
  display: inline-block;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.result-fema-link:hover {
  text-decoration: underline;
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

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

.legend-color.high { background: #ef4444; }
.legend-color.moderate { background: #f97316; }
.legend-color.minimal { background: #22c55e; }
.legend-color.undetermined { background: #94a3b8; }

/* --------------------------------------------------------------------------
   Overlay Toggle
   -------------------------------------------------------------------------- */
.overlay-toggle {
  display: flex;
  gap: 8px;
}

.overlay-btn {
  flex: 1;
  padding: 10px 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.overlay-btn:hover {
  background: var(--hover-bg);
}

.overlay-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-full {
  width: 100%;
}

/* --------------------------------------------------------------------------
   How It Works
   -------------------------------------------------------------------------- */
.tool-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-item {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 20px;
  position: relative;
}

.tool-item::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Map Area
   -------------------------------------------------------------------------- */
.map-area {
  flex: 1;
  position: relative;
}

.map {
  width: 100%;
  height: 100%;
}

.fab {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Data Attribution
   -------------------------------------------------------------------------- */
.data-attribution {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.data-attribution a {
  color: var(--primary);
  text-decoration: none;
}

.data-attribution a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Share Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

.share-url-group {
  display: flex;
  gap: 8px;
}

.share-url-group input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

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

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

  .tool-sidebar.collapsed {
    display: none;
  }

  .map-area {
    min-height: 50vh;
  }

  .map {
    min-height: 50vh;
  }

  .fab {
    display: flex;
  }
}

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

  .result-card {
    padding: 16px;
  }
}
