/* ==========================================================================
   Pikmin Postcard App Stylesheet
   ========================================================================== */

/* --- Design Tokens & Variables --- */
:root {
  --color-bg: #F5F7F4;          /* Warm light grey-green */
  --color-card-bg: #FFFFFF;     /* Pure white for cards */
  --color-text-main: #2C3E30;   /* Deep forest charcoal for main text */
  --color-text-sub: #7A8E7D;    /* Muted sage for subtext */
  
  /* Pikmin Theme Colors */
  --color-primary: #528B62;     /* Grass green */
  --color-primary-light: #EBF3ED;/* Soft mint */
  --color-accent: #E67E22;      /* Nectar orange */
  
  /* Category Colors */
  --color-cat-postcard: #3498DB;/* Postcard: Sky blue */
  --color-cat-adventure: #2ECC71;/* Adventure: Bright green */
  --color-cat-mushroom: #E74C3C; /* Mushroom: Mushroom red */
  
  /* UI Elements */
  --font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 56px;
  --nav-height: 54px;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow-sm: 0 2px 8px rgba(44, 62, 48, 0.08);
  --shadow-md: 0 8px 24px rgba(44, 62, 48, 0.12);
  --shadow-lg: 0 16px 40px rgba(44, 62, 48, 0.18);
}

/* --- Base Resets --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  height: 100vh;
  height: -webkit-fill-available;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

html {
  height: -webkit-fill-available;
}

/* --- App Header --- */
.app-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(220, 228, 222, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  position: relative;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 20px;
}

.header-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

.header-badge {
  background: var(--color-accent);
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 12px;
  animation: pulse 2s infinite;
}

/* --- Main Content Layout --- */
.app-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--header-height) - var(--nav-height));
}

.tab-content {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* --- Map Tab Styles --- */
#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Custom Leaflet Map Pin Styles */
.custom-map-icon {
  background: transparent;
  border: none;
}

.map-pin-wrapper {
  position: relative;
  width: 28px;
  height: 35px;
  display: flex;
  justify-content: center;
}

.map-pin-head {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  background: var(--color-primary);
  transform: rotate(-45deg);
  box-shadow: 0 4px 10px rgba(44, 62, 48, 0.25);
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: var(--transition-smooth);
}

.map-pin-head::after {
  content: '';
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* Category-specific Pin Colors */
.map-pin-wrapper.postcard .map-pin-head {
  background: var(--color-cat-postcard);
}
.map-pin-wrapper.adventure .map-pin-head {
  background: var(--color-cat-adventure);
}
.map-pin-wrapper.mushroom .map-pin-head {
  background: var(--color-cat-mushroom);
}

.map-pin-pulse {
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(44, 62, 48, 0.15);
  border-radius: 50%;
  bottom: -4px;
  left: 7px;
  transform: rotateX(55deg);
  z-index: 1;
  pointer-events: none;
}

.map-pin-pulse::after {
  content: '';
  border-radius: 50%;
  height: 40px;
  width: 40px;
  position: absolute;
  margin: -13px 0 0 -13px;
  animation: map-pulsate 1.8s ease-out infinite;
  opacity: 0;
  box-shadow: 0 0 1px 2px var(--color-primary);
  pointer-events: none;
}

.map-pin-wrapper.postcard .map-pin-pulse::after {
  box-shadow: 0 0 1px 2px var(--color-cat-postcard);
}
.map-pin-wrapper.adventure .map-pin-pulse::after {
  box-shadow: 0 0 1px 2px var(--color-cat-adventure);
}
.map-pin-wrapper.mushroom .map-pin-pulse::after {
  box-shadow: 0 0 1px 2px var(--color-cat-mushroom);
}

@keyframes map-pulsate {
  0% { transform: scale(0.1, 0.1); opacity: 0; }
  50% { opacity: 0.8; }
  100% { transform: scale(1.2, 1.2); opacity: 0; }
}

/* Hover Pin Animation */
.map-pin-wrapper:hover .map-pin-head {
  transform: rotate(-45deg) scale(1.1);
  box-shadow: 0 6px 14px rgba(44, 62, 48, 0.35);
}

/* Leaflet Map Popup Customization */
.leaflet-popup-content-wrapper {
  border-radius: 16px;
  padding: 4px;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: var(--font-family);
}

.map-popup-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 180px;
}

.map-popup-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
}

.map-popup-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-popup-meta {
  font-size: 11px;
  color: var(--color-text-sub);
  display: flex;
  justify-content: space-between;
}

.map-popup-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.btn-popup {
  flex: 1;
  border: none;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-popup-primary {
  background: var(--color-primary);
  color: white;
}

.btn-popup-secondary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* --- Swipe Tab Styles --- */
.swipe-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.card-stack {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: calc(100% - 65px);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Increased height limit for tall screenshots */
.swipe-card {
  position: absolute;
  width: 100%;
  height: 100%;
  max-height: 570px;
  background: var(--color-card-bg);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: grab;
  touch-action: none;
  transform-origin: 50% 100%;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.15), opacity 0.5s ease;
}

.swipe-card:active {
  cursor: grabbing;
}

/* Card image section */
/* Card image section with dark background */
.card-img-box {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #1a221c;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Multi-version image switcher (same location, different postcard versions) */
.img-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.img-nav:active {
  background: rgba(0, 0, 0, 0.65);
}

.img-nav-prev { left: 8px; }
.img-nav-next { right: 8px; }

.img-switcher-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.img-dots {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.img-dot {
  width: 7px;
  height: 7px;
  border: none;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
}

.img-dot.active {
  background: #fff;
  transform: scale(1.15);
}

.img-counter {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.tag-badge.versions {
  background: #5c6bc0;
  color: #fff;
}

.map-popup-img-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.map-popup-img-wrap .map-popup-img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.map-popup-img-wrap .img-nav {
  width: 28px;
  height: 28px;
  font-size: 18px;
}

.gallery-item-versions {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* Swipe Feedback Overlays (Hidden as requested) */
.card-badge-overlay {
  display: none !important;
  position: absolute;
  top: 30px;
  padding: 8px 16px;
  border: 4px solid;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0;
  transform: rotate(-15deg);
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.card-badge-like {
  right: 30px;
  border-color: #2ECC71;
  color: #2ECC71;
  transform: rotate(15deg);
}

.card-badge-dislike {
  left: 30px;
  border-color: #E74C3C;
  color: #E74C3C;
}

/* Card info section */
.card-info-box {
  padding: 20px;
  background: var(--color-card-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.card-tags {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tag-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  color: white;
  text-transform: uppercase;
}

.tag-badge.postcard { background-color: var(--color-cat-postcard); }
.tag-badge.adventure { background-color: var(--color-cat-adventure); }
.tag-badge.mushroom { background-color: var(--color-cat-mushroom); }

.tag-badge-default {
  background-color: var(--color-text-sub);
}

.card-title-row {
  display: flex;
  flex-direction: column;
}

.card-location {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.5px;
}

.card-country {
  font-size: 14px;
  color: var(--color-text-sub);
  font-weight: 500;
}

/* Coordinate display with copy */
.card-coords-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg);
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px dashed rgba(44, 62, 48, 0.15);
}

.coords-text {
  font-family: 'Outfit', monospace;
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
}

.btn-copy-coords {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-copy-coords:active {
  transform: scale(0.95);
  background: var(--color-primary);
  color: white;
}

/* Google Maps Link */
.card-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  align-self: flex-start;
  transition: var(--transition-smooth);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.card-nav-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.card-nav-link:active {
  opacity: 0.7;
}

/* Swipe Minimal Navigation */
.swipe-minimal-nav {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 380px;
  padding: 0 10px;
  margin-top: 10px;
  z-index: 10;
}

.btn-min-nav {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  transition: var(--transition-smooth);
}

.btn-min-nav:active {
  background: var(--color-primary-light);
  transform: scale(0.95);
}

.swipe-counter {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-sub);
  background: white;
  padding: 4px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.btn-control {
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
  background: white;
}

.btn-control svg {
  width: 24px;
  height: 24px;
}

.btn-rewind {
  width: 48px;
  height: 48px;
  color: #F1C40F;
}

.btn-rewind svg { width: 20px; height: 20px; fill: currentColor; }

.btn-dislike {
  width: 58px;
  height: 58px;
  color: #E74C3C;
}
.btn-dislike svg { fill: currentColor; }

.btn-like {
  width: 58px;
  height: 58px;
  color: #2ECC71;
}
.btn-like svg { fill: currentColor; }

.btn-control:active {
  transform: scale(0.9);
  box-shadow: var(--shadow-sm);
}

/* Empty Swipe State */
.swipe-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 16px;
  height: 70vh;
}

.empty-icon {
  font-size: 64px;
  animation: float 3s ease-in-out infinite;
}

.swipe-empty-state h3 {
  font-size: 20px;
  font-weight: 700;
}

.swipe-empty-state p {
  color: var(--color-text-sub);
  font-size: 14px;
  max-width: 280px;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.btn-primary:active {
  transform: scale(0.95);
}

/* --- Gallery Tab Styles --- */
.gallery-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.filter-container {
  background: white;
  padding: 10px 0;
  border-bottom: 1px solid rgba(220, 228, 222, 0.6);
  display: flex;
  flex-direction: column;
  gap: 8px; /* Added gap between rows */
  box-shadow: var(--shadow-sm);
  z-index: 5;
}

.coord-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}

.coord-search-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(44, 62, 48, 0.15);
  border-radius: 10px;
  background: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  padding: 0 12px;
  outline: none;
  transition: var(--transition-smooth);
}

.coord-search-input::placeholder {
  color: #9aa39c;
  font-weight: 400;
}

.coord-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.btn-coord-search,
.btn-coord-clear {
  flex-shrink: 0;
  height: 36px;
  border: none;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
  cursor: pointer;
}

.btn-coord-search {
  background: var(--color-primary);
  color: #fff;
}

.btn-coord-search:active {
  opacity: 0.88;
}

.btn-coord-clear {
  background: rgba(44, 62, 48, 0.08);
  color: var(--color-text-main);
}

/* Sort Dropdown Row */
.sort-row {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.sort-select {
  appearance: none;
  background-color: var(--color-bg);
  border: 1px solid rgba(44, 62, 48, 0.15);
  border-radius: 8px;
  color: var(--color-text-main);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 30px 6px 12px;
  cursor: pointer;
  outline: 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='%232C3E30'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  transition: var(--transition-smooth);
}

.sort-select:hover, .sort-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.header-sort {
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  background-size: 14px;
  background-position: right 6px center;
  max-width: 140px;
}

#country-filters-wrapper,
#category-filters-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 16px;
  position: relative;
}

#country-filters,
#category-filters {
  flex: 1;
}

.filter-toggle-btn {
  display: none; /* Hidden on mobile by default */
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: 8px;
  transition: var(--transition-smooth);
}



.filter-toggle-btn:hover {
  background: var(--color-primary);
  color: white;
}

.filter-row {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.filter-row.dragging-scroll {
  cursor: grabbing;
}

/* Hide scrollbars for Webkit/Firefox */
.scroll-x::-webkit-scrollbar {
  display: none;
}
.scroll-x {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.filter-pill {
  border: 1px solid rgba(44, 62, 48, 0.15);
  background: transparent;
  color: var(--color-text-main);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-pill.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  overflow-y: auto;
}

.gallery-item {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 66.86%; /* Aspect ratio 1023 x 684 (684 / 1023 = ~66.86%) */
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  background: #eee;
}

.gallery-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:active img {
  transform: scale(1.05);
}

.gallery-item-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.gallery-item-badge.postcard { background-color: var(--color-cat-postcard); }
.gallery-item-badge.adventure { background-color: var(--color-cat-adventure); }
.gallery-item-badge.mushroom { background-color: var(--color-cat-mushroom); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  text-align: center;
}

.empty-state p {
  color: var(--color-text-sub);
  font-size: 13px;
}

/* --- Stats & About Tab Styles --- */
.stats-wrapper {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-card {
  background: white;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-num {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary);
}

.stats-label {
  font-size: 12px;
  color: var(--color-text-sub);
  font-weight: 500;
}

.stats-section {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-section h3 {
  font-size: 15px;
  color: var(--color-text-main);
  border-left: 3px solid var(--color-primary);
  padding-left: 8px;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.stats-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.stats-color-dot.postcard { background-color: var(--color-cat-postcard); }
.stats-color-dot.adventure { background-color: var(--color-cat-adventure); }
.stats-color-dot.mushroom { background-color: var(--color-cat-mushroom); }

.stats-name {
  font-weight: 600;
}

.stats-count {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--color-text-main);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 8px;
}

.guide-box {
  background: var(--color-primary-light);
  border: 1px solid rgba(82, 139, 98, 0.15);
}

.guide-box h3 {
  border-left-color: var(--color-primary);
  color: var(--color-primary);
}

.guide-box ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-main);
}

.guide-box code {
  background: white;
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--color-accent);
}

/* --- Sticky Bottom Navigation Bar --- */
.bottom-nav {
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(220, 228, 222, 0.6);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom); /* Fix for iPhone notched devices */
}

.nav-item {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px; /* Decreased gap */
  color: var(--color-text-sub);
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 60px;
}

.nav-item svg {
  width: 18px; /* Slightly smaller SVG */
  height: 18px;
  fill: currentColor;
  transition: var(--transition-smooth);
}

.nav-item span {
  font-size: 9px; /* Slightly smaller text */
  font-weight: 600;
  transition: var(--transition-smooth);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active svg {
  transform: translateY(-2px);
  fill: var(--color-primary);
}

.nav-item.active span {
  font-weight: 700;
}

/* --- Photo Detail Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 62, 48, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.3s ease forwards;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

.btn-close-modal {
  position: absolute;
  top: -48px;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  color: var(--color-text-main);
  z-index: 1001;
}

.btn-close-modal svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Global Toast Notification --- */
.toast-notification {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  opacity: 0;
  background: rgba(44, 62, 48, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 126, 34, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(230, 126, 34, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 126, 34, 0); }
}

/* ==========================================================================
   Desktop Responsive Styles
   ========================================================================== */

/* Tablet: 4 columns */
@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 6px;
  }
}

/* Desktop: Full responsive layout */
@media (min-width: 768px) {
  body {
    overflow: auto;
  }

  .app-header {
    height: 0;
    padding: 0;
    border: none;
    background: transparent;
    overflow: visible;
  }

  .header-logo {
    display: none;
  }

  .header-actions {
    position: absolute;
    top: 12px;
    right: 32px;
    z-index: 105;
  }

  #category-filters-wrapper {
    padding-right: 160px; /* Space for the floating sort button */
  }

  /* Main content fills available space */
  .app-main {
    height: auto;
    min-height: calc(100vh - 56px);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
  }

  .tab-content {
    position: relative;
  }

  .tab-content.active {
    min-height: calc(100vh - 56px);
  }

  /* Map tab */
  #tab-map.active {
    height: calc(100vh - 56px);
  }

  /* Bottom nav becomes a cleaner bar on desktop */
  .bottom-nav {
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 0;
  }

  /* Gallery: 6 columns, smaller images */
  .gallery-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .gallery-item {
    border-radius: 10px;
  }

  .gallery-item-badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* Filter pills row */
  .filter-row {
    padding: 4px 12px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
  }

  .filter-pill {
    font-size: 13px;
    padding: 6px 16px;
  }



  /* Swipe card area centered and constrained */
  .swipe-stack {
    max-width: 450px;
    margin: 0 auto;
  }

  /* Stats grid */
  .stats-grid {
    max-width: 800px;
    margin: 0 auto;
  }

  /* Modal card constrained */
  .modal-card {
    max-width: 500px;
  }

  /* Map popup slightly larger */
  .map-popup-card {
    min-width: 220px;
  }
}

/* Large desktop: 8 columns */
@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    padding: 16px;
  }

  .app-main {
    max-width: 1400px;
  }

  .bottom-nav {
    max-width: 1400px;
  }
}
