/* =============================================================================
   Tourismo Badlands Canada – Map Styles
   ============================================================================= */

.tbca-wrapper {
  --tbca-primary: #1a3b6e;
  --tbca-accent: #3d7adb;
  --tbca-featured-bg: #0e1e36;
  --tbca-text: #1a1a1a;
  --tbca-text-muted: #6b7280;
  --tbca-border: #e5e7eb;
  --tbca-radius: 4px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 20px;
}

/* =============================================================================
   Filter bar
   ============================================================================= */

.tbca-filters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}
.tbca-filters::-webkit-scrollbar {
  display: none;
}

.tbca-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  max-width: 220px;
  height: 100px;
  padding: 18px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition:
    filter 0.2s,
    transform 0.1s;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.tbca-filter-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 0.2s;
}

.tbca-filter-btn span,
.tbca-filter-btn > * {
  position: relative;
  z-index: 1;
}

/* Keep text above pseudo-element */
.tbca-filter-btn {
  isolation: isolate;
}

.tbca-filter-btn:not(.active) {
  filter: brightness(0.85);
}

.tbca-filter-btn.active {
  filter: brightness(1.1);
  z-index: 1;
  transform: scaleY(1.04);
  transform-origin: bottom;
}

.tbca-filter-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

/* --- Category colours --- */
.tbca-cat-the-town {
  background-color: #7a2020;
}
.tbca-cat-the-valley {
  background-color: #2a4f25;
}
.tbca-cat-stargazing {
  background-color: #111e40;
}
.tbca-cat-biker-trails {
  background-color: #6b4615;
}
.tbca-cat-major-events {
  background-color: #926200;
}

/* Fallback for any custom category not listed above */
.tbca-filter-btn:not([class*="tbca-cat-"]) {
  background-color: #1a3b6e;
}

/* Category image backgrounds (assets/img) */
.tbca-cat-the-town {
  background-image: url("../img/town.png");
}
.tbca-cat-the-valley {
  background-image: url("../img/the-valley.png");
}
.tbca-cat-stargazing {
  background-image: url("../img/stargazing.png");
}
.tbca-cat-biker-trails {
  background-image: url("../img/Bike.png");
}
.tbca-cat-major-events {
  background-image: url("../img/majorevents.png");
}

/* =============================================================================
   Two-column layout
   ============================================================================= */

.tbca-content {
  display: flex;
  height: var(--tbca-map-height, 680px);
  border: 1px solid var(--tbca-border);
  border-top: none;
  max-width: 1200px;
  margin: 0 auto;
  -webkit-box-shadow: 0px 0px 7px 3px rgba(0, 0, 0, 0.22);
  box-shadow: 0px 0px 7px 3px rgba(0, 0, 0, 0.22);
}

/* =============================================================================
   Listings panel (left)
   ============================================================================= */

.tbca-panel {
  width: 42%;
  min-width: 280px;
  max-width: 480px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--tbca-border);
  flex-shrink: 0;
}

/* =============================================================================
   Map (right)
   ============================================================================= */

.tbca-map-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.tbca-leaflet-map {
  width: 100%;
  height: 100%;
}

/* =============================================================================
   Loading state
   ============================================================================= */

.tbca-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 200px;
  color: var(--tbca-text-muted);
  font-size: 14px;
}

.tbca-spinner {
  display: block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--tbca-border);
  border-top-color: var(--tbca-accent);
  border-radius: 50%;
  animation: tbca-spin 0.75s linear infinite;
}

@keyframes tbca-spin {
  to {
    transform: rotate(360deg);
  }
}

/* =============================================================================
   Cards (shared)
   ============================================================================= */

.tbca-card {
  padding: 20px 20px;
  border-bottom: 1px solid var(--tbca-border);
  cursor: pointer;
  transition: background 0.12s;
  outline: none;
}

.tbca-card:hover {
  background: #f5f7fb;
}

.tbca-card:focus-visible {
  box-shadow: inset 0 0 0 2px var(--tbca-accent);
}

.tbca-card--active {
  background: #eef3fb !important;
  border-left: 4px solid var(--tbca-accent);
  padding-left: 16px;
}

/* =============================================================================
   Featured card (items tagged "story" → dark background)
   ============================================================================= */

.tbca-card--featured {
  background: var(--tbca-featured-bg);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tbca-card--featured:hover {
  background: #142848;
}

.tbca-card--featured.tbca-card--active {
  background: #1e3a6e !important;
}

.tbca-card--featured .tbca-card__title {
  color: #fff;
}

.tbca-card--featured .tbca-card__address {
  color: rgba(255, 255, 255, 0.6);
}

.tbca-card--featured .tbca-card__desc {
  color: rgba(255, 255, 255, 0.82);
}

/* Thumbnail on dark card – empty state */
.tbca-card--featured .tbca-card__thumb--empty {
  background: rgba(255, 255, 255, 0.08);
}

.tbca-card--featured .tbca-card__thumb--empty::after {
  background: rgba(255, 255, 255, 0.2);
}

/* CTA button */
.tbca-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 9px 22px;
  background: var(--tbca-accent);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    background 0.2s,
    box-shadow 0.2s;
  white-space: nowrap;
}

.tbca-btn:hover {
  background: #2762c8;
  box-shadow: 0 3px 12px rgba(61, 122, 219, 0.4);
}

/* =============================================================================
   Regular card layout
   ============================================================================= */

.tbca-card__inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tbca-card__body {
  flex: 1;
  min-width: 0;
}

