/* Recovery Resources Interactive Map - Custom Styles */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  /* Primary Colors */
  --primary-purple: #55298a;
  --secondary-green: #20cb98;
  --light-purple-bg: #f5ebf3;
  --hover-green: #1ab888;

  /* Resource Type Colors */
  --recovery-support: #8243da;
  --family-support: #ff66c4;
  --housing: #00bf63;
  --transportation: #ff6663;

  /* Bootstrap pagination override */
  --bs-pagination-active-bg: #55298a;
  --bs-pagination-active-border-color: #55298a;
}

/* ============================================
   Typography
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;700&family=Oxygen:wght@300;400;700&display=swap');

body {
  font-family: "Oxygen", sans-serif;
  color: #333;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Lora", serif;
  font-weight: 700;
  color: var(--primary-purple);
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  background-color: var(--primary-purple);
  border-color: var(--primary-purple);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #44207a;
  border-color: #44207a;
}

.btn-outline-primary {
  color: var(--primary-purple);
  border-color: var(--primary-purple);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--primary-purple);
  border-color: var(--primary-purple);
  color: #fff;
}

.search-toggle-btn,
.filter-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--primary-purple);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.search-toggle-btn:hover,
.filter-toggle-btn:hover {
  transform: scale(1.05);
  background-color: #44207a;
}

.map-fly-btn {
  background-color: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.map-fly-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sidenav-button {
  color: #fff;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.sidenav-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}


/* ============================================
   Hero Section
   ============================================ */

.hero-section h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}


.badge-recovery {
  background-color: #8243da;
  color: white !important;
}

.badge-family {
  background-color: #ff66c4;
  color: white !important;
}

.badge-housing {
  background-color: #00bf63;
  color: white !important;
}

.badge-transportation {
  background-color: #ff6663;
  color: white !important;
}

/* ============================================
   Search Section
   ============================================ */

.search-section {
  background: linear-gradient(135deg, var(--light-purple-bg) 0%, #e8d5e6 100%);
  padding: 80px 0;
  min-height: 60vh;
  display: flex;
  align-items: center;
}

.search-section h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.search-section h5 {
  color: #555;
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* ============================================
   Search Controls
   ============================================ */
.search-controls {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(85, 41, 138, 0.15);
  max-width: 600px;
  margin: 0 auto;
}
/* Base input group styling */
.input-group {
    background-color: #E6E6FA; /* lavender */
    border: 1px solid #ced4da;
    border-radius: .375rem;
    overflow: hidden;
    transition:
        background-color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}

/* Make ALL children transparent */
.input-group > * {
    background-color: transparent !important;
}

/* Remove inner borders for unified look */
.input-group .form-control,
.input-group .form-select {
    border: none;
    box-shadow: none !important;
}

/* Hover state */
.input-group:hover {
    border-color: #b3b3d1;
}

/* Focus state for the entire group */
.input-group:focus-within {
    background-color: #ffffff; /* white on focus */
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}



/* ============================================
   County Quick Links
   ============================================ */
.county-links {
  margin-top: 2rem;
}

.county-links .btn {
  margin: 0.25rem;
  border-radius: 20px;
  padding: 0.5rem 1.25rem;
}

/* ============================================
   Cards
   ============================================ */

      .resourceCard {
        border: 1px solid #d5d6d8;
        border-radius: 1px;
        box-shadow: 0 4px 13px rgba(84, 41, 137, .1);
        transition: all .4s ease;

        @media (max-width: 768px) {
          .card-sidenav {
            min-height: 120px;
          }
        }
      }

      .resourceCard:hover {
        transform: translateY(-5px);
        box-shadow: 0 4px 13px rgba(84, 41, 137, .25);
        border: 1px solid #55298a;
      }

      .resourceCard[data-longitude]:hover .card-body::after {
        content: "Click map icon to view location";
        position: absolute;
        bottom: 10px;
        left: 20px;
        background: rgba(85, 41, 138, 0.9);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.75rem;
        pointer-events: none;
        z-index: 10;
      }

      .card-body {
        position: relative;
      }

      .card-sidenav {
        background: #55298a;
        border-radius: 1px 0 0 1px;
        min-height: 200px;
        max-width: 80px;
      }

      .sidenav-button {
        color: white;
        text-decoration: none;
        transition: background-color 0.2s;
        border-radius: 0;
        font-size: 1.75rem;
        padding: 0.5rem;
      }

      .card-sidenav a {
        color: white;
        text-decoration: none;
        transition: background-color 0.2s;
        border-radius: 0;
        font-size: 1.75rem;
        padding: 0.5rem;
      }

      .card-sidenav > button {
        color: white;
        text-decoration: none;
        transition: background-color 0.2s;
        border-radius: 0;
      }

      .card-sidenav a:hover {
        background-color: #f5ebf3;
        color: #55298a;
      }

      .card-sidenav a:first-child {
        border-radius: 1px 0 0 0;
      }

      .card-sidenav a:last-child {
        border-radius: 0 0 0 1px;
      }

      .cardImage {
          max-height: 100px;
          height: 100px;
          width: auto;
          max-width: 200px;
          border-radius: 4px;
          object-fit: contain;
          bottom: 0;
          right: 0;
      }

      .card-body h3 {
        color: #55298a;
        margin-bottom: 0.5rem;
        line-height: 1em;
      }

      .card-badge {
        display: inline-block;
        cursor: pointer;
        background: #f5ebf3;
        border-radius: 2px;
        margin-right: 5px;
        margin-bottom: 5px;
        color: #55298a;
        font-family: Oxygen, sans-serif;
        font-size: 14px;
        font-weight: 400;
        letter-spacing: 1.35px;
        line-height: 12px;
        padding: 5px 6px;
      }
/* ============================================
   Map Container
   ============================================ */
.map-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
}

#map {
  width: 100%;
  height: 400px;
}

