/**
 * Trail Map Styles
 */

/* Map Wrapper - Force full width */
.tcr-trail-map-wrapper {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  padding: 20px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box !important;
  position: relative;
  left: 0;
  right: 0;
}

/* Override WordPress theme constraints */
.entry-content .tcr-trail-map-wrapper,
.site-content .tcr-trail-map-wrapper,
article .tcr-trail-map-wrapper {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}

/* Map with Filters Container */
.map-with-filters {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-top: 24px;
  align-items: stretch;
  min-height: 700px;
  width: 100%;
}

/* Legend */
.map-legend {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-legend h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 12px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #374151;
}

.legend-color {
  width: 32px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-color.open {
  background: #10b981;
}

.legend-color.seasonal {
  background: #3b82f6;
}

.legend-color.muddy {
  background: #fbbf24;
}

.legend-color.hazardous {
  background: #ef4444;
}

/* Area Filters */
.map-filters {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.map-filters h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 12px;
}

#area-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Accordion Item */
.area-accordion-item {
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  overflow: hidden;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.area-accordion-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Accordion Header */
.area-accordion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.area-accordion-item.expanded .area-accordion-header {
  background: #f3f4f6;
}

/* Area Checkbox */
.area-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #10b981;
  flex-shrink: 0;
  margin: 0;
}

/* Accordion Toggle Button */
.area-accordion-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-align: left;
  user-select: none;
}

.area-accordion-toggle:hover .area-name {
  color: #10b981;
}

.accordion-icon {
  font-size: 10px;
  color: #6b7280;
  transition: transform 0.2s ease;
  display: inline-block;
  width: 12px;
}

.area-name {
  flex: 1;
  transition: color 0.2s ease;
}

.trail-count {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  flex-shrink: 0;
}

/* Area Zoom Icon */
.area-zoom-icon {
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b82f6;
  color: white;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.area-zoom-icon:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.area-zoom-icon:active {
  transform: scale(0.95);
}

/* Accordion Content */
.area-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.area-accordion-item.expanded .area-accordion-content {
  max-height: 2000px;
}

/* Trail List */
.trail-list {
  padding: 8px;
  background: white;
}

/* Trail Item */
.trail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: all 0.15s ease;
}

.trail-item:last-child {
  margin-bottom: 0;
}

.trail-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.trail-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.trail-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #10b981;
  flex-shrink: 0;
  margin: 0;
}

.trail-name {
  flex: 1;
  font-size: 13px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.trail-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trail-zoom-icon {
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #10b981;
  color: white;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.trail-zoom-icon:hover {
  background: #059669;
  transform: scale(1.1);
}

.trail-zoom-icon:active {
  transform: scale(0.9);
}

/* Map Container */
#tcr-trail-map {
  flex: 1 1 0;
  width: 100%;
  min-height: 700px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Trail Popup */
.trail-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-width: 200px;
}

.trail-popup-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.trail-popup-area {
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.trail-popup-status {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.trail-popup-seasonal {
  margin-top: 12px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.seasonal-date {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  padding: 4px 0;
}

/* Photo Filters */
.photo-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.photo-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
  user-select: none;
}

.photo-filter-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.photo-filter-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
  margin: 0;
}

/* Photo Markers */
.photo-marker-icon {
  background: none;
  border: none;
}

.photo-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.photo-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Photo Popup */
.photo-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-width: 250px;
  max-width: 300px;
}

.photo-popup-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 12px;
  display: block;
}

.photo-popup-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.photo-popup-caption {
  font-size: 14px;
  color: #374151;
  margin-bottom: 12px;
  font-style: italic;
}

.photo-popup-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.photo-popup-user,
.photo-popup-date {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.photo-popup-status {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.photo-popup-resolution {
  margin-top: 12px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
}

.photo-popup-resolution strong {
  color: #111827;
}

/* Task Filters */
.task-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.task-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
  user-select: none;
}

.task-filter-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.task-filter-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #10b981;
  margin: 0;
}

.task-filter-item .priority-urgent { color: #dc2626; }
.task-filter-item .priority-high { color: #f97316; }
.task-filter-item .priority-normal { color: #10b981; }
.task-filter-item .priority-low { color: #3b82f6; }

/* Task Markers */
.task-marker-icon {
  background: none;
  border: none;
}

.task-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.task-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Task Popup */
.task-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-width: 250px;
  max-width: 300px;
}

.task-popup-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 12px;
  display: block;
}

.task-popup-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.task-popup-project {
  font-size: 14px;
  margin-bottom: 4px;
}

.task-popup-project a {
  color: #059669;
  text-decoration: none;
  font-weight: 600;
}

.task-popup-project a:hover {
  text-decoration: underline;
}

.task-popup-trail {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

.task-popup-description {
  font-size: 14px;
  color: #374151;
  margin-bottom: 12px;
  line-height: 1.5;
}

.task-popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.task-popup-status,
.task-popup-hours {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.task-popup-priority {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

.task-popup-link {
  display: inline-block;
  padding: 8px 16px;
  background: #059669;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.task-popup-link:hover {
  background: #047857;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.leaflet-popup-content {
  margin: 16px;
}

.leaflet-popup-tip {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .map-with-filters {
    flex-direction: column-reverse;
  }

  .map-filters {
    flex: 1 1 auto;
    width: 100%;
  }

  #area-filters {
    max-height: 250px;
  }
}

@media (max-width: 768px) {
  .tcr-trail-map-wrapper {
    padding: 12px;
  }

  .map-with-filters {
    gap: 16px;
    margin-top: 16px;
  }

  .map-legend h3,
  .map-filters h3 {
    font-size: 16px;
  }

  .legend-item {
    font-size: 13px;
  }

  .area-filter-item {
    font-size: 13px;
    padding: 8px 10px;
  }

  #tcr-trail-map {
    height: 400px !important;
  }
}

@media (max-width: 480px) {
  .map-legend,
  .map-filters {
    padding: 16px;
  }

  .legend-items,
  #area-filters {
    gap: 6px;
  }

  #tcr-trail-map {
    height: 350px !important;
  }
}

/* Loading State */
.tcr-map-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  color: #6b7280;
  font-size: 16px;
  font-weight: 600;
}

/* Scrollbar Styling for Area Filters */
#area-filters::-webkit-scrollbar {
  width: 8px;
}

#area-filters::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

#area-filters::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

#area-filters::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
