/* -------------------------
   Root / Bootstrap overrides
--------------------------*/
.achievements-map-plugin {
  --bs-primary:   #1C4F9C;
  --bs-secondary: #E5E5E5;
  --bs-success:   #39CFFE;
  --bs-info:      #1E7FDC;
  --bs-warning:   #FACC15;
  --bs-danger:    #F97373;
}

/* Make outline primary buttons use our primary colour */
.achievements-map-plugin .btn-outline-primary {
  --bs-btn-color:                 var(--bs-primary);
  --bs-btn-border-color:          var(--bs-primary);
  --bs-btn-hover-bg:              var(--bs-primary);
  --bs-btn-hover-border-color:    var(--bs-primary);
  --bs-btn-active-bg:             var(--bs-primary);
  --bs-btn-active-border-color:   var(--bs-primary);
  --bs-btn-disabled-color:        var(--bs-primary);
  --bs-btn-disabled-border-color: var(--bs-primary);
}

/* Optional: tighten navbar inside plugin */
.achievements-map-plugin .navbar {
  padding: 0.5rem 0;
}

/* -------------------------
   Map & floating sidebar
--------------------------*/

/* Container that holds both map & overlay sidebar */
#map-container {
  position: relative;
  width: 100%;
  height: 600px;          /* main height on desktop */
  min-height: 70vh;
  overflow: hidden;
  border: 1px solid #e8d6c8;
  background: #f9fafb;
}

/* Leaflet map fills entire container */
#map {
  width: 100%;
  height: 100%;
}

/* Floating sidebar overlay on the right */
#sidebar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: clamp(220px, 20%, 340px);  /* around 15–20% of container width */
  
  border-radius: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* rounded corners + internal scrolling */
}

/* Scrollable list & details inside sidebar */
#achievement-list {
  flex: 1;
  overflow-y: auto;
}

#achievement-details {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding: 20px 15px !important;
  max-height: 100%;
  overflow-y: auto;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  background-color:#FFF;
  border-radius:25px;
}

/* Optional sidebar heading style */
#sidebar h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* 
Active buttons 
*/
#category-filter .nav-link {
  border: 1px solid #ddd;
  color: #444;
  transition: all 0.25s ease;
  border-radius: 30px;
  background: #fff;
}

/* Hover */
#category-filter .nav-link:hover {
  background: #f3f4f6;
}

/* ACTIVE STATE */
#category-filter .nav-link.active {
  background: var(--bs-primary);
  color: #fff !important;
  border-color: var(--bs-primary);
  box-shadow: 0 0 10px rgba(28, 79, 156, 0.3);
  font-weight: 600;
}
/* -------------------------
   Achievement list & cards
--------------------------*/
.achievement {
  padding: 20px 15px;
  border-bottom: 1px solid #e4e4e4;
  cursor: pointer;
  border-radius: 8px;
  background: #ffffff;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
  margin-bottom: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
}

.achievement:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.achievement:hover {
  background-color: #f9fafb;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.achievement--active {
  border: 1px solid var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(28, 79, 156, 0.18);
  background-color: #f3f7ff;
}

/* Thumbnail with skeleton */
.achievement-thumb {
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  margin-bottom: 6px;
  background: #e5e7eb;
}

.achievement-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  
}

/* Skeleton shimmer overlay */
.achievement-thumb.skeleton::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #e5e7eb 0%,
    #f3f4f6 50%,
    #e5e7eb 100%
  );
  animation: skeleton-shimmer 1.2s infinite;
}

@keyframes skeleton-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Achievement text */
.achievement-title {
  font-weight: 600;
  margin: 0 0 2px;
  font-size: 0.95rem;
}

.achievement-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #6b7280;
}

/* Category badge */
.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  gap: 4px;
  position:absolute;
  bottom:10px;
  left:5px;
  z-index:20;

}
/* Category badge */
.category-badge-details {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  gap: 4px;
  position:absolute;
  bottom:10px;
  left:5px;
  z-index:20;

}

/* -------------------------
   Category colours
--------------------------*/
.category-badge-music,
.legend-music {
  background-color: #6366f1;
}