@media (min-width: 768px) {
  #map {
    height: 450px;
  }
}

/* Map Controls Styling */
.maplibregl-ctrl-group {
  background-color: transparent !important;
  box-shadow: none !important;
}

.maplibregl-ctrl-group button {
  width: 36px !important;
  height: 36px !important;
  border-radius: 8px !important;
}

.maplibregl-ctrl-group button:hover {
  background-color: var(--light-purple-bg) !important;
}


/* All navigation buttons - matching search-toggle-btn style */
.maplibregl-ctrl-group button {
  flex-shrink: 0 !important;
  width: 44px !important;
  height: 44px !important;
  background: #55298a;
  color: white;
  border: none;
  border-radius: 50% !important;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.2s ease;
  z-index: 2;
  margin-bottom: 8px;
}

.maplibregl-ctrl-group button:last-child {
  margin-bottom: 0;
}

.maplibregl-ctrl-group button:hover {
  background: #20cb98;
  transform: scale(1.05);
}

.maplibregl-ctrl-group button:active {
  background: #20cb98;
  transform: scale(0.98);
}

.maplibregl-ctrl-group button:focus {
  border-radius: 50% !important;
}

/* Ensure Bootstrap icons in buttons are white */
.maplibregl-ctrl-group button i {
  color: white;
  pointer-events: none;
  font-size: 18px;
}

/* Remove default MapLibre button background images */
.maplibregl-ctrl-group button.maplibregl-ctrl-zoom-in,
.maplibregl-ctrl-group button.maplibregl-ctrl-zoom-out {
  background-image: none !important;
}

/* Search Control on Map */
.search-control {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
}

.search-control-btn {
  background: #fff;
  border: 2px solid var(--primary-purple);
  border-radius: 24px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  color: var(--primary-purple);
  font-weight: 500;
}

.search-control-btn:hover {
  background-color: var(--primary-purple);
  color: #fff;
}

.search-control-btn i {
  font-size: 1rem;
}

/* Filter Panel Control */
.filter-panel-control {
  position: absolute;
  top: 10px;
  right: 60px;
  z-index: 1000;
}

/* Map Popup */
.map-popup-container {
  max-width: 300px;
  padding: 0.5rem;
}

.map-popup-container h6 {
  color: var(--primary-purple);
  margin-bottom: 0.5rem;
}

