/* ═══════════════════════════════════════════
   ST. BARTHS SPORTS DIRECTORY — App Theme
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ocean-deep: #0c4a6e;
  --ocean: #0369a1;
  --ocean-light: #0ea5e9;
  --turquoise: #06b6d4;
  --turquoise-light: #67e8f9;
  --coral: #f97316;
  --coral-light: #fdba74;
  --sand: #fef3c7;
  --sand-light: #fffbeb;
  --white: #ffffff;
  --text-dark: #0f172a;
  --text: #1e293b;
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.3);
  --card-shadow: 0 4px 24px rgba(12, 74, 110, 0.1);
  --card-shadow-hover: 0 8px 40px rgba(12, 74, 110, 0.18);
  --radius: 16px;
  --radius-sm: 12px;
}

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

a, button {
  touch-action: manipulation;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f2fe 0%, #cffafe 30%, #fef3c7 70%, #ffedd5 100%);
  background-attachment: fixed;
}

/* ─── HEADER ─── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid var(--glass-border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ocean-deep);
  letter-spacing: -0.01em;
}

.logo-text span {
  color: var(--turquoise);
  font-weight: 600;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ocean);
  padding: 8px 16px;
  border-radius: 9999px;
  transition: all 0.2s;
}

.nav-link:hover {
  background: var(--ocean);
  color: white;
}

/* ─── HERO ─── */
.hero {
  text-align: center;
  padding: 48px 24px 12px;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--ocean-deep) 0%, var(--ocean) 50%, var(--turquoise) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  margin-top: 10px;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ─── STATS BAR ─── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 24px 0;
  max-width: 600px;
  margin: 0 auto;
}

.stat {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat strong {
  color: var(--ocean);
  font-weight: 700;
}

.stat-dot {
  color: var(--turquoise-light);
  font-weight: 700;
}

/* ─── SEARCH ─── */
.search-wrapper {
  max-width: 580px;
  margin: 24px auto 16px;
  padding: 0 24px;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--turquoise);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 16px 48px 16px 52px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid transparent;
  border-radius: 9999px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
  outline: none;
  transition: all 0.3s;
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.search-input:focus {
  border-color: var(--turquoise);
  box-shadow: var(--card-shadow-hover), 0 0 0 4px rgba(6, 182, 212, 0.15);
}

.search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: none;
  font-size: 1.2rem;
  line-height: 1;
}

.search-clear.visible {
  display: block;
}

/* ─── FILTER CHIPS ─── */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 24px;
  max-width: 700px;
  margin: 0 auto 32px;
}

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

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1.5px solid rgba(12, 74, 110, 0.12);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s;
  cursor: pointer;
}

.filter-chip:hover {
  background: var(--ocean);
  color: white;
  border-color: var(--ocean);
}

.filter-chip:active {
  transform: scale(0.95);
  background: var(--ocean-deep);
  color: white;
  border-color: var(--ocean-deep);
}

/* ─── SECTION TITLES ─── */
.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ocean);
  margin-bottom: 20px;
  padding: 0 24px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── CATEGORY GRID ─── */
.categories-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-decoration: none;
  color: var(--text);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--turquoise-light);
  background: rgba(255, 255, 255, 0.9);
}

.category-card:active {
  transform: scale(0.97);
}

.category-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.category-name {
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-dark);
}

.category-count {
  font-size: 0.8rem;
  color: var(--turquoise);
  font-weight: 500;
}

/* ─── LISTINGS GRID ─── */
.listings-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.listing-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
}

.listing-card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--turquoise-light);
}

.listing-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.listing-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.listing-detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.listing-detail svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--turquoise);
}

.listing-detail a {
  color: var(--ocean);
  text-decoration: none;
  transition: color 0.2s;
  word-break: break-all;
}

.listing-detail a:hover {
  color: var(--coral);
}

.listing-description {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* ─── QUICK ACTION BUTTONS ─── */
.listing-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
  min-height: 44px;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.action-btn--call {
  background: #dcfce7;
  color: #15803d;
}

.action-btn--call:hover {
  background: #bbf7d0;
}

.action-btn--call:active {
  background: #15803d;
  color: white;
  transform: scale(0.96);
}

.action-btn--email {
  background: #dbeafe;
  color: #1d4ed8;
}

.action-btn--email:hover {
  background: #bfdbfe;
}

.action-btn--email:active {
  background: #1d4ed8;
  color: white;
  transform: scale(0.96);
}

.action-btn--web {
  background: #ffedd5;
  color: #c2410c;
}

.action-btn--web:hover {
  background: #fed7aa;
}

.action-btn--web:active {
  background: #c2410c;
  color: white;
  transform: scale(0.96);
}

/* ─── CATEGORY PAGE HEADER ─── */
.page-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--ocean);
  text-decoration: none;
  margin-bottom: 24px;
  padding: 8px 0;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--coral);
}

