:root {
  --bg: #f6f8ff;
  --surface: #ffffff;
  --text: #18243d;
  --muted: #5c6882;
  --primary: #5561ff;
  --primary-2: #00b3ff;
  --danger: #ef476f;
  --success: #12b886;
  --border: #dce2f5;
  --shadow: 0 10px 30px rgba(61, 78, 165, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(38px);
  opacity: 0.3;
  z-index: -1;
  animation: float 8s ease-in-out infinite;
}

.orb-1 {
  top: -80px;
  right: -40px;
  background: #4cc9f0;
}

.orb-2 {
  bottom: -120px;
  left: -40px;
  background: #f72585;
  animation-delay: 1.2s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-14px);
  }
}

.app {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.hero {
  padding: 1rem 0.5rem;
}

.badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(85, 97, 255, 0.12);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
}

.subtitle {
  margin-top: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.field-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field-group label {
  font-weight: 600;
}

.field-group small {
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(85, 97, 255, 0.2);
}

.stops-header,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.stops-header h3 {
  margin: 0;
}

.stops-container {
  display: grid;
  gap: 0.8rem;
}

.stop-item {
  border: 1px solid var(--border);
  background: #fafbff;
  border-radius: 14px;
  padding: 0.8rem;
  display: grid;
  gap: 0.6rem;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.days-group {
  max-width: 180px;
}

.actions {
  margin-top: 0.4rem;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(85, 97, 255, 0.25);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid #c8d0ff;
}

.btn-danger {
  background: #fff2f5;
  color: #b8204b;
  border: 1px solid #ffc5d5;
}

.status {
  border-radius: 12px;
  padding: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  background: #eef2ff;
  color: #2f3d8f;
}

.status.loading {
  background: #edf7ff;
  color: #005f8f;
}

.status.success {
  background: #eafbf4;
  color: #0b7a57;
}

.status.error {
  background: #fff1f4;
  color: #b8204b;
}

.itinerary-output {
  display: grid;
  gap: 0.6rem;
  line-height: 1.6;
  color: #20314f;
}

.itinerary-output h2,
.itinerary-output h3,
.itinerary-output h4 {
  margin: 0.6rem 0 0.2rem;
  line-height: 1.35;
}

.itinerary-output h2 {
  color: #3445b4;
  border-bottom: 2px solid #dfe5ff;
  padding-bottom: 0.25rem;
}

.itinerary-output h3 {
  color: #0f78a8;
}

.itinerary-output h4 {
  color: #7a2db1;
}

.itinerary-output p {
  margin: 0;
}

.itinerary-output ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.25rem;
}

.itinerary-output code {
  background: #f2f4ff;
  border: 1px solid #dce2ff;
  border-radius: 6px;
  padding: 0.1rem 0.3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

@media (min-width: 740px) {
  .app {
    padding: 1.6rem;
  }

  .card {
    padding: 1.3rem;
  }

  .stop-item {
    grid-template-columns: 1fr 180px auto;
    align-items: end;
    gap: 0.8rem;
  }
}

@media print {
  body {
    background: #fff;
  }

  .hero,
  #tripForm,
  .status,
  #printBtn {
    display: none !important;
  }

  .card {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .result-card {
    margin: 0;
  }

  .itinerary-output {
    font-size: 12pt;
    color: #111;
  }

  .itinerary-output h2,
  .itinerary-output h3,
  .itinerary-output h4 {
    color: #000;
    page-break-after: avoid;
  }

  .itinerary-output ul,
  .itinerary-output p {
    page-break-inside: avoid;
  }
}
