/* === Reset & Base === */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  background: #f5f5f7;
  color: #1a1a1a;
  line-height: 1.5;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === Top Bar === */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(245, 245, 247, 0.82);
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
}

.top-bar-inner {
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.app-name {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  color: #1a1a1a;
}

.time-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.time-tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: rgba(0,0,0,0.05);
  font-size: 13px;
  font-weight: 500;
  color: #666;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab.active {
  background: #FF6B4A;
  color: #fff;
}

.shortlist-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: #FF6B4A;
  display: flex;
  align-items: center;
  padding: 4px;
}
.shortlist-btn .badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #FF6B4A;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}
.shortlist-btn .badge.show {
  opacity: 1;
  transform: scale(1);
}

/* === Card List === */
.card-list {
  padding: 76px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* === Card === */
.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 0.5px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}
.card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.card-photo-wrap {
  position: relative;
  width: 100%;
  padding-top: 52%;
  overflow: hidden;
}
.card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #e8e8e8;
  transition: opacity 0.3s ease;
}
.card-photo[data-src] {
  opacity: 0;
}
.card-photo.loaded {
  opacity: 1;
}
.card-photo-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.35), transparent);
  pointer-events: none;
}

.card-badge {
  position: absolute;
  bottom: 10px;
  left: 12px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  z-index: 2;
}

.card-heart {
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.2s ease;
}
.card-heart:active {
  transform: scale(0.85);
}
.card-heart svg {
  width: 18px;
  height: 18px;
  stroke: #FF6B4A;
  fill: none;
  stroke-width: 2;
  transition: fill 0.2s ease;
}
.card-heart.saved svg {
  fill: #FF6B4A;
}

.card-info {
  padding: 14px 16px 16px;
  background: #fafafa;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.card-transit {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-transit::before {
  content: '🚄';
  font-size: 12px;
}

.card-weather {
  margin-bottom: 12px;
  overflow-x: auto;
}
.card-weather svg.weather-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72px;
}

.card-itinerary {
  margin-bottom: 10px;
}
.card-itinerary-line {
  font-size: 13px;
  color: #555;
  line-height: 1.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-price {
  font-size: 13px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-price .price-value {
  color: #FF6B4A;
  font-weight: 600;
}

/* === Detail Overlay === */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.detail-overlay.open {
  opacity: 1;
  visibility: visible;
}

.detail-sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  max-height: 88vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.detail-overlay.open .detail-sheet {
  transform: translateX(-50%) translateY(0);
}

.detail-header {
  position: relative;
  width: 100%;
  height: 220px;
  flex-shrink: 0;
}
.detail-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.detail-duration-badge {
  position: absolute;
  bottom: 12px;
  left: 16px;
  background: rgba(255,255,255,0.92);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 100px;
  -webkit-overflow-scrolling: touch;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.detail-transit {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.detail-section {
  margin-bottom: 20px;
}
.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.detail-weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.detail-weather-cell {
  text-align: center;
  padding: 10px 6px;
  background: #f8f8f8;
  border-radius: 10px;
}
.detail-weather-cell .dw-day {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}
.detail-weather-cell .dw-icon {
  font-size: 20px;
  margin-bottom: 2px;
}
.detail-weather-cell .dw-temp {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}

.detail-transit-info {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 12px 14px;
}
.detail-transit-row {
  font-size: 14px;
  color: #444;
  line-height: 1.8;
}

.detail-itinerary-day {
  margin-bottom: 12px;
}
.detail-itinerary-day .di-label {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}
.detail-itinerary-day .di-content {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.detail-accommodation {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #444;
}
.detail-accommodation .da-price {
  color: #FF6B4A;
  font-weight: 600;
}

.detail-cta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-top: 0.5px solid rgba(0,0,0,0.08);
}
.detail-cta-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #FF6B4A;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.detail-cta-btn:active {
  opacity: 0.85;
}

/* === Shortlist Panel === */
.shortlist-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.shortlist-overlay.open {
  opacity: 1;
  visibility: visible;
}
.shortlist-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  max-height: 75vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.shortlist-overlay.open .shortlist-panel {
  transform: translateX(-50%) translateY(0);
}
.shortlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
}
.shortlist-header h2 {
  font-size: 18px;
  font-weight: 700;
}
.shortlist-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}
.shortlist-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}
.shortlist-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 0.5px solid rgba(0,0,0,0.06);
  cursor: pointer;
}
.shortlist-item-img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.shortlist-item-info {
  flex: 1;
  min-width: 0;
}
.shortlist-item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
.shortlist-item-sub {
  font-size: 13px;
  color: #888;
}
.shortlist-item-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  flex-shrink: 0;
}

/* === Animations === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.card {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }

/* === Responsive tweak for very small screens === */
@media (max-height: 667px) {
  .card-photo-wrap { padding-top: 45%; }
}

/* Route Map */
.route-map {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
}
.map-label {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #FF6B4A !important;
  border-radius: 6px !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #333 !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1) !important;
}
.map-label::before {
  border-top-color: #FF6B4A !important;
}

/* Related Content */
.related-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.related-card {
  background: #f8f8fa;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s;
}
.related-card:active {
  transform: scale(0.98);
}
.rc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.rc-platform {
  font-size: 12px;
  font-weight: 600;
  color: #666;
}
.rc-likes {
  font-size: 11px;
  color: #999;
}
.rc-title {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  font-weight: 500;
}
