/* ==========================================================================
   Dark Sky Finder - Tool-Specific Styles
   ========================================================================== */

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

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

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

/* --------------------------------------------------------------------------
   Category Filters
   -------------------------------------------------------------------------- */
.category-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.category-filter input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.category-badge.park {
  background: #2563eb;
}

.category-badge.sanctuary {
  background: #7c3aed;
}

.category-badge.reserve {
  background: #059669;
}

.category-badge.community {
  background: #d97706;
}

.category-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Moon Phase Widget
   -------------------------------------------------------------------------- */
.moon-widget {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.moon-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.moon-icon {
  font-size: 2.5rem;
}

.moon-info {
  flex: 1;
}

.moon-phase-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
}

.moon-illumination {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.moon-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.moon-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.moon-detail-item .label {
  color: var(--text-muted);
}

.moon-detail-item .value {
  font-weight: 600;
  color: var(--text);
}

.stargazing-rating {
  text-align: center;
  padding: 10px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
}

.stargazing-rating.excellent {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.stargazing-rating.good {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.stargazing-rating.fair {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.stargazing-rating.poor {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

/* --------------------------------------------------------------------------
   Nearest Sites Results
   -------------------------------------------------------------------------- */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.site-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.site-card:hover {
  border-color: var(--primary);
  background: var(--hover-bg);
}

.site-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.site-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.site-card-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
}

.site-card-distance {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 600;
}

.site-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-card-state {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.site-card-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Bortle Scale Legend
   -------------------------------------------------------------------------- */
.bortle-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bortle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bortle-swatch {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.bortle-label {
  flex: 1;
}

.bortle-class {
  font-weight: 600;
  color: var(--text);
  width: 16px;
  text-align: center;
}

/* Bortle class colors matching djlorenz tiles */
.bortle-1 { background: #000000; }
.bortle-2 { background: #111133; }
.bortle-3 { background: #0a2b4e; }
.bortle-4 { background: #0f4d2a; }
.bortle-5 { background: #4a6e1e; }
.bortle-6 { background: #8a8a00; }
.bortle-7 { background: #cc6600; }
.bortle-8 { background: #cc3333; }
.bortle-9 { background: #ffffff; border: 1px solid var(--border); }

/* --------------------------------------------------------------------------
   Overlay Controls
   -------------------------------------------------------------------------- */
.overlay-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overlay-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.overlay-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.opacity-control input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
}

.opacity-value {
  font-weight: 600;
  color: var(--text);
  min-width: 32px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   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);
}

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

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

#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;
}

/* --------------------------------------------------------------------------
   Marker Styles
   -------------------------------------------------------------------------- */
.dark-sky-marker {
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dark-sky-marker.park {
  background: #2563eb;
}

.dark-sky-marker.sanctuary {
  background: #7c3aed;
}

.dark-sky-marker.reserve {
  background: #059669;
}

.dark-sky-marker.community {
  background: #d97706;
}

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

  .tool-sidebar {
    width: 100%;
    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;
  }

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

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

@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;
  }

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

  .site-results {
    max-height: 300px;
  }
}
