/* ===== ROUTESMITH APP STYLES — Planner & Itinerary Views ===== */
/* Shares design tokens from theme.css. Import theme.css first. */

/* ===== PLANNER PAGE ===== */
.planner-page {
  min-height: 100vh;
  background: var(--bg);
}

.planner-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.planner-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(255,255,255,0.07) 0%, transparent 60%);
  pointer-events: none;
}

.planner-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 0.75rem;
  position: relative;
}

.planner-hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.8);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.65;
  position: relative;
}

/* ===== PROMPT FORM ===== */
.prompt-card {
  max-width: 760px;
  margin: -2.5rem auto 3rem;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
  padding: 2rem 2rem 1.75rem;
  position: relative;
  z-index: 10;
}

.prompt-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.85rem;
  display: block;
}

.prompt-textarea {
  width: 100%;
  min-height: 100px;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.2s ease;
  line-height: 1.6;
}

.prompt-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.prompt-textarea::placeholder {
  color: var(--text-muted);
}

.prompt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.example-chip {
  background: rgba(8, 145, 178, 0.08);
  border: 1px solid rgba(8, 145, 178, 0.2);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.example-chip:hover {
  background: rgba(8, 145, 178, 0.15);
  transform: translateY(-1px);
}

.btn-plan {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-plan:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.4);
}

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

.btn-plan .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-plan.loading .spinner { display: block; }
.btn-plan.loading .btn-icon { display: none; }

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

/* ===== ERROR STATE ===== */
.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 1rem;
  display: none;
}

.error-msg.visible { display: block; }

/* ===== LOADING STATE ===== */
.loading-state {
  max-width: 760px;
  margin: 2rem auto;
  text-align: center;
  display: none;
  padding: 3rem 2rem;
}

.loading-state.visible { display: block; }

.loading-plane {
  font-size: 2.5rem;
  animation: fly 1.8s ease-in-out infinite;
  display: inline-block;
  margin-bottom: 1rem;
}

@keyframes fly {
  0%, 100% { transform: translateX(-8px) rotate(-5deg); }
  50% { transform: translateX(8px) rotate(5deg); }
}

.loading-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.loading-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.loading-bar {
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  margin: 1.5rem auto 0;
  max-width: 280px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 100px;
  animation: loadprogress 2.5s ease-in-out infinite;
}

@keyframes loadprogress {
  0% { width: 0%; }
  60% { width: 80%; }
  100% { width: 95%; }
}

/* ===== ITINERARY RESULT ===== */
.itinerary-result {
  max-width: 860px;
  margin: 0 auto 4rem;
  display: none;
}

.itinerary-result.visible { display: block; }

/* Trip header card */
.trip-header-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.trip-header-card::after {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.trip-dest-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
}

.trip-dest {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.trip-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.trip-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
}

.trip-summary {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.65;
  max-width: 600px;
  position: relative;
}

/* Action buttons (share, new trip) */
.trip-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-action-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(8, 145, 178, 0.3);
}

.btn-action-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-action-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-action-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.copied-toast {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #16a34a;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.copied-toast.visible { opacity: 1; }

/* Day timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease;
}

.day-card:hover { box-shadow: var(--shadow-lg); }

.day-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.day-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.day-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.day-card-location {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.day-chevron {
  color: var(--text-muted);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.day-card.collapsed .day-chevron { transform: rotate(-90deg); }
.day-card.collapsed .day-items-list { display: none; }

.day-items-list {
  padding: 1rem 1.75rem 1.5rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.timeline-item:last-child { border-bottom: none; }

/* Vertical connector line */
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 17px;
  top: calc(0.85rem + 30px);
  width: 2px;
  height: calc(100% - 30px);
  background: var(--border);
}

.item-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Type-based icon backgrounds */
.item-icon-wrap.type-flight { background: #eff6ff; border-color: #bfdbfe; }
.item-icon-wrap.type-hotel  { background: #fef9c3; border-color: #fde68a; }
.item-icon-wrap.type-activity { background: #f0fdf4; border-color: #bbf7d0; }
.item-icon-wrap.type-restaurant { background: #fff7ed; border-color: #fed7aa; }
.item-icon-wrap.type-transport { background: #faf5ff; border-color: #e9d5ff; }

.item-body {
  flex: 1;
  min-width: 0;
}

.item-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.item-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.item-detail {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.item-cost {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.35rem;
  display: inline-block;
}

/* Tips section */
.tips-card {
  margin-top: 1.5rem;
  background: rgba(8, 145, 178, 0.05);
  border: 1px solid rgba(8, 145, 178, 0.15);
  border-radius: 14px;
  padding: 1.5rem 2rem;
}

.tips-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tips-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.tips-list li::before {
  content: '✓';
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* Total cost footer */
.trip-total {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 2rem;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.trip-total-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.trip-total-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

/* ===== SHARED VIEW PAGE ===== */
.shared-page {
  min-height: 100vh;
  background: var(--bg);
}

.shared-banner {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.shared-banner a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.shared-banner a:hover { text-decoration: underline; }

.shared-content {
  max-width: 860px;
  margin: 2rem auto 4rem;
  padding: 0 1.5rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .prompt-card {
    margin: -1.5rem 1rem 2rem;
    padding: 1.5rem 1.25rem;
  }

  .planner-hero {
    padding: 5rem 0 3rem;
  }

  .trip-header-card {
    padding: 1.5rem;
  }

  .day-card-header {
    padding: 1rem 1.25rem;
  }

  .day-items-list {
    padding: 0.75rem 1.25rem 1.25rem;
  }

  .trip-actions {
    flex-direction: column;
  }

  .btn-action {
    justify-content: center;
  }

  .trip-total {
    flex-direction: column;
    text-align: center;
  }

  .itinerary-result {
    margin: 0 1rem 3rem;
  }

  .loading-state {
    padding: 2rem 1rem;
  }
}
