/* Listing page styles - final enhancements (updated for mobile) */

/* Layout */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Grid - responsive */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

@media (max-width:720px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Filter / Search */
.filter-card {
  padding: 16px;
  margin-bottom: 20px;
}

.filter-section {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- Desktop enhancements for filter bar --- */
@media (min-width: 721px) {
  .filter-section {
    flex-wrap: nowrap;
    /* no wrapping on desktop */
    justify-content: flex-start;
    gap: 16px;
    /* more spacing for desktop */
  }

  /* Make search box stretch, dropdowns fixed width */
  .search-wrap {
    flex: 1 1 auto;
    /* takes remaining space */
  }

  #categoryFilter,
  #sortFilter {
    flex: 0 0 180px;
    /* fixed width */
  }

  #clearSearch {
    right: 12px;
    /* ensure clear icon stays aligned */
  }
}

/* Mobile filter layout */
@media (max-width:720px) {
  .filter-section {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-wrap {
    width: 100%;
  }

  .filter-section select {
    width: 100%;
  }
}

/* Search wrapper */
.search-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  /* 🔥 ensures perfect alignment */
}

/* Search input */
#eventSearch {
  width: 100%;
  padding: 10px 44px 10px 12px;
  border-radius: 10px;
  border: 1px solid #e6e9ee;
  background: var(--bg, #fff);
  color: var(--text, #111);
  font-size: 14px;
  line-height: 1.4;
  height: 42px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* Clear icon */
#clearSearch {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #7a8a99;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

/* 🔥 NEW FIX — ensures icon never shifts on mobile */
#clearSearch i {
  display: block;
  line-height: 1;
  font-size: 18px;
}

/* Mobile search fixes */
@media (max-width:480px) {
  #eventSearch {
    padding: 11px 46px 11px 12px;
    font-size: 15px;
  }

  #clearSearch {
    width: 28px;
    height: 28px;
    right: 12px;
  }
}

/* Slight improvement 480–720px */
@media (min-width:481px) and (max-width:720px) {
  #eventSearch {
    padding-right: 48px;
  }

  #clearSearch {
    right: 12px;
  }
}

/* Dark mode search */
.dark #eventSearch {
  background: #0f1720;
  color: #e6eef8;
  border-color: #22303a;
}

.dark #eventSearch::placeholder {
  color: #9fb0c2;
}

.dark #clearSearch {
  color: #b9c8d6;
}

/* Selects */
.filter-section select {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #e6e9ee;
  min-width: 160px;
  background: var(--surface, #fff);
}

.filter-section select:focus {
  border-color: #0f6ef4;
  box-shadow: 0 6px 18px rgba(15, 110, 244, 0.08);
}

/* Mobile dropdown spacing fix */
@media (max-width:480px) {

  #categoryFilter,
  #sortFilter {
    width: 100%;
    margin-bottom: 4px;
    height: 44px;
    font-size: 15px;
  }
}

/* Sticky filter bar */
#filterBar.sticky {
  position: sticky;
  top: 84px;
  z-index: 40;
  background: var(--surface, #fff);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(6, 20, 40, 0.06);
}

/* Mobile sticky fix */
@media (max-width:480px) {
  #filterBar.sticky {
    top: 72px;
    padding: 12px;
    border-radius: 12px;
  }
}

/* EVENT CARDS */
.event-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface, #fff);
  box-shadow: 0 8px 20px rgba(14, 20, 25, 0.04);
  transition: .26s ease;
  cursor: pointer;
}

.event-card:focus {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(14, 20, 25, 0.09);
}

.event-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.event-card .event-content {
  padding: 12px 14px 18px;
}

.event-card h3 {
  margin: 6px 0 8px;
  font-size: 16px;
}

.event-card p.muted {
  font-size: 14px;
  color: var(--muted, #6c757d);
}

/* Overlay CTA */
.event-card .overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(0, 0, 0, 0.52);
  transform: translateY(12px);
  transition: .26s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.event-card:hover .overlay,
.event-card:focus .overlay {
  opacity: 1;
  transform: translateY(0);
}

.overlay a {
  padding: 10px 16px;
  background: var(--brand, #0f6ef4);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* Badges */
.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  animation: floatBadge 3s ease-in-out infinite;

  display: flex;
  justify-content: center;
  align-items: center;
}

.badge.category {
  right: 12px;
  bottom: 12px;
  left: auto;
  top: auto;
  text-transform: capitalize;
  font-size: 13px;
}

/* float animation */
@keyframes floatBadge {
  0% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(-6px)
  }

  100% {
    transform: translateY(0)
  }
}

/* Badge colors */
.badge.upcoming {
  background: #007bff;
}

.badge.ongoing {
  background: #28a745;
}

.badge.marathon {
  background: #ff5733;
}

.badge.cycling {
  background: #33b5ff;
  color: #03324b;
}

.badge.workshop {
  background: #9b59b6;
}

.badge.festival {
  background: #f39c12;
  color: #2c1a00;
}

.badge.funrun {
  background: #2ecc71;
  color: #054216;
}

/* No events message */
.no-events {
  display: none;
  padding: 28px 14px;
  font-size: 18px;
  text-align: center;
  color: var(--muted, #6c757d);
  opacity: 0;
  transform: translateY(8px);
  transition: .36s ease;
}

.no-events.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Accessibility helper */
.visually-hidden {
  position: absolute;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

/* -------------------------------------------
   FULL CARD SKELETON
------------------------------------------- */
.skeleton-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn .3s ease;
}

.skel-img {
  width: 100%;
  height: 180px;
  border-radius: 12px;
}

.skel-line {
  height: 16px;
  width: 80%;
  border-radius: 6px;
}

.skel-small {
  height: 14px;
  width: 50%;
  border-radius: 6px;
}

/* SHIMMER EFFECT */
.skeleton, .skel-img, .skel-line, .skel-small {
  background: linear-gradient(
    90deg,
    #e4e4e4 25%,
    #f3f3f3 50%,
    #e4e4e4 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* IMAGE LOADED FADE-IN */
.img-loaded {
  opacity: 1;
  transition: opacity .4s ease;
}
.lazy-img {
  opacity: 0;
}

/* Skeleton Layout */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
  gap: 20px;
}
