@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap");
:root {
  --primary-color1: #1c1337;
  --primary-color2: #4e122c;
  --secondary-color: #3eb1bd;
  --background-color: #1a1a1a;

  --text-color: rgba(255, 255, 255, 0.87);
  --border-radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Nunito Sans", sans-serif;
  line-height: 1.5;
  margin: 0;
  color: var(--text-color);
}

.main-container {
  background-image: linear-gradient(
    70deg,
    var(--primary-color1),
    var(--primary-color2)
  );
  height: 100vh;
  background-size: cover;
  background-position: center;
}

header {
  display: flex;
  justify-content: space-between;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 2;
  padding-inline-start: 38px;
}

.route-content h2 {
  font-size: 1.9rem;
  margin-bottom: 2rem;
  padding-inline-start: 40px;
}
.route-content .route-brdr {
  border: 2px solid transparent;
  border-image: linear-gradient(70deg, #271b4b, #671b44);
  border-image-slice: 1;
  border-radius: 18px;
}
.form-container {
  padding: 2rem;
  padding-top: 15px;
  border-radius: var(--border-radius);
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 1.4rem;
  font-weight: 600;
}

select,
input {
  width: 100%;
  padding: 0.6em 1.2em;
  font-size: 1em;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: transparent;
  color: var(--text-color);
  border: 2px solid #541635;
  border-radius: var(--border-radius);
  height: 50px;
}
select option {
  background-color: #1a1233;
  color: white;
}
select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.4em;
  padding-right: 2.5em;
}

.submit-btn {
  background-color: #a34949;
  color: white;
  border: 2px solid #541635;
  padding: 0.8em 2em;
  font-size: 1em;
  border-radius: var(--border-radius);
  height: 50px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.result-container {
  background: #1a1330;
  border: 2px solid transparent;
  border-image: linear-gradient(70deg, #322158, #541635);
  border-image-slice: 1;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-inline: 1.8rem;
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 10px;
}

.map {
  position: relative;
  width: 100%;
  min-height: 260px;
  background-color: #120b24;
  border-radius: 20px;
  padding: 1.5rem;
  overflow: hidden;
}

.route-network {
  position: relative;
  width: 100%;
  height: 220px;
}

.route-network.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
}

.line-track {
  position: relative;
  width: 100%;
  height: 150px;
  margin-top: 10px;
}

.rail {
  position: absolute;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  opacity: 0.45;
}

.rail-top {
  top: 40%;
}

.rail-bottom {
  top: 60%;
}

.line-progress {
  position: absolute;
  left: 0;
  top: 33%;
  height: 44px;
  width: 0%;
  border-radius: 40px;
  opacity: 0.85;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  transition: width 0.8s ease;
  z-index: 1;
}

.stop-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #120b24;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  transition: transform 0.3s ease;
}

.stop-marker.selected {
  width: 26px;
  height: 26px;
  border-width: 4px;
  transform: translate(-50%, -50%) scale(1.08);
}

.pin {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: #ff7043;
  top: 46%;
  transform: translate(-50%, -120%);
  z-index: 3;
  transition: left 0.8s ease;
}

.pin::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-top-color: inherit;
}

.inner-dot {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.label {
  position: absolute;
  top: 18%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: left 0.8s ease;
  text-align: left;
}

.label.label-left {
  transform: translate(-100%, -50%);
  text-align: right;
}

.pin-forward {
  animation: pinForward 0.6s ease;
}

.pin-back {
  animation: pinBack 0.6s ease;
}

.pin-jump {
  animation: pinJump 0.5s ease;
}

@keyframes pinForward {
  0% {
    transform: translate(-50%, -120%) scale(0.9);
  }
  100% {
    transform: translate(-50%, -120%) scale(1);
  }
}

@keyframes pinBack {
  0% {
    transform: translate(-50%, -120%) scale(1.05);
  }
  100% {
    transform: translate(-50%, -120%) scale(1);
  }
}

@keyframes pinJump {
  0% {
    transform: translate(-50%, -150%) scale(0.8);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -110%) scale(1.05);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -120%) scale(1);
  }
}

.demand-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: center;
}

.demand-info h3 {
  color: var(--secondary-color);
  font-size: 2.5rem;
  font-weight: 600;
}

.demand-numbers .range {
  display: block;
  font-weight: bold;
  font-weight: 800;
  font-size: 5rem;
  background: linear-gradient(180deg, #ffda3f 9.8%, #ffa32f 70.86%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  column-gap: 1rem;
}

.demand-numbers .range small {
  font-size: 20px;
}

.actual {
  display: block;
  color: #fff;
  font-size: 2rem;
  font-weight: 600;
}

@media (prefers-color-scheme: light) {
  body {
    background-color: #ffffff;
    color: var(--primary-color);
  }

  .form-container,
  .result-container {
    background: rgba(0, 0, 0, 0.05);
  }
}

@media (max-width: 768px) {
  .main-container {
    height: auto;
  }
  header {
    padding: 30px 20px 0px 20px;
    align-items: flex-start;
  }

  .header h1 {
    font-size: 1.4rem;
    padding-inline-start: 0;
  }
  .header img {
    width: 200px;
    height: 100px;
  }

  .route-content {
    padding-inline: 20px;
  }

  .route-content h2 {
    font-size: 1.5rem;
    padding-inline-start: 0;
    margin-bottom: 1.5rem;
  }

  .form-container {
    padding: 1rem;
  }

  label {
    font-size: 1.2rem;
  }

  input,
  select {
    font-size: 0.95rem;
    height: 45px;
    padding: 0.5em 1em;
  }

  .submit-btn {
    font-size: 0.95rem;
    padding: 0.6em 1.5em;
    height: 45px;
  }

  .result-container {
    grid-template-columns: 1fr;
    padding: 1rem;
    margin-inline: 0.5rem;
  }

  .map {
    width: 100%;
    max-width: 100%;
    height: 220px;
  }

  .route-line {
    width: 130vw;
    height: 6px;
    left: -70px;
    top: 10px;
    transform: rotate(28deg);
  }

  .stop-name {
    font-size: 12px;
  }

  .demand-info h3 {
    font-size: 2rem;
  }

  .demand-numbers .range {
    font-size: 4.5rem;
  }

  .actual {
    font-size: 1.2rem;
  }
}

.loading-overlay {
  background: #00000096;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  width: 100%;
  z-index: 10;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