.map-popup-container p {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.maplibregl-popup-content {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem;
}

.maplibregl-popup-close-button {
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  color: #666;
}

.maplibregl-popup-close-button:hover {
  color: var(--primary-purple);
  background: none;
}

/* ============================================
   Filters
   ============================================ */
.filter-dropdown-btn {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 120px;
  transition: border-color 0.2s ease;
}

.filter-dropdown-btn:hover,
.filter-dropdown-btn:focus {
  border-color: var(--primary-purple);
}

.filter-dropdown-btn.show {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 2px rgba(85, 41, 138, 0.2);
}

.filter-count-badge {
  background-color: var(--primary-purple);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  background-color: var(--light-purple-bg);
  color: var(--primary-purple);
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  margin: 0.25rem;
  gap: 0.25rem;
}

.filter-chip button {
  background: none;
  border: none;
  color: var(--primary-purple);
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.filter-chip button:hover {
  background-color: rgba(85, 41, 138, 0.2);
}

.filter-section {
  border-bottom: 1px solid #eee;
  padding: 1rem 0;
}

.filter-section:last-child {
  border-bottom: none;
}

.filter-option {
  padding: 0.5rem 0;
}

.filter-option label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-item-check {
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.dropdown-item-check:hover {
  background-color: var(--light-purple-bg);
}

.dropdown-item-check input[type="checkbox"] {
  accent-color: var(--primary-purple);
  width: 18px;
  height: 18px;
}

.dropdown-menu {
  max-height: 300px;
  overflow-y: auto;
  min-width: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Table
   ============================================ */
.table-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--primary-purple);
  color: #fff;
  border: none;
  border-right: 1px solid #fff;
  padding: 1rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
  resize: horizontal;
  overflow: hidden;
  min-width: 100px;
}

.table thead th:last-child {
  border-right: none;
}

.table thead th:hover {
  background-color: #44207a;
}

.table thead th.sorted-asc::after,
.table thead th.sorted-desc::after {
  margin-left: 0.5rem;
}

.table thead th.sorted-asc::after {
  content: "\2191";
}

.table thead th.sorted-desc::after {
  content: "\2193";
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table-row-clickable {
  cursor: pointer;
}

.table-row-clickable:hover {
  background-color: var(--light-purple-bg);
}

.table tbody td {
  padding: 0.5rem 1rem;
  vertical-align: middle;
  white-space: nowrap;
}

.table-responsive {
  border-radius: 12px;
}

/* ============================================
   View Toggle
   ============================================ */
.view-toggle {
  display: inline-flex;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
}

.view-toggle-btn:hover {
  color: var(--primary-purple);
}

.view-toggle-btn.active {
  background-color: var(--primary-purple);
  color: #fff;
}

/* ============================================
   Loading & States
   ============================================ */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.loading-spinner .spinner-border {
  color: var(--primary-purple);
  width: 3rem;
  height: 3rem;
}

.results-info {
  color: #666;
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

.empty-state i {
  font-size: 4rem;
  color: #ccc;
  margin-bottom: 1rem;
}

.error-state {
  text-align: center;
  padding: 3rem;
  color: #dc3545;
}

/* ============================================
   Pagination
   ============================================ */
.pagination .page-link {
  color: var(--bs-primary);
  border-color: #ddd;
}

.pagination .page-item.active .page-link {
  background-color: var(--primary-purple);
  border-color: var(--primary-purple);
  color: #fff;
}

.pagination .page-link:hover {
  background-color: var(--light-purple-bg);
  border-color: var(--primary-purple);
  color: var(--primary-purple);
}

.pagination .page-item.disabled .page-link {
  color: #ccc;
}

/* ============================================
   Modal
   ============================================ */
.modal-header {
  border-bottom: none;
  padding-bottom: 0;
}

.modal-title {
  color: var(--primary-purple);
}

.modal-body {
  padding-top: 0.5rem;
}

.modal-footer {
  border-top: none;
}

/* ============================================
   Back to Map Button (Mobile)
   ============================================ */
.back-to-map-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background-color: var(--primary-purple);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.back-to-map-btn:hover {
  transform: scale(1.1);
}

@media (max-width: 575px) {
  .back-to-map-btn.visible {
    display: flex;
  }
}

/* ============================================
   Keyboard Shortcut Display
   ============================================ */
.kbd-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.kbd-wrapper kbd {
  background-color: #eee;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.8rem;
  color: #666;
}

@media (max-width: 768px) {
  .kbd-wrapper {
    display: none;
  }
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
  .hero-section {
    padding: 40px 0;
    min-height: auto;
  }

  .hero-section h1 {
    font-size: 2rem;
  }

  .filter-dropdown-btn {
    min-width: 100px;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
  }
}

@media (max-width: 575px) {
  .search-controls {
    padding: 0.75rem;
  }

  #searchbar .form-control {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }

  .resourceCard .card-body {
    padding: 1rem !important;
  }

  .card-title {
    font-size: 1.1rem;
  }
}


/* Filter chips container */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.clear-all-btn {
  background: none;
  border: none;
  color: var(--primary-purple);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  text-decoration: underline;
}

.clear-all-btn:hover {
  color: #44207a;
}