.page-header-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-header-icon {
  font-size: 3rem;
  line-height: 1;
}

.page-header-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
}

.page-header-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-header-count {
  font-size: 0.875rem;
  color: var(--turquoise);
  font-weight: 500;
  margin-top: 16px;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 1rem;
}

.empty-suggestions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.empty-suggestions a {
  padding: 8px 16px;
  border-radius: 9999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--ocean);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.empty-suggestions a:hover,
.empty-suggestions a:active {
  background: var(--ocean);
  color: white;
}

/* ─── FOOTER ─── */
.footer {
  text-align: center;
  padding: 40px 24px;
  margin-top: 60px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── BOTTOM NAV (mobile only) ─── */
.bottom-nav {
  display: none;
}

/* ─── SCROLL TO TOP ─── */
.scroll-top-btn {
  position: fixed;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--ocean-deep);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(12, 74, 110, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  bottom: 24px;
  right: 24px;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-top-btn:active {
  transform: scale(0.9);
}

/* ─── SEARCH RESULTS ─── */
.search-results {
  display: none;
}

.search-results.active {
  display: block;
}

.search-results .section-title {
  margin-top: 12px;
}

/* ─── CATEGORY BADGE (search results) ─── */
.listing-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--turquoise), var(--ocean-light));
  color: white;
  margin-bottom: 8px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: 72px;
  }

  .hero {
    padding: 28px 20px 8px;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .stats-bar {
    gap: 10px;
    padding: 8px 20px 0;
  }

  .stat {
    font-size: 0.78rem;
  }

  .search-wrapper {
    padding: 0 20px;
    margin: 16px auto 12px;
  }

  .filter-chips {
    padding: 0 20px;
    margin-bottom: 24px;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 16px;
  }

  .listings-grid {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }

  .category-card {
    padding: 20px 12px;
  }

  .category-icon {
    font-size: 2rem;
  }

  .page-header {
    padding: 20px 16px;
  }

  .page-header-title {
    font-size: 1.5rem;
  }

  .page-header-icon {
    font-size: 2.5rem;
  }

  .listing-card {
    padding: 20px;
  }

  .action-btn {
    padding: 12px 10px;
    font-size: 0.8rem;
  }

  /* Hide desktop nav on mobile */
  .nav-link {
    display: none;
  }

  /* Bottom nav visible */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    justify-content: space-around;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 20px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.15s;
    border-radius: 8px;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
  }

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

  .bottom-nav-item:active {
    color: var(--ocean);
    transform: scale(0.92);
  }

  .footer {
    margin-bottom: 12px;
    margin-top: 40px;
  }

  .scroll-top-btn {
    bottom: 84px;
    right: 16px;
  }

  /* Back link bigger touch target */
  .back-link {
    padding: 10px 0;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 20px 16px 4px;
  }

  .hero h1 {
    font-size: 1.55rem;
  }

  .search-wrapper {
    padding: 0 16px;
    margin: 12px auto 8px;
  }

  .filter-chips {
    padding: 0 16px;
    margin-bottom: 20px;
  }

  .header-inner {
    padding: 12px 16px;
  }

  .categories-grid {
    gap: 8px;
  }

  .category-card {
    padding: 16px 10px;
    gap: 6px;
  }

  .category-icon {
    font-size: 1.75rem;
  }

  .category-name {
    font-size: 0.85rem;
  }
}

/* ─── ANIMATIONS ─── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-card,
.listing-card {
  animation: fadeInUp 0.4s ease both;
}

.categories-grid .category-card:nth-child(1) { animation-delay: 0s; }
.categories-grid .category-card:nth-child(2) { animation-delay: 0.03s; }
.categories-grid .category-card:nth-child(3) { animation-delay: 0.06s; }
.categories-grid .category-card:nth-child(4) { animation-delay: 0.09s; }
.categories-grid .category-card:nth-child(5) { animation-delay: 0.12s; }
.categories-grid .category-card:nth-child(6) { animation-delay: 0.15s; }
.categories-grid .category-card:nth-child(7) { animation-delay: 0.18s; }
.categories-grid .category-card:nth-child(8) { animation-delay: 0.21s; }
.categories-grid .category-card:nth-child(9) { animation-delay: 0.24s; }
.categories-grid .category-card:nth-child(10) { animation-delay: 0.27s; }
.categories-grid .category-card:nth-child(11) { animation-delay: 0.30s; }
.categories-grid .category-card:nth-child(12) { animation-delay: 0.33s; }
.categories-grid .category-card:nth-child(13) { animation-delay: 0.36s; }
.categories-grid .category-card:nth-child(14) { animation-delay: 0.39s; }
.categories-grid .category-card:nth-child(15) { animation-delay: 0.42s; }
.categories-grid .category-card:nth-child(16) { animation-delay: 0.45s; }
