@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;600;700&display=swap');

:root {
  --tesla-red: #e82127;
  --tesla-dark: #171a20;
  --tesla-gray: #393c41;
  --tesla-light-gray: #f4f4f4;
  --tesla-border: #d0d1d2;
  --tesla-green: #12bb4f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  color: var(--tesla-dark);
  background-color: #fff;
}

@media (max-width: 850px) {
  body {
    flex-direction: column-reverse;
    overflow-y: auto;
  }
  #sidebar {
    width: 100% !important;
    height: auto !important;
  }
  #map {
    min-height: 380px !important;
    height: 50vh !important;
  }
}

#sidebar {
  width: 440px;
  height: 100%;
  background: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  overflow-y: auto;
}

.brand-header {
  margin-bottom: 18px;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--tesla-dark);
}

.brand-desc {
  font-size: 13px;
  color: var(--tesla-gray);
  margin-top: 4px;
  line-height: 1.4;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tesla-gray);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--tesla-border);
  border-radius: 4px;
  background-color: #f9f9f9;
  color: var(--tesla-dark);
  transition: all 0.2s ease;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--tesla-dark);
  background-color: #fff;
}

.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 10px 14px;
  background-color: #f9f9f9;
  border-radius: 4px;
  border: 1px solid var(--tesla-border);
}

.switch-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--tesla-dark);
  margin: 0;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--tesla-dark);
}

input:checked + .slider-toggle:before {
  transform: translateX(20px);
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--tesla-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1050;
  box-shadow: 0 6px 14px rgba(0,0,0,0.1);
  display: none;
}

.autocomplete-item {
  padding: 9px 13px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.4;
  text-align: right;
}

.autocomplete-item:hover {
  background-color: #f4f4f4;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--tesla-dark);
  background: transparent;
  cursor: pointer;
}

.slider-val {
  font-weight: 700;
  min-width: 44px;
  font-size: 14px;
}

.btn-plan {
  background-color: var(--tesla-dark);
  color: #fff;
  border: none;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: background-color 0.2s ease;
}

.btn-plan:hover {
  background-color: #33363b;
}

.btn-plan:disabled {
  background-color: #a0a0a0;
  cursor: not-allowed;
}

#error-msg {
  display: none;
  background: #fde8e8;
  color: #c81e1e;
  padding: 12px;
  border-radius: 4px;
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.4;
}

#results {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--tesla-border);
  display: none;
}

.stats-card {
  background: var(--tesla-light-gray);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.stat-label {
  color: var(--tesla-gray);
}

.stat-value {
  font-weight: 700;
  direction: rtl;
}

.itinerary-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tesla-dark);
  margin-top: 4px;
  flex-shrink: 0;
}

.step-dot.charging {
  background: var(--tesla-red);
  box-shadow: 0 0 0 3px rgba(232, 33, 39, 0.2);
}

.step-dot.turnaround {
  background: #0070d2;
}

.step-text h4 {
  font-size: 14px;
  margin-bottom: 2px;
}

.step-text p {
  color: var(--tesla-gray);
}

.app-disclaimer {
  margin-top: auto;
  padding-top: 24px;
  font-size: 11.5px;
  color: #8e8e93;
  line-height: 1.5;
  text-align: center;
}

.contact-line {
  margin-bottom: 6px;
}

.contact-link {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.contact-link:hover {
  color: var(--tesla-dark);
  text-decoration: underline;
}

#map {
  flex: 1;
  height: 100%;
  direction: ltr;
}

.clean-map-tiles {
  filter: saturate(0.75) contrast(1.05) brightness(1.02);
}

.sc-marker {
  background-color: var(--tesla-gray);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  font-weight: bold;
  font-size: 13px;
  border: 2px solid #fff;
  transition: all 0.2s ease;
}

.sc-marker.active-stop {
  background-color: var(--tesla-red);
  transform: scale(1.25);
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--tesla-red);
}

.loader {
  display: none;
  text-align: center;
  padding: 12px;
  font-size: 14px;
  color: var(--tesla-gray);
}