/* Critical fixes for groupset/trip detail pages */
/* These were previously only in the Django template inline <style> */

/* ── Trip action buttons ── */
.blog-post .trip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: flex-end;
}

/* ── Map filter bar ── */
.map-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
  gap: 4px;
}

/* ── Mobile layout fixes ── */
@media (max-width: 767px) {
  .inner-block {
    padding: 40px 0;
  }
  .inner-block:first-child {
    padding-top: 50px;
  }
  .blog-post h1 {
    font-size: 28px;
  }
  /* Trail stats: 2x2 grid on mobile */
  .blog-post .ui.statistics {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 0;
  }
  .blog-post .ui.statistics .statistic {
    width: 50% !important;
    margin: 0 !important;
  }
  .blog-post .ui.statistics .statistic .value {
    font-size: 1.8rem !important;
  }
  .blog-post .ui.statistics .statistic .label {
    font-size: 0.7rem !important;
  }
  /* Map filter bar: scrollable on mobile */
  .map-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    margin-bottom: 6px;
  }
  .map-filter-bar .ui.button {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ── Trip/route list items ── */
.user-trip-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.user-trip-item-thumb {
  width: 80px !important;
  min-width: 80px;
  height: 56px !important;
  max-width: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.user-trip-item-thumb-placeholder {
  background: linear-gradient(135deg, #e8f0e4 0%, #c5d8bc 100%);
}
.user-trip-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-trip-item-meta {
  font-size: 12.5px;
  color: #888;
  margin-top: 2px;
}
.user-trip-item-stats {
  font-size: 12.5px;
  color: #999;
  margin-top: 3px;
}

/* Dark background overrides for trip list */
.inner-block.dark-bg .user-trip-item {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
.inner-block.dark-bg .user-trip-item-name {
  color: #fff;
}
.inner-block.dark-bg .user-trip-item-meta {
  color: rgba(255, 255, 255, 0.6);
}
.inner-block.dark-bg .user-trip-item-stats {
  color: rgba(255, 255, 255, 0.5);
}
.inner-block.dark-bg .user-trip-item-thumb-placeholder {
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
}

/* Promote heavy subtrees to their own compositor layers so
   the modal dimmer fade-in doesn't force a full-page repaint. */
.blog-post {
  contain: layout style paint;
}
.blog-post .leaflet-container {
  will-change: transform;
}

/* Fix for Leaflet tiles being hidden by Bootstrap and Fomantic UI's responsive image styles */
.leaflet-tile-container img,
.leaflet-tile-pane img,
.leaflet-tile {
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  display: block !important;
}
/* Ensure Leaflet containers don't get collapsed */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
}

/* Section cards on dark background */
.inner-block.dark-bg h2 {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.inner-block.dark-bg .ui.card,
.inner-block.dark-bg .ui.cards > .card {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.inner-block.dark-bg .ui.card > .content,
.inner-block.dark-bg .ui.cards > .card > .content {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
}
.inner-block.dark-bg .ui.card .header,
.inner-block.dark-bg .ui.cards > .card .header,
.inner-block.dark-bg .ui.card .header a,
.inner-block.dark-bg .ui.cards > .card .header a {
  color: #fff;
}
.inner-block.dark-bg .ui.card .meta,
.inner-block.dark-bg .ui.cards > .card .meta {
  color: rgba(255, 255, 255, 0.6);
}
.inner-block.dark-bg .ui.card .description .ui.label,
.inner-block.dark-bg .ui.cards > .card .description .ui.label {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
}
.inner-block.dark-bg .ui.card .description .ui.label .icon,
.inner-block.dark-bg .ui.cards > .card .description .ui.label .icon {
  color: rgba(255, 255, 255, 0.7);
}

/* Map day tabs — Fomantic UI pointing secondary menu */
/* Dark background — when trip has a background image */
.inner-block.dark-bg .ui.secondary.pointing.menu {
  border-bottom-color: rgba(255, 255, 255, 0.4);
}

.inner-block.dark-bg .ui.secondary.pointing.menu .item {
  color: rgba(255, 255, 255, 0.85);
  border-color: transparent;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.inner-block.dark-bg .ui.secondary.pointing.menu .item:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.inner-block.dark-bg .ui.secondary.pointing.menu .active.item {
  color: #fff;
  border-color: #fff;
  font-weight: 600;
}

/* Fomantic basic buttons on dark background */
.inner-block.dark-bg .ui.basic.button {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
.inner-block.dark-bg .ui.basic.button:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* Reaction pills on dark background */
.inner-block.dark-bg .reaction-pill {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
}
.inner-block.dark-bg .reaction-pill:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}
.inner-block.dark-bg .reaction-pill-active {
  background: rgba(100, 180, 255, 0.25);
  border-color: rgba(100, 180, 255, 0.5);
  color: #90c8f8;
}
.inner-block.dark-bg .reaction-pill-active:hover {
  background: rgba(100, 180, 255, 0.35);
}
.inner-block.dark-bg .reaction-pill-add {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.6);
}
.inner-block.dark-bg .reaction-pill-add:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.9);
}
.inner-block.dark-bg .reaction-picker-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Comment editor on dark background */
.inner-block.dark-bg .comment-editor {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}
.inner-block.dark-bg .comment-editor .comment-editor-tiptap p.is-editor-empty:first-child::before {
  color: rgba(255, 255, 255, 0.4);
}

/* Description editor on dark background */
.inner-block.dark-bg .trip-description-editor {
  border-color: rgba(255, 255, 255, 0.3);
}
.inner-block.dark-bg .tiptap-toolbar {
  background: rgba(255, 255, 255, 0.1);
  border-bottom-color: rgba(255, 255, 255, 0.2);
}
.inner-block.dark-bg .tiptap-toolbar-btn {
  color: rgba(255, 255, 255, 0.8);
}
.inner-block.dark-bg .tiptap-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}
.inner-block.dark-bg .tiptap-toolbar-btn.active {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}
.inner-block.dark-bg .tiptap-toolbar-divider {
  background: rgba(255, 255, 255, 0.2);
}
.inner-block.dark-bg .tiptap-editor-content {
  color: rgba(255, 255, 255, 0.9);
}
.inner-block.dark-bg .tiptap-editor-content .tiptap p.is-editor-empty:first-child::before {
  color: rgba(255, 255, 255, 0.4);
}

/* Login prompt on dark background */
.inner-block.dark-bg .trip-login-prompt {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}
.inner-block.dark-bg .trip-login-prompt a {
  color: #90c8f8;
}

/* Comment action links on dark background */
.inner-block.dark-bg .comment-actions a {
  color: rgba(255, 255, 255, 0.6);
}
.inner-block.dark-bg .comment-actions a:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Collapsible trail description ── */
.trail-description-collapsed {
  max-height: 120px;
  overflow: hidden;
  position: relative;
}
.trail-description-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, #fff);
  pointer-events: none;
}
.inner-block.dark-bg .trail-description-collapsed::after {
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

/* ── Map legend overlay ── */
.map-legend {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  line-height: 1.6;
  max-width: 160px;
}
.map-legend-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  cursor: pointer;
  user-select: none;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.map-legend-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}
.map-legend-collapsed .map-legend-items {
  display: none;
}

/* ── Map label zoom tiers ── */

/* Low zoom: hide all permanent labels, tooltips work as fallback */
.zoom-tier-low .marker-label {
  display: none;
}

/* Mid zoom: show major labels, hide minor */
.zoom-tier-mid .marker-label-major {
  display: block;
}
.zoom-tier-mid .marker-label-minor {
  display: none;
}

/* High zoom: show all labels */
.zoom-tier-high .marker-label {
  display: block;
}

/* Suppress tooltips when permanent label is already showing */
.zoom-tier-high .leaflet-tooltip.marker-tooltip {
  display: none !important;
}
/* Mid zoom: suppress tooltips on major markers (labels are visible) */
.zoom-tier-mid .leaflet-tooltip.marker-tooltip-major {
  display: none !important;
}
