/* ===== Base ===== */
:root {
  color-scheme: dark;
}

html,
body {
  background: #0b1220;
}

/* ===== Glass / UI ===== */
.glass {
  background: linear-gradient(
    to bottom right,
    rgba(15, 23, 42, 0.55),
    rgba(30, 41, 59, 0.55)
  );
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dark .glass {
  background: linear-gradient(
    to bottom right,
    rgba(3, 7, 18, 0.75),
    rgba(17, 24, 39, 0.75)
  );
}

/* ===== Background glow ===== */
.grid-glow {
  background-image:
    radial-gradient(800px 400px at 15% 10%, rgba(56, 189, 248, 0.35), transparent 60%),
    radial-gradient(800px 500px at 85% 15%, rgba(168, 85, 247, 0.30), transparent 60%),
    radial-gradient(900px 550px at 50% 95%, rgba(34, 197, 94, 0.20), transparent 60%);
}

/* ===== Shine button ===== */
.shine {
  position: relative;
  overflow: hidden;
}

.shine::before {
  content: "";
  position: absolute;
  inset: -40%;
  transform: translateX(-60%) rotate(25deg);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 45%,
    transparent 70%
  );
  animation: shine 4.8s ease-in-out infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-65%) rotate(25deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  55% {
    opacity: 1;
  }
  100% {
    transform: translateX(65%) rotate(25deg);
    opacity: 0;
  }
}

/* ===== Map ===== */
#map {
  height: 560px;
  border-radius: 1rem;
}

@media (max-width: 640px) {
  #map {
    height: 460px;
  }
}

/* Leaflet fixes */
.leaflet-marker-icon {
  overflow: visible !important;
}

.leaflet-popup-content {
  margin: 0;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

/* ===== Popup ===== */
.popup-card {
  width: 300px;
  padding: 12px;
}

.court-popup-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.court-popup-head img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #d8e0e8;
  border-radius: 10px;
  padding: 5px;
}

.court-popup-title {
  color: #17212b;
  font-weight: 800;
  line-height: 1.18;
  word-break: break-word;
}

.court-popup-address {
  margin-top: 3px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.25;
}

.court-popup-meta,
.court-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.court-popup-meta span,
.court-list-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  border: 1px solid #d8e0e8;
  background: #f6f8fb;
  color: #526273;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
}

.court-popup-notes {
  margin-top: 9px;
  color: #526273;
  font-size: 13px;
  line-height: 1.35;
}

.court-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.court-popup-action {
  min-height: 30px;
  border-radius: 8px;
  border: 1px solid #cbd5df;
  background: #ffffff;
  color: #1d4ed8;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.court-popup-action.book {
  border-color: #16a34a;
  background: #ecfdf3;
  color: #15803d;
}

.court-popup-gallery {
  position: relative;
  width: 100%;
  height: 158px;
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}

.court-popup-gallery img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: courtGalleryFade var(--gallery-duration, 9s) infinite;
  animation-delay: var(--gallery-delay, 0s);
}

.court-popup-gallery img.single {
  opacity: 1;
  animation: none;
}

@keyframes courtGalleryFade {
  0% {
    opacity: 0;
  }
  7% {
    opacity: 1;
  }
  34% {
    opacity: 1;
  }
  42% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

.popup-title {
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.popup-sub {
  font-size: 12px;
  color: #64748b;
}

/* ===== Images ===== */
img.logo,
img.venue-thumb {
  background: #fff;
}

img.logo {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

.venue-thumb,
.popup-card img {
  background: #ffffff;
  padding: 4px;
  border-radius: 8px;
  object-fit: contain;
}

.popup-card img {
  padding: 6px;
  border-radius: 10px;
}

#courtsList img {
  background: #ffffff;
  border-radius: 15px;
  box-sizing: border-box;
}

/* ===== Custom Pin ===== */
.pin-wrap {
  position: relative;
  width: 40px;
  height: 64px;
}

.pin-wrap img.pin {
  width: 40px;
  height: 64px;
  display: block;
}

.pin-wrap img.shadow {
  position: absolute;
  left: -6px;
  top: 2px;
  width: 52px;
  height: 52px;
  opacity: 0.5;
  pointer-events: none;
}

.pin-wrap .badge {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

.pin-wrap .badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== Cards ===== */
.card {
  background: #fff;
}

.dark .card {
  background: #0f172a;
  border-color: #1f2937;
}

section.card {
  background: linear-gradient(
    145deg,
    rgba(30, 58, 138, 0.25),
    rgba(91, 33, 182, 0.25)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
}

section.card h2 {
  color: #e2e8f0;
}

/* ===== Buttons ===== */
.btn-book {
  padding: 6px 10px;
  border-radius: 6px;
  background: #16a34a;
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
}

.btn-book:hover {
  background: #15803d;
}

/* ===== Lists ===== */
#courtsList {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-list {
  list-style-type: disc;
  text-align: justify;
}

.event-list li {
  padding-left: 0.3rem;
}

/* ===== Layout placeholders ===== */
#header-placeholder,
#footer-placeholder {
  display: block;
  width: 100%;
}

.popup-card .court-popup-gallery img {
  padding: 0;
  border-radius: 0;
  object-fit: cover;
}

.popup-card .court-popup-head img {
  object-fit: contain;
}
