/* ==========================================================================
   EV Charging Finder Tool - Tool-Specific Styles
   ========================================================================== */

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

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

.divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 12px;
}

/* --------------------------------------------------------------------------
   Results Summary
   -------------------------------------------------------------------------- */
.results-summary {
  display: flex;
  gap: 12px;
}

.summary-stat {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}

.summary-stat .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.summary-stat .stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --------------------------------------------------------------------------
   Results List
   -------------------------------------------------------------------------- */
.results-section {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
}

.result-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.result-card.highlighted {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

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

.result-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  flex: 1;
  margin-right: 8px;
}

.result-operator {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-distance {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Connector Badges
   -------------------------------------------------------------------------- */
.connector-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.connector-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}

.connector-badge.speed-ultra {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #16a34a;
}

.connector-badge.speed-rapid {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.3);
  color: #ea580c;
}

.connector-badge.speed-fast {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

.connector-badge.speed-slow {
  background: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.3);
  color: #6b7280;
}

html[data-theme="dark"] .connector-badge.speed-ultra { color: #4ade80; }
html[data-theme="dark"] .connector-badge.speed-rapid { color: #fb923c; }
html[data-theme="dark"] .connector-badge.speed-fast { color: #60a5fa; }
html[data-theme="dark"] .connector-badge.speed-slow { color: #9ca3af; }

/* Free badge */
.free-badge {
  background: #22c55e;
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 4px;
}

/* --------------------------------------------------------------------------
   Result Actions (Navigate & Share)
   -------------------------------------------------------------------------- */
.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.btn-navigate,
.btn-share {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-navigate {
  background: #22c55e;
  color: white;
  border: none;
}

.btn-navigate:hover {
  background: #16a34a;
  color: white;
}

.btn-share {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* --------------------------------------------------------------------------
   Map Popup Styling
   -------------------------------------------------------------------------- */
.map-popup {
  min-width: 180px;
}

.map-popup .popup-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.map-popup .popup-operator {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 8px;
}

.map-popup .popup-connectors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.popup-nav-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background: #22c55e;
  color: white !important;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.popup-nav-btn:hover {
  background: #16a34a;
}

/* --------------------------------------------------------------------------
   Loading
   -------------------------------------------------------------------------- */
.loading-indicator {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-indicator p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

.loading-detail {
  font-size: 0.8rem !important;
  margin-top: 8px !important;
}

/* --------------------------------------------------------------------------
   Tool Info
   -------------------------------------------------------------------------- */
.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 Styles
   -------------------------------------------------------------------------- */
.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

.btn-icon {
  margin-right: 6px;
}

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

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

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

/* --------------------------------------------------------------------------
   EV Speed Marker Icons
   -------------------------------------------------------------------------- */
.ev-marker-icon {
  background: white;
  border: 2px solid #2563eb;
  border-radius: 8px;
  padding: 3px 6px;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  text-align: center;
  line-height: 1.2;
}

.ev-marker-icon.speed-ultra {
  border-color: #16a34a;
  color: #16a34a;
}

.ev-marker-icon.speed-rapid {
  border-color: #ea580c;
  color: #ea580c;
}

.ev-marker-icon.speed-fast {
  border-color: #2563eb;
  color: #2563eb;
}

.ev-marker-icon.speed-slow {
  border-color: #6b7280;
  color: #6b7280;
}

/* --------------------------------------------------------------------------
   No Results
   -------------------------------------------------------------------------- */
.no-results {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  font-size: 0.9rem;
}

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

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

  .map-container {
    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;
  }

  .results-list {
    max-height: 250px;
  }
}

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

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

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

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

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

  .results-summary {
    flex-wrap: wrap;
  }

  .summary-stat {
    flex: 1 1 30%;
  }
}
