/* ==========================================================================
   Fuel Prices 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: 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;
}

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

/* --------------------------------------------------------------------------
   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-card.cheapest {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.05);
}

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

.result-brand {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.result-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.result-card.cheapest .result-price {
  color: #22c55e;
}

.result-name {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-distance {
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-saving {
  color: #22c55e;
  font-weight: 600;
}

.result-extra {
  color: #ef4444;
  font-weight: 600;
}

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

.nearest-badge {
  background: #3b82f6;
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.brand-logo {
  height: 24px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
}

.brand-name,
.brand-name-fallback {
  font-weight: 700;
  color: var(--text);
}

.result-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 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 {
  text-align: center;
  min-width: 150px;
}

.map-popup .popup-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: #22c55e;
}

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

/* --------------------------------------------------------------------------
   Savings Banner
   -------------------------------------------------------------------------- */
.savings-banner {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  text-align: center;
}

.savings-banner .savings-amount {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
}

.savings-banner .savings-detail {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   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;
  overflow: hidden;
  min-height: 500px;
  max-height: 700px;
}

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

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-content h3 {
  margin-bottom: 16px;
}

.calculator-form label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  margin-top: 12px;
  color: var(--text-muted);
}

.calculator-form input {
  width: 100%;
}

.savings-result {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Custom Price Markers
   -------------------------------------------------------------------------- */
.price-marker {
  background: white;
  border: 2px solid #2563eb;
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.price-marker.cheapest {
  background: #22c55e;
  border-color: #16a34a;
  color: white;
}

.price-marker.expensive {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

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

  .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;
    max-height: 350px;
  }

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

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

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