/* City Cards — Modern 2030 Edition */
/* Premium collectible experience. Clean, spacious, tactile. Baseball cards reimagined with modern luxury materials. */

:root {
  /* Conservative Pantone Blue + White + Complements - Modern iOS Era */
  --system-background: #ffffff;
  --secondary-system-background: #ffffff;
  --tertiary-system-background: #f8f9fa;
  --system-grouped-background: #f8f9fa;
  --label: #1a1a2e;
  --secondary-label: #4a4a5a;
  --tertiary-label: #6b7280;
  --separator: #e5e7eb;
  --system-blue: #003087; /* Pantone-inspired deep conservative blue */
  --system-red: #c8102e; /* complementary accent */
  --system-gray: #6b7280;
  --thin-material: rgba(255,255,255,0.95);
  --regular-material: rgba(248,249,250,0.9);
  --ultra-thin-material: rgba(255,255,255,0.98);

  /* App theme - Conservative Navy Blue palette with white + gold complements */
  --accent: #003087; /* main Pantone blue */
  --accent-2: #c5a46e; /* gold complement */
  --primary: #001f5b; /* deep navy */
  --card-border: #d1d5db;
  --shadow: 0 4px 12px rgba(0, 31, 91, 0.08);
  --shadow-strong: 0 10px 24px rgba(0, 31, 91, 0.12);

  /* Sizing - responsive & proportional for ALL iOS models (SE ~375px to Pro Max ~430px+)
     Uses fluid clamps, safe-area-inset, and consistent 8pt grid for best design */
  --card-height: clamp(240px, 52vh, 310px); /* balanced for front teaser + back content */
  --card-front-img: 48%; /* ~50% image for visual impact without crowding */
  --radius-lg: 16px;
  --radius-md: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* Apple HIG compliant */
  --min-touch: 44px;
  --font-base: clamp(15px, 3.8vw, 17px);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  font-size: var(--font-base);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  /* Better momentum scrolling on iOS simulator and devices */
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

/* Global safe area & responsive padding for all models */
body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); /* for fixed tab bar */
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* iPhone specific proportions - smaller models tighter, larger more spacious */
@media (max-width: 390px) { /* iPhone SE, 12 mini etc. */
  :root {
    --card-height: clamp(220px, 48vh, 280px);
    --card-front-img: 45%;
  }
  .card-grid { gap: 12px; }
}

@media (min-width: 430px) { /* Pro Max models */
  :root {
    --card-height: clamp(270px, 55vh, 330px);
    --card-front-img: 52%;
  }
  .container { padding: 0 20px; }
}

body {
  background: var(--system-background);
  color: var(--label);
  min-height: 100vh;
  overflow-y: auto;
  /* padding-bottom handled by earlier rule + section padding for tab bar */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

body.dark {
  --system-background: #0a0c14;
  --secondary-system-background: #11151f;
  --tertiary-system-background: #1a1f2e;
  --system-grouped-background: #0a0c14;
  --label: #f1f3f7;
  --secondary-label: #a3aab8;
  --tertiary-label: #6b7280;
  --separator: #2a3142;
  --thin-material: rgba(17,21,31,0.95);
  --regular-material: rgba(17,21,31,0.9);
  --ultra-thin-material: rgba(17,21,31,0.98);
  --accent: #3a6ea5; /* softer blue for dark */
  --primary: #001f5b;
  --card-border: #2a3142;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-strong: 0 10px 24px rgba(0, 0, 0, 0.5);
}

/* Fill the notch/status bar area (iPhone 17 Pro Max) with iOS black for clean separation */
html {
  background: #000000;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px;
  /* Ensure the main content area supports free scrolling */
  min-height: calc(100vh - 120px); /* approximate header + tab */
}

#theme-toggle {
  font-size: 1rem;
  padding: 4px 8px;
}

* {
  box-sizing: border-box;
}

/* ===== Modern Header (simplified for collections) ===== */
header {
  background: var(--thin-material);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--label);
  padding: 10px 16px;
  /* Header scrolls with content (not sticky) for natural feel. */
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--separator);
  min-height: 52px; /* consistent height with logo */
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo img {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

nav a {
  color: var(--secondary-label);
  text-decoration: none;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all .15s ease;
}

nav a:hover {
  background: var(--tertiary-system-background);
  color: var(--primary);
}

nav a.my-collection-link {
  color: var(--accent);
  font-weight: 600;
}

/* Action buttons - compact 2026 */
.small-btn, .btn {
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease, box-shadow .15s ease;
  min-height: 28px;
}

.small-btn {
  font-size: 0.82rem;
  padding: 6px 12px;
  background: var(--system-grouped-background);
  color: var(--label);
  border-radius: 999px;
  border: 0.5px solid var(--separator);
  font-weight: 500;
}

.small-btn:hover {
  background: var(--tertiary-system-background);
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 31, 91, 0.2);
  transition: all .15s ease;
}

.btn:hover {
  background: #00205b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 31, 91, 0.25);
}

.btn-secondary {
  background: var(--system-grouped-background);
  color: var(--label);
  border: 0.5px solid var(--separator);
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.hero {
  background: linear-gradient(135deg, #3b4cca 0%, #1c2541 50%, #0d132b 100%);
  color: #ffcb05;
  padding: 24px 16px 18px;
  text-align: center;
  border-radius: 0 0 20px 20px;
}

.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 2px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffcb05;
}

.hero .tagline {
  font-size: 1rem;
  opacity: 0.95;
  margin: 0 0 6px;
  font-weight: 400;
  color: #c5d0ff;
}

.hero .stats {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  color: #fff;
}

.section-title {
  font-size: 1.25rem;
  margin: 16px 0 8px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--label);
}

/* Modern Title (large title iOS feel) */
#collection-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--primary);
  margin: 4px 0 2px;
}

/* ===== Card Grid - prominent, spacious */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 28px;
  padding: 10px 0;
  /* Allow natural sizing and better scroll in simulator */
  align-items: start;
  touch-action: pan-y;
}

/* Best-app skeleton loaders (instant perceived speed, modern apps like Linear/Apple) */
.card-skeleton {
  border-radius: 18px;
  overflow: hidden;
  background: var(--system-grouped-background);
  border: 1px solid var(--separator);
  height: var(--card-height);
  animation: skeletonPulse 1.2s ease-in-out infinite;
}
.skeleton-img {
  height: 52%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s infinite;
}
.skeleton-body {
  padding: 14px 16px;
}
.skeleton-line {
  height: 12px;
  background: #e8e8e8;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-30 { width: 30%; }

@keyframes skeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (min-width: 620px) or (orientation: landscape) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Custom City Cards Template - Clean Modern Design ===== */
.card {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  perspective: 1600px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-lg);
  will-change: transform;
  contain: layout style paint;
}

.card-inner {
  position: relative;
  width: 100%;
  height: var(--card-height);
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: var(--radius-lg);
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0, 31, 91, 0.08);
}

.card-front {
  display: flex;
  flex-direction: column;
}

.card-front img {
  width: 100%;
  height: var(--card-front-img, 48%);
  min-height: 110px;
  object-fit: cover;
  display: block;
  background: #f1f3f7;
  transition: transform 0.35s ease;
}

.card:hover .card-front img {
  transform: scale(1.01);
}

.card-info {
  padding: clamp(10px, 3vw, 14px) clamp(12px, 4vw, 16px) clamp(8px, 2.5vw, 12px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--font-base);
}

.card-name {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0 0 4px;
  line-height: 1.15;
  letter-spacing: -0.35px;
  color: var(--primary);
}

.card-location {
  font-size: 0.82rem;
  color: var(--secondary-label);
  line-height: 1.3;
}

.rating-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--label);
  margin: 2px 0 4px;
}

.rating-row .star {
  color: #f59e0b;
  font-size: 0.9rem;
}

.distance-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  line-height: 1.1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card-stats-mini {
  font-size: 0.74rem;
  color: var(--tertiary-label);
  margin-top: 2px;
  font-weight: 500;
}

.category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Custom Back - Straight to the point, clean formatting (Wallet / grouped list inspired) */
.card-back {
  transform: rotateY(180deg);
  padding: 12px 14px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 100%;
  background: #ffffff;
  line-height: 1.3;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--card-border);
  gap: 6px;
}

.card-back::-webkit-scrollbar {
  display: none;
}

.card-header {
  text-align: center;
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--separator);
  cursor: pointer;
}

.card-header:hover {
  opacity: 0.85;
}

.card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.card-header .card-meta {
  font-size: 0.72rem;
  color: var(--secondary-label);
  letter-spacing: 0.4px;
}

/* Clean stats (grouped, airy) */
.box-score {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: var(--system-grouped-background);
  padding: 8px 6px;
  border-radius: 10px;
  margin-bottom: 6px;
  border: 0.5px solid var(--separator);
}

.box-score .stat {
  text-align: center;
  font-size: 0.72rem;
  padding: 2px 0;
}

.box-score .stat-label {
  display: block;
  font-size: 0.58rem;
  color: var(--tertiary-label);
  margin-bottom: 1px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.box-score .stat-value {
  display: block;
  font-weight: 700;
  color: var(--label);
  font-size: 0.82rem;
}

/* Highlights - clean */
.highlights {
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.highlights strong {
  font-size: 0.72rem;
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 0.5px solid var(--separator);
}

.highlights ul {
  margin: 0;
  padding-left: 14px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.highlights li {
  position: relative;
  padding-left: 8px;
  line-height: 1.25;
}

.highlights li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.patron-info {
  font-size: 0.78rem;
  line-height: 1.35;
  margin-bottom: 4px;
  color: var(--label);
  padding: 4px 0;
}

/* Actions - clear usable buttons (HIG friendly) */
.collect-zone {
  margin-top: auto;
  padding-top: 8px;
  border-top: 0.5px solid var(--separator);
}

.save-btn {
  width: 100%;
  padding: 10px 0;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--system-grouped-background);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 8px;
  min-height: 40px;
}

.save-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

.save-btn.saved {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
}

.quick-actions button {
  flex: 1 1 calc(33% - 4px);
  min-width: 58px;
  padding: 8px 6px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 0.5px solid var(--separator);
  border-radius: 8px;
  background: var(--system-grouped-background);
  color: var(--label);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.1s ease;
  text-align: center;
  white-space: nowrap;
}

.quick-actions button:hover,
.quick-actions button:active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* New clean Action Rollup on card back (URL + Reservation + Directions) */
.action-rollup {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rollup-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rollup-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--tertiary-label);
  padding-left: 2px;
}

.rollup-btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  border: 0.5px solid var(--separator);
  background: var(--system-grouped-background);
  color: var(--label);
  cursor: pointer;
  min-height: 36px;
  text-align: center;
}

.rollup-btn.primary {
  border-color: var(--accent);
  font-weight: 700;
}

.rollup-btn:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.direction-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.dir-btn {
  padding: 6px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 6px;
  border: 0.5px solid var(--separator);
  background: var(--system-grouped-background);
  color: var(--label);
  cursor: pointer;
  min-height: 30px;
  text-align: center;
}

.dir-btn:active {
  background: var(--accent);
  color: #fff;
}

.quick-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.mini-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 0.5px solid var(--separator);
  background: var(--system-grouped-background);
  color: var(--label);
  min-height: 30px;
}

.mini-btn:active {
  background: var(--accent);
  color: #fff;
}

.flip-hint {
  font-size: 0.65rem;
  color: var(--tertiary-label);
  text-align: center;
  margin-top: 4px;
  font-style: italic;
}

/* Clean tabs at the bottom of each card back */
.card-back-tabs {
  display: flex;
  border-top: 0.5px solid var(--separator);
  margin-top: auto;
  padding-top: 4px;
  gap: 2px;
}

.back-tab {
  flex: 1;
  padding: 6px 2px;
  font-size: 0.7rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--secondary-label);
  border-radius: 4px;
  cursor: pointer;
  transition: all .1s ease;
}

.back-tab.active {
  background: var(--accent);
  color: #fff;
}

.back-main {
  flex: 1;
  min-height: 60px;
  overflow: auto;
}

.back-action {
  text-align: center;
  padding: 8px 0;
}

.back-action-btn,
.dir-btn,
.mini-btn,
.back-tab {
  min-height: var(--min-touch);
  font-size: clamp(0.75rem, 3.5vw, 0.85rem);
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: var(--system-grouped-background);
  color: var(--label);
  cursor: pointer;
  transition: all 0.1s ease;
}

.back-action-btn {
  width: 100%;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
}

/* ===== Search (Modern) ===== */
.search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--separator);
  border-radius: 14px;
  background: var(--secondary-system-background);
  margin-bottom: 6px;
  outline: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  transition: box-shadow .15s, border .15s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.search-wrapper {
  position: relative;
}

.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--system-grouped-background);
}

.suggestion-item:hover {
  background: var(--system-grouped-background);
}

.suggestion-item .type {
  font-size: 0.72rem;
  color: var(--secondary-label);
  margin-left: 8px;
}

/* Quick simple filter chips */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  padding: 8px 12px;
  border: none;
  background: var(--system-grouped-background);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .1s ease;
  color: var(--label);
  min-height: 36px;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
}

.filter-btn:hover:not(.active) {
  background: var(--tertiary-system-background);
}

/* ===== Simple Quick Design for Collections ===== */
.simple-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.simple-top h1 {
  font-size: 1.6rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.simple-actions {
  display: flex;
  gap: 8px;
}

.simple-near-btn,
.simple-btn {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 0.5px solid var(--separator);
  background: var(--system-grouped-background);
  color: var(--label);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.simple-near-btn:active {
  background: var(--accent);
  color: #fff;
}

.container > .search-wrapper {
  margin-bottom: 12px;
}

.search-input {
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 12px;
}

/* City sort integrated into sort-section now */
.city-sort-bar { display: none; } /* legacy hidden for cleaner UI */

/* Map - subtle, secondary */
.map-container {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 0.5px solid var(--separator);
  opacity: 0.85;
}

.map-title {
  font-size: 0.65rem;
  color: var(--tertiary-label);
  text-align: center;
  margin-bottom: 3px;
}

#us-map {
  max-height: 80px;
  display: block;
}

/* Simple flat quick chips */
.state-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.state-bar::-webkit-scrollbar {
  display: none;
}

.state-btn {
  padding: 8px 14px;
  border: none;
  background: var(--system-grouped-background);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .1s ease;
  min-height: 38px;
  color: var(--label);
  flex-shrink: 0;
}

.state-btn.active {
  background: var(--accent);
  color: #fff;
}

.state-btn:hover:not(.active) {
  background: var(--tertiary-system-background);
}

.city-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 8px;
}

.city-bar::-webkit-scrollbar {
  display: none;
}

.city-chip {
  padding: 7px 12px;
  border: none;
  background: var(--system-grouped-background);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--label);
  flex-shrink: 0;
  min-height: 34px;
}

.city-chip small {
  font-weight: 400;
  opacity: 0.7;
  margin-left: 4px;
}

.city-chip.active {
  background: var(--accent);
  color: #fff;
}

.city-mini-card {
  min-width: 100px;
  max-width: 120px;
  background: var(--system-grouped-background);
  border: 0.5px solid var(--separator);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s;
  scroll-snap-align: start;
  text-align: left;
  overflow: hidden;
}

.city-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,31,91,0.1);
}

.city-mini-card.active {
  border-color: var(--primary);
  background: var(--thin-material);
}

.mini-card-inner {
  padding: 8px 10px;
}

/* New sections for improved workflow */
#discover-section,
#my-deck-section, #trips-section, #profile-section {
  padding-bottom: 90px; /* extra space for tab bar + comfortable scrolling */
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  /* Help free scrolling in simulator / WebView */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0 8px;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mini-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

#deck-stats, #profile-stats {
  background: var(--system-grouped-background);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  margin: 2px;
}

.trip-card {
  border: 1px solid var(--separator);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--system-grouped-background);
}

.mini-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.mini-img {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 4px;
}

.mini-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--label);
  line-height: 1.05;
}

.mini-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--secondary-label);
}

.mini-desc {
  font-size: 0.62rem;
  color: var(--tertiary-label);
  margin-top: 2px;
}

.city-teaser {
  background: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}

.city-teaser:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.city-teaser strong {
  font-size: 1.1rem;
  display: block;
  margin-bottom: 5px;
  color: var(--primary);
}

.city-teasers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.filter-btn[data-filter="saved"].active,
.filter-btn[data-filter="saved"]:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Simple quick sort */
.price-filter,
.sort-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.price-filter button,
.sort-bar button,
.sort-card-btn {
  border: none;
  background: var(--system-grouped-background);
  border-radius: 6px;
  padding: 6px 11px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--label);
  transition: all .1s ease;
  min-height: 32px;
  white-space: nowrap;
  flex-shrink: 0;
}

.price-filter button.active,
.sort-bar button.active,
.sort-card-btn.active {
  background: var(--accent);
  color: white;
}

/* My Collection Summary */
#my-collection-summary {
  background: transparent;
  font-size: 0.8rem;
  color: var(--secondary-label);
  margin-bottom: 10px;
  padding: 4px 0;
  line-height: 1.3;
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 0.72rem;
  color: var(--label);
  margin-bottom: 8px;
}

/* Business + Footer */
.business-section {
  background: var(--secondary-system-background);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 20px 0;
}

.business-section h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

footer {
  text-align: center;
  padding: 18px 14px 22px;
  font-size: 0.75rem;
  color: var(--secondary-label);
  border-top: 0.5px solid var(--separator);
  margin-top: 20px;
}

/* ===== Modern 2030 Toast ===== */
.toast-container {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom, 18px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--primary);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-strong);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 220ms cubic-bezier(0.23,1,0.32,1) forwards;
  max-width: 88vw;
  border: 1px solid rgba(255,255,255,0.1);
}

.toast.success { background: #166534; }
.toast.info { background: #1e3358; }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== iOS Bottom Sheets (native .sheet style) ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2500;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-content {
  background: var(--secondary-system-background);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 100%;
  padding: 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  border: none;
  position: relative;
  animation: sheetSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 5px;
  background: var(--system-gray);
  border-radius: 3px;
  z-index: 10;
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal h3 {
  margin: 24px 0 12px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.modal textarea,
.modal input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--system-grouped-background);
  color: var(--label);
  box-sizing: border-box;
}

.modal .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal button {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal .primary {
  background: var(--accent);
  color: white;
}

.modal .cancel {
  background: var(--system-grouped-background);
  color: var(--label);
  border: 1px solid var(--separator);
}

/* ===== iOS Simulator / Mobile 2026 Best App Overrides ===== */
@media (max-width: 480px) {
  :root {
    --card-height: 270px;
  }
  body { font-size: 16px; }
  .container { padding: 0 14px; }
  header { padding: 12px 16px; min-height: 56px; }
  .card-front img { min-height: 105px; }
  .card-info { padding: 10px 12px 8px; }
  .card-name { font-size: 0.98rem; }
  .state-btn, .filter-btn, .sort-btn, .price-filter button, .sort-bar button, .sort-card-btn { font-size: 0.76rem; padding: 6px 10px; min-height: 30px; }
  .city-mini-card { min-width: 76px; max-width: 90px; }
  .mini-img { width: 17px; height: 17px; }
  .mini-title { font-size: 0.72rem; }
  #us-map { max-height: 108px; }
  .map-container { padding-top: 4px; }
  .search-input { padding: 9px 13px; font-size: 0.92rem; }
  .action-row { gap: 6px; margin-bottom: 6px; }
  .location-filters { padding: 6px 8px; margin-bottom: 6px; }
  .card-grid { gap: 10px; margin-bottom: 12px; }
  .card { border-radius: 18px; }
  footer { padding: 16px 12px 20px; font-size: 0.72rem; }
  .quick-actions button { font-size: 0.72rem; padding: 6px 3px; min-height: 30px; white-space: nowrap; }
  .card-back { font-size: 0.8rem; padding: 8px 10px; }
}

@supports (-webkit-touch-callout: none) {
  /* Extra iOS WebView tweaks */
  html, body { -webkit-text-size-adjust: 100%; }
  .card-inner { transition: transform 420ms cubic-bezier(0.25, 0.1, 0.25, 1); }
}

/* ===== iOS Bottom Tab Bar (Native UITabBar style, 56pt + safe) ===== */
/* Bottom Navigation - Professional workflow tabs */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--thin-material);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--separator);
  display: flex;
  z-index: 300;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--system-gray);
  font-size: 10.5px;
  padding: 0;
  min-height: 44px;
  transition: color .1s ease;
}

.tab-item.active {
  color: var(--accent);
}

.tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
  line-height: 1;
}

.tab-label {
  font-weight: 600;
  letter-spacing: -0.1px;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--system-gray);
  font-size: 10.5px;
  padding: 0;
  min-height: 44px;
  transition: color .1s ease;
}

.tab-item.active {
  color: var(--accent);
}

.tab-icon {
  font-size: 23px;
  margin-bottom: 2px;
  line-height: 1;
}

.tab-label {
  font-weight: 600;
  letter-spacing: -0.1px;
}

/* Toolbar - subtle modern actions */
.toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 0 12px;
  margin-bottom: 8px;
}

.toolbar-btn {
  padding: 8px 14px;
  background: var(--system-grouped-background);
  color: var(--label);
  border: 0.5px solid var(--separator);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.toolbar-btn:active {
  opacity: 0.8;
}

/* Pull-to-refresh indicator (iOS native feel) */
#pull-refresh {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--system-gray);
  font-size: 0.95rem;
  transition: opacity .2s;
}

#pull-refresh.active {
  color: var(--accent);
}