/* ... (保留之前的样式) ... */

/* [修改] 移除 .travel-grid 的 min-height，因为现在它是子容器 */
.travel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
  padding-bottom: 20px; /* 稍微减小底部 padding */
}

/* [新增] 外部包裹容器，用于垂直排列 Visited 和 TODO 区域 */
.travel-wrapper {
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-height: 200px;
  padding-bottom: 40px;
}

/* [新增] 分区标题样式 */
.travel-section-title {
  font-family: "Inter", sans-serif;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  padding-left: 15px;
  border-left: 6px solid #ccc; /* 默认颜色，JS会覆盖 */
  color: #333;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.loading-text {
  text-align: center;
  width: 100%;
  color: #666;
  padding-top: 40px;
}

/* ... (保留 .place-card 及之后的所有样式) ... */
.place-card {
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.place-card:hover {
  transform: translateY(-8px);
}

.place-image-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
}

.place-image-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 105, 92, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.place-card:focus-visible,
.place-card:focus-within {
  transform: translateY(-8px);
  outline: 3px solid #02ddc3;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.place-card:focus-visible .place-image-wrapper::after,
.place-card:focus-visible .hover-actions,
.place-card:focus-within .place-image-wrapper::after,
.place-card:focus-within .hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.hover-actions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
  width: 80%;
  pointer-events: none;
}

.place-card:hover .hover-actions {
  opacity: 1;
  pointer-events: auto;
}

.place-card:hover .place-image-wrapper::after {
  opacity: 1;
  pointer-events: auto;
}

.place-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.place-card:hover .place-image-wrapper img {
  transform: scale(1.08);
}

.place-info {
  padding: 0 5px;
}

.place-country {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #666;
  font-weight: 700;
  margin-bottom: 6px;
}

.place-city {
  font-size: 24px;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 5px 0;
  font-family: "Inter", sans-serif;
  line-height: 1.2;
}

.place-date {
  font-size: 16px;
  color: #00695c;
  font-weight: 600;
  margin-top: 2px;
}

.place-card.hidden-place {
  display: none;
}

.action-btn {
  display: block;
  padding: 10px 0;
  text-align: center;
  border-radius: 25px;
  font-weight: bold;
  text-decoration: none;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.action-btn:hover {
  transform: scale(1.05);
}

.photo-btn {
  background-color: white;
  color: #00695c;
  border: none;
}

.photo-btn:hover {
  background-color: #f0f0f0;
}

.video-btn-overlay {
  background-color: #00aeec;
  color: #000000;
  border: none;
}

.video-btn-overlay:hover {
  background-color: #008bbd;
  color: white;
}

.hidden-modal {
  display: none !important;
}

.gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f9f9f9;
  z-index: 2000;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

.gallery-content {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
}

.gallery-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 20px;
  flex-direction: column;
}

.header-center {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.back-btn {
  background: none;
  border: 2px solid #00695c;
  color: #00695c;
  padding: 8px 20px;
  border-radius: 25px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  font-size: 1rem;
}

.back-btn:hover {
  background: #00695c;
  color: white;
}

.video-btn {
  display: inline-block;
  background-color: #00aeec;
  color: #000000;
  padding: 8px 20px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s;
  align-self: flex-start;
}

.video-btn:hover {
  background-color: #008bbd;
  color: white;
}

.hidden-btn {
  display: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.gallery-item {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover {
  transform: scale(1.03);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Lightbox Styling --- */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content {
  max-height: 75vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  margin-top: 20px;
  color: #f0f0f0;
  font-size: 18px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  font-family: "Inter", sans-serif;
}

.close-lightbox {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 3001;
  transition: transform 0.2s;
}
.close-lightbox:hover { transform: scale(1.1); }

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  padding: 10px;
  user-select: none;
  z-index: 3001;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.prev-btn { left: 30px; }
.next-btn { right: 30px; }

/* Map Container */
#map-container {
  width: 100%;
  height: 400px;
  border-radius: 16px;
  margin-bottom: 30px;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Map Reset Button */
.map-reset-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background-color: white;
  color: #00695c;
  border: 2px solid #00695c;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: all 0.3s;
  font-size: 14px;
}

.map-reset-btn:hover {
  background-color: #00695c;
  color: white;
}

/* Map Popup Styling (Updated for Gallery) */
.leaflet-popup-content {
  text-align: center;
}

/* 新增：Popup 内部的横向滚动容器 */
.popup-gallery-container {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  max-width: 250px;
  padding-bottom: 5px;
  justify-content: center; /* 如果只有一张，居中 */
}

/* 隐藏滚动条但保留功能 */
.popup-gallery-container::-webkit-scrollbar {
  height: 4px;
}
.popup-gallery-container::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.popup-photo-thumb {
  width: 100px; /* 稍微缩小一点以便并排 */
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0; /* 防止被挤压 */
}
.popup-photo-thumb:hover { opacity: 0.8; }

.popup-location-name {
  font-weight: bold;
  font-size: 12px;
  color: #333;
  margin-top: 5px;
}

/* Continent Tabs & Controls (Rest unchanged) */
.continent-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.tab-btn {
  background: white;
  border: 1px solid #ddd;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  color: #555;
  transition: all 0.3s;
}

.tab-btn:hover {
  background: #f0f0f0;
  color: #00695c;
}

.tab-btn.active {
  background: #00695c;
  color: white;
  border-color: #00695c;
}

.travel-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 30px;
  background-color: #ffffff;
  padding: 20px 25px;
  border-radius: 16px;
  border: 1px solid #eee;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  flex-wrap: wrap;
  gap: 20px;
}

.dropdown-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-item label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  font-weight: 700;
  margin-left: 4px;
}

.select-wrapper {
  position: relative;
  display: inline-block;
}

.select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 160px;
  padding: 10px 35px 10px 15px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #00695c;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.select-wrapper select:hover {
  border-color: #00695c;
  background-color: white;
  color: #00695c;
}

.select-wrapper::after {
  content: "▼";
  font-size: 10px;
  color: #00695c;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: color 0.3s ease;
}

.select-wrapper:hover::after {
  color: white;
}

.filter-toggles {
  display: flex;
  gap: 15px;
  align-items: center;
  padding-bottom: 2px;
}

.toggle-btn input[type="checkbox"] {
  display: none;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  user-select: none;
  background-color: #f0f0f0;
  color: #999;
}

.toggle-icon {
  margin-right: 8px;
  font-size: 12px;
  transition: transform 0.3s;
}

.toggle-btn.visited-toggle input:checked + .toggle-icon { color: white; }
.toggle-btn.visited-toggle:has(input:checked) {
  background-color: #00695c;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 105, 92, 0.3);
  transform: translateY(-2px);
}

.toggle-btn.planned-toggle input:checked + .toggle-icon { color: white; }
.toggle-btn.planned-toggle:has(input:checked) {
  background-color: #ff9800;
  color: white;
  box-shadow: 0 4px 10px rgba(255, 152, 0, 0.3);
  transform: translateY(-2px);
}

.toggle-btn:hover { background-color: #e0e0e0; }
.toggle-btn:has(input:checked):hover { opacity: 0.9; }

@media (max-width: 768px) {
  .travel-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .dropdown-group {
    flex-direction: column;
    width: 100%;
  }
  .select-wrapper select { width: 100%; }
  .filter-toggles { justify-content: space-between; }
  .toggle-btn { flex: 1; justify-content: center; }
}