.category-badge-food,
.legend-food {
  background-color: #f97316;
}

.category-badge-community,
.legend-community {
  background-color: #14b8a6;
}

.category-badge-art,
.legend-art {
  background-color: #ec4899;
}

.category-badge-news,
.legend-news {
  background-color: #0ea5e9;
}

/* Default / other category */
.category-badge-default,
.legend-default {
  background-color: #9ca3af;
}

/* Link button */
.link-button{
  padding:10px;
  margin-bottom:10px;
}

/* -------------------------
   Search bar styling
--------------------------*/
.search-container .input-group-text {
  border-radius: 20px 0 0 20px;
  padding: 6px 10px;
  background: #ffffff;
  border-right: 0;
}

.search-container .form-control {
  border-radius: 0 20px 20px 0;
  border-left: 0;
  box-shadow: none !important;
  padding-left: 4px;
}

.search-container .form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.15rem rgba(28, 79, 156, 0.18) !important;
}

.search-container .input-group-text,
.search-container .form-control {
  border-color: #ced4da;
}

.search-container svg {
  opacity: 0.75;
}

/* Hover shadow + expand on focus */
.search-container .input-group {
  max-width: 260px;
  transition:
    box-shadow 0.2s ease,
    width 0.25s ease;
  width: 180px;
}

.search-container .input-group:hover {
  box-shadow: 0 0 4px rgba(0,0,0,0.08);
}

.search-container .input-group:focus-within {
  width: 260px;
}

/* -------------------------
   Marker styling (divIcon)
--------------------------*/
.category-marker-icon {
  /* wrapper for custom Leaflet divIcon */
}

.category-marker {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

/* Base: grey for unknown */
.marker-cat-default .category-marker {
  background-color: #9ca3af;
}

/* Match badge/legend colours */
.marker-cat-music .category-marker {
  background-color: #6366f1;
}

.marker-cat-food .category-marker {
  background-color: #f97316;
}

.marker-cat-community .category-marker {
  background-color: #14b8a6;
}

.marker-cat-art .category-marker {
  background-color: #ec4899;
}

.marker-cat-news .category-marker {
  background-color: #0ea5e9;
}

/* Active marker glow */
.category-marker-icon.marker-active .category-marker {
  transform: scale(1.3);
  box-shadow:
    0 0 0 3px rgba(59,130,246,0.35),
    0 0 0 1px rgba(0,0,0,0.25);
}

/* -------------------------
   Legend
--------------------------*/
.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  background: rgba(255, 255, 255, 0.93);
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  font-size: 0.8rem;
}

.map-legend .legend-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.9);
}

/* -------------------------
   Responsive tweaks
--------------------------*/
@media (max-width: 992px) {
  #map-container {
    height: 520px;
  }
}

@media (max-width: 768px) {
  #map-container {
    height: 420px;
  }

  /* Mobile: sidebar becomes a bottom drawer over the map */
  #sidebar{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top:0;
    width: 100%;
    height: auto;
    max-height: 50%;
    transform: none;

    border-radius: 16px 16px 0 0;
    overflow: hidden;
    z-index: 1200;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  }

  /* List becomes horizontal scroll */
  #achievement-list{
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 12px;

    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
  }

  
  /* Each card is a fixed-width "slide" */
  #achievement-list .achievement{
    flex: 0 0 85%;
    max-width: 240px;
  }

  /* When details are shown (list hidden by JS), allow vertical scrolling */
  #achievement-details{
    max-height: 100%;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
    margin: 12px;
    border-radius:10px;
  }

  #achievement-details h5{
    font-family;inherit;
     font-weight: 600;
    margin: 0 0 2px;
    font-size: 0.95rem;
    line-height:1.2em;
  }

  /* Keep legend above the bottom drawer */
  .map-legend{
    left: 12px;
    bottom: calc(45% + 16px);
    transform: none;
  }

  /* Search full width */
  .search-container .input-group{
    width: 100% !important;
    max-width: none !important;
  }

    /* Achievement text */
  .achievement-title {
    font-weight: 600;
    margin: 0 0 2px;
    font-size: 0.95rem;
    line-height:1.2em;
  }
}