.tbca-card__title {
  font-size: 16px;
  font-weight: 800;
  color: var(--tbca-text);
  margin: 0 0 3px;
  line-height: 1.25;
}

.tbca-card__address {
  font-size: 13px;
  color: var(--tbca-text-muted);
  margin: 0 0 8px;
}

.tbca-card__desc {
  font-size: 13px;
  line-height: 1.65;
  color: var(--tbca-text);
  margin: 0;
}

/* Thumbnail */
.tbca-card__thumb {
  width: 96px;
  height: 80px;
  flex-shrink: 0;
  border-radius: var(--tbca-radius);
  overflow: hidden;
  background: #d8dfec;
  order: 2;
}

.tbca-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Empty thumbnail mountain silhouette */
.tbca-card__thumb--empty {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #c9d3e8;
  padding-bottom: 6px;
}

.tbca-card__thumb--empty::after {
  content: "";
  display: block;
  width: 58px;
  height: 40px;
  background: #9aaac4;
  clip-path: polygon(0 100%, 30% 30%, 50% 55%, 70% 18%, 100% 60%, 100% 100%);
}

/* Empty state */
.tbca-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--tbca-text-muted);
  font-size: 14px;
}

/* =============================================================================
   Map marker & popup
   ============================================================================= */

.tbca-marker {
  background: transparent !important;
  border: none !important;
}

.tbca-marker svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.15s;
}

.tbca-marker--active svg {
  transform: scale(1.3);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}

.tbca-popup {
  min-width: 190px;
  max-width: 220px;
  padding: 12px;
  box-sizing: border-box;
}
.gm-style-iw-ch {
  padding-top: 0 !important;
}

.tbca-popup__body {
  padding: 0;
}

.tbca-popup__img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  margin-bottom: 8px;
}

.tbca-popup__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--tbca-text);
  margin-bottom: 3px;
}

.tbca-popup__title a {
  color: var(--tbca-accent);
  text-decoration: none;
}

.tbca-popup__title a:hover {
  text-decoration: underline;
}

.tbca-popup__address {
  display: block;
  font-size: 12px;
  color: var(--tbca-text-muted);
}

/* Reset Google Maps InfoWindow padding */
.gm-style-iw-c,
.gm-style-iw-d {
  padding: 0 !important;
  overflow: hidden !important;
}

/* Hide Google Maps InfoWindow close button */
.gm-ui-hover-effect {
  display: none !important;
}

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  border-radius: var(--tbca-radius) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
}

.leaflet-popup-tip-container {
  margin-top: -1px;
}

/* =============================================================================
   Dark theme overrides
   ============================================================================= */

.tbca-theme-dark {
  --tbca-featured-bg: #111c32;
  --tbca-text: #e2e8f0;
  --tbca-text-muted: #64748b;
  --tbca-border: #1e2d45;
  --tbca-accent: #3d7adb;
}

/* Hide filter nav for dark theme */
.tbca-theme-dark .tbca-filters {
  display: none;
}

.tbca-theme-dark .tbca-content {
  border-color: var(--tbca-border);
}

.tbca-theme-dark .tbca-panel {
  background: #131e35;
  border-right: 1px solid var(--tbca-border);
}

.tbca-theme-dark .tbca-card {
  background: transparent;
  border-bottom: 1px solid var(--tbca-border);
  padding: 22px 20px;
}

.tbca-theme-dark .tbca-card:hover {
  background: #1a2640;
}

.tbca-theme-dark .tbca-card--active {
  background: #1e3055 !important;
  border-left: 4px solid var(--tbca-accent);
  padding-left: 16px;
}

.tbca-theme-dark .tbca-card__title {
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.tbca-theme-dark .tbca-card__address {
  color: #475569;
}

.tbca-theme-dark .tbca-card__desc {
  color: #94a3b8;
  font-size: 13px;
}

.tbca-theme-dark .tbca-card__thumb {
  border-radius: 6px;
}

.tbca-theme-dark .tbca-card__thumb--empty {
  background: #1a2840;
}

.tbca-theme-dark .tbca-card__thumb--empty::after {
  background: #2a3f5e;
}

.tbca-theme-dark .tbca-loading {
  color: #475569;
}

.tbca-theme-dark .tbca-spinner {
  border-color: #1e293b;
  border-top-color: var(--tbca-accent);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 860px) {
  .tbca-content {
    flex-direction: column;
    height: auto;
  }

  .tbca-panel {
    width: 100%;
    max-width: 100%;
    max-height: 380px;
    border-right: none;
    border-bottom: 1px solid var(--tbca-border);
  }

  .tbca-map-wrap {
    flex: none;
    width: 100%;
    height: 400px;
  }

  /* Card content wrapping around image */
  .tbca-card__inner {
    display: block;
  }

  .tbca-card__inner::after {
    content: "";
    display: table;
    clear: both;
  }

  .tbca-card__thumb {
    float: right;
    margin-left: 14px;
    margin-bottom: 8px;
  }

  /* 3 and 2 Filter layout */
  .tbca-filters {
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 10px;
  }

  /* 3 items on the first row */
  .tbca-filter-btn {
    flex: 1 1 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
    min-width: 0; /* Override generic min-width */
    height: 80px;
    font-size: 13px;
    padding: 10px 6px;
  }

  /* 2 items on the second row (the 4th and 5th items) */
  .tbca-filter-btn:nth-child(4),
  .tbca-filter-btn:nth-child(5) {
    flex: 1 1 calc(50% - 8px);
    max-width: calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  .tbca-filter-btn {
    height: 70px;
    font-size: 11px;
    padding: 8px 4px;
  }
}
