/* =====================================================
   CourtSeeker Design System
   Mobile-first • Brand: #2d7a3a green + #f5d000 yellow
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ---- Custom Properties ---- */
:root {
  /* Brand */
  --green:         #2d7a3a;
  --green-dark:    #1f5529;
  --green-light:   #3d9e4e;
  --green-subtle:  #e8f5ea;
  --yellow:        #f5d000;
  --yellow-dark:   #c9ab00;
  --yellow-light:  #fffde6;

  /* Surfaces */
  --bg:      #eff4f0;
  --surface: #ffffff;
  --border:  #dde8de;

  /* Text */
  --text:           #1a2e1a;
  --text-muted:     #5f7a62;
  --text-secondary: #6c757d; /* alias for inline styles in JS */

  /* Semantic */
  --status-ok:    #2d7a3a;
  --status-busy:  #c0392b;

  /* Shape */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 14px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.12);

  /* Racket Identity */
  --color-tennis:     #CEFF00;
  --color-pickleball: #FF6B00;

  /* Motion */
  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 140ms var(--ease);

  /* Pico-compat aliases (referenced inline by layout.js / stats.js) */
  --pico-card-background-color: var(--surface);
  --pico-primary-border:        var(--border);
  --pico-color-red-500:         var(--status-busy);
  --pico-border-radius:         var(--radius);
}

.theme-tennis {
  --pico-primary: var(--color-tennis);
  --pico-primary-hover: #b8e600;
}

.theme-pickleball {
  --pico-primary: var(--color-pickleball);
  --pico-primary-hover: #e66000;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.15; margin-bottom: 0.4rem; }
h2 { font-size: 1.2rem;  font-weight: 700; line-height: 1.3;  margin-bottom: 0.4rem; }
h3 { font-size: 1.05rem; font-weight: 700; line-height: 1.3;  margin-bottom: 0.35rem; }
h4 { font-size: 1rem;    font-weight: 600;                     margin-bottom: 0.3rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 700; }
small  { font-size: 0.825rem; }
em     { font-style: italic; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  padding-top: 0;
  padding-bottom: 3rem;
}

/* 2-column default grid */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

/* hgroup: heading + subtitle or heading + button */
hgroup {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 0 1rem;
}
hgroup h1 { margin-bottom: 0; }
hgroup h2, hgroup p {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 0;
}

/* ---- Navigation ---- */
nav {
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 1rem;
  /* Break out of container to span full viewport width */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  position: sticky;
  top: 0;
  z-index: 1051;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Specific override for admin tabs to stay in flow and not overlap main nav */
#admin-tabs {
  position: relative;
  z-index: 100;
  width: auto;
  margin-left: 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
#admin-tabs ul {
  gap: 1rem;
}
#admin-tabs a {
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}
#admin-tabs a:hover {
  background: transparent;
  color: var(--green);
  text-decoration: none;
}
#admin-tabs a.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 700;
}

nav ul {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
nav a:hover { background: rgba(255,255,255,0.15); color: white; text-decoration: none; }

.logo {
  height: 32px;
  width: auto;
}

/* ---- Hamburger button ---- */
#hamburger-btn {
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  min-height: unset;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  box-shadow: none;
  transform: none;
  flex-shrink: 0;
}
#hamburger-btn:hover { background: rgba(255,255,255,0.15); box-shadow: none; transform: none; }

/* ---- Logged-out nav auth buttons ---- */
#nav-auth-btns {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-btn-login {
  color: rgba(255,255,255,0.88);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 0.25rem;
  white-space: nowrap;
}
.nav-btn-login:hover { color: white; text-decoration: none; }

.nav-btn-signup {
  background: var(--yellow);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.nav-btn-signup:hover { background: var(--yellow-dark); color: var(--text); text-decoration: none; }

/* ---- Nav dropdown ---- */
#nav-dropdown {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--green);
  opacity: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
#nav-dropdown.is-open { display: block; }

/* Base dropdown item */
.nav-dd-item {
  display: block;
  width: 100%;
  padding: 1rem 1.25rem;
  color: rgba(255,255,255,0.92);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  min-height: unset;
  cursor: pointer;
  transition: background var(--transition);
  box-shadow: none;
  transform: none;
}
.nav-dd-item:hover, .nav-dd-item:focus {
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
  box-shadow: none;
  transform: none;
}

/* Yellow "Add a Court" */
.nav-dd-yellow {
  background: var(--yellow);
  color: var(--text);
  margin: 0.75rem 1.25rem;
  width: calc(100% - 2.5rem);
  border-radius: var(--radius-full);
  border-bottom: none;
  text-align: center;
}
.nav-dd-yellow:hover {
  background: var(--yellow-dark);
  color: var(--text);
}

/* Outline "Logout" */
.nav-dd-outline {
  color: rgba(255,255,255,0.9);
  border: 1.5px solid rgba(255,255,255,0.45);
  margin: 0.5rem 1.25rem 0.75rem;
  width: calc(100% - 2.5rem);
  border-radius: var(--radius-full);
  border-bottom-width: 1.5px;
  text-align: center;
}
.nav-dd-outline:hover {
  background: rgba(255,255,255,0.12);
  color: white;
  border-color: rgba(255,255,255,0.7);
}

/* ---- Active Check-in Banner ---- */
#active-checkin-banner { max-width: 100%; padding: 0; }

#active-checkin-banner article {
  background: var(--yellow-light) !important;
  border: none !important;
  border-bottom: 2px solid var(--yellow) !important;
  border-radius: 0 !important;
  margin: 0 calc(50% - 50vw) !important;
  margin-bottom: 0 !important;
  padding: 0.55rem 1rem !important;
  box-shadow: none !important;
}
#active-checkin-banner a { color: var(--green); font-weight: 600; }
#active-checkin-banner p { font-size: 0.875rem; margin-bottom: 0; }
#active-checkin-banner button {
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: unset;
  box-shadow: none;
  transform: none;
  width: auto;
}
#active-checkin-banner button:hover {
  background: var(--green-dark);
  box-shadow: none;
  transform: none;
}

/* ---- Buttons ---- */
button,
a[role="button"],
[type="submit"],
[type="button"],
[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
  /* Default: primary = yellow */
  background: var(--yellow);
  color: var(--text);
  border-color: var(--yellow);
}
button:hover, a[role="button"]:hover, [type="submit"]:hover, [type="button"]:hover {
  background: var(--yellow-dark);
  border-color: var(--yellow-dark);
  box-shadow: var(--shadow);
  text-decoration: none;
}
button:active { transform: scale(0.98); }
button:disabled, [type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* .contrast — green solid */
button.contrast, a.contrast[role="button"] {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
button.contrast:hover, a.contrast[role="button"]:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

/* .outline — transparent + green border */
button.outline, a.outline[role="button"] {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}
button.outline:hover, a.outline[role="button"]:hover {
  background: var(--green-subtle);
  box-shadow: none;
}

/* .secondary — muted */
button.secondary {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
button.secondary:hover { background: var(--bg); box-shadow: none; }

/* .secondary.outline — inactive toggle state */
button.secondary.outline {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
button.secondary.outline:hover {
  background: var(--bg);
  border-color: var(--text-muted);
  box-shadow: none;
}

/* Submit buttons inside forms: full width */
form > [type="submit"],
form > button[type="submit"] {
  width: 100%;
  margin-top: 0.5rem;
}

/* Spinner on aria-busy buttons */
@keyframes cs-spin { to { transform: rotate(360deg); } }
button[aria-busy="true"]::after,
[type="submit"][aria-busy="true"]::after {
  content: '';
  display: block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: cs-spin 0.7s linear infinite;
  margin-left: 0.4rem;
  flex-shrink: 0;
}

/* ---- Forms ---- */
label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
  margin-bottom: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45,122,58,0.12);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.7; }
input[readonly] { background: var(--bg); color: var(--text-muted); cursor: default; }

/* .locked-input — "Already Verified" state styling */
input.locked-input {
  background-color: #e8f5e9 !important;
  border-color: var(--green) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d7a3a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.85rem center !important;
  background-size: 1.1rem !important;
  padding-right: 2.5rem !important;
  font-weight: 600 !important;
  color: var(--green-dark) !important;
}

/* Custom select chevron */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%235f7a62' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 11px;
  padding-right: 2.25rem;
  cursor: pointer;
}
textarea { resize: vertical; }

fieldset {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
fieldset legend {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.4rem;
  color: var(--text-muted);
}

/* Radio buttons in fieldsets (duration picker) */
fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}
fieldset input[type="radio"] {
  width: auto;
  margin-bottom: 0;
  accent-color: var(--green);
  cursor: pointer;
}

/* ---- Cards / Articles ---- */
article {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}

article > header {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

article > footer {
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border);
}

article[aria-busy="true"] {
  color: var(--text-muted);
  font-style: italic;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Dialogs / Modals ---- */
dialog {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: calc(100% - 2rem);
  max-width: 460px;
  max-height: min(92vh, 700px);
  overflow-y: auto;
}
dialog::backdrop {
  background: rgba(10, 20, 10, 0.55);
  backdrop-filter: blur(3px);
}

dialog article {
  box-shadow: none;
  border-radius: var(--radius-lg);
  margin-bottom: 0;
}

/* Dialog header: branded green bar */
dialog article > header {
  background: var(--green);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0.9rem 1.25rem;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
dialog article > header h3,
dialog article > header span { color: white; font-weight: 700; font-size: 1rem; }

/* Close button (.close from Pico pattern) */
.close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white !important;
  flex-shrink: 0;
  cursor: pointer;
  order: 2; /* push × to the right */
  text-decoration: none;
}
.close::before { content: '×'; font-size: 1.15rem; line-height: 1; }
.close:hover { background: rgba(255,255,255,0.35); text-decoration: none; }

/* Dialog footer */
dialog article > footer {
  padding: 0.85rem 1.25rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
dialog article > footer.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
dialog article > footer button,
dialog article > footer [type="submit"] {
  width: 100%;
  margin-top: 0;
}

dialog button:hover,
dialog [type="submit"]:hover,
dialog [type="button"]:hover,
dialog article > footer button:hover,
dialog article > footer [type="submit"]:hover {
  filter: brightness(0.9);
  border-color: var(--pico-primary-hover-border, var(--green-dark));
}

dialog button:active,
dialog [type="submit"]:active,
dialog [type="button"]:active,
dialog article > footer button:active,
dialog article > footer [type="submit"]:active {
  filter: brightness(0.8);
  transform: translateY(1px);
}

dialog button:focus,
dialog [type="submit"]:focus,
dialog [type="button"]:focus,
dialog article > footer button:focus,
dialog article > footer [type="submit"]:focus {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ---- Status ---- */
.status-available { color: var(--status-ok);   font-weight: 700; }
.status-busy      { color: var(--status-busy);  font-weight: 700; }

/* ---- Map ---- */
#map-wrap {
  position: relative;
  margin-top: 1rem;
}

#map {
  height: 65vh;
  min-height: 380px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.is-hidden {
    display: none !important;
}

#facilities-list {
    min-height: 50vh;
    height: auto;
}

#search-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

#skeleton-loader.active {
    display: flex !important;
}

.map-cluster-pin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a5c38;
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.map-tooltip {
  background: #1a2e1a !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
  white-space: nowrap;
}
.map-tooltip::before {
  border-top-color: #1a2e1a !important;
}

/* ---- Map Markers ---- */
.map-marker-pin {
  width: 40px;
  height: 48px;
  position: relative;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-marker-pin::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--marker-color, var(--green));
  border: 2.5px solid var(--marker-stroke, var(--green-dark));
  border-radius: 50% 50% 50% 5px;
  transform: rotate(-45deg);
}

.dual-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2.5px solid var(--green);
  border-radius: 24px;
  padding: 4px 8px;
  gap: 4px;
  position: relative;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
  width: fit-content;
  white-space: nowrap;
}

.dual-marker .icon-svg {
  width: 20px;
  height: 20px;
}

.dual-marker .map-marker-badge {
  top: -8px;
  right: -8px;
}

.map-marker-icon-wrap {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  color: #1a2e1a; /* Dark contrast for icons */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -6px; /* Offset for pin shape center */
}

.map-marker-icon-wrap .icon-svg {
  width: 100%;
  height: 100%;
  margin: 0;
}

.map-marker-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 3;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  border: 1.5px solid var(--border);
}

.map-marker-badge.is-busy {
  background: #fee2e2;
  color: #991b1b;
  border-color: #f87171;
}

.map-marker-badge.is-available {
  background: var(--green-subtle);
  color: var(--green);
  border-color: var(--green);
}

/* ---- Court Cards ---- */
.court-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
}
.court-count h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.15rem;
}
.court-count small {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Favorite button */
.favorite-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #c8d8ca;
  cursor: pointer;
  padding: 0.25rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: none;
  transform: none;
}
.favorite-btn:hover {
  color: var(--yellow-dark);
  background: var(--yellow-light);
  transform: scale(1.15);
  box-shadow: none;
}
.favorite-btn.is-favorited { color: var(--yellow-dark); }

/* ---- Facility Card Footer (View Details + Check In side-by-side) ---- */
.facility-card-footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.facility-card-footer > a[role="button"] {
  flex: 1;
  text-align: center;
}
/* Quick check-in / check-out buttons — compact, no flex-grow */
.quick-checkin-btn,
.quick-checkout-btn {
  flex-shrink: 0;
  padding: 0.6rem 0.9rem;
  min-height: 44px;
  font-size: 0.82rem;
  white-space: nowrap;
}

/* ---- Facility Card: Selected State & Map Button ---- */
.facility-card--selected {
  border-left: 3px solid var(--green);
  background-color: var(--green-subtle);
}

.facility-card__map-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  /* override pico button defaults */
  width: auto; min-height: unset; box-shadow: none;
}
.facility-card__map-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-subtle);
  box-shadow: none;
}

/* ---- Facilities Controls ---- */

#search-bar-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}
#search-bar-wrap::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 0;
  bottom: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f7a62' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  pointer-events: none;
}
#court-search {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
#court-search:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 122, 58, 0.12);
}
#court-search::-webkit-search-cancel-button { -webkit-appearance: none; }

#search-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 1.5rem;
  height: 1.5rem;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: var(--text-muted);
  color: white;
  font-size: 0.85rem;
  line-height: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity var(--transition);
}
#search-clear-btn:hover { opacity: 1; }

#controls-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

#sort-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.sort-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.1rem;
  white-space: nowrap;
}
.sort-btn {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  white-space: nowrap;
}
.sort-btn:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green);
}
.sort-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.sort-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

#view-toggle {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}
#view-toggle button {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  min-height: 40px;
}

/* Location prompt card */
#location-prompt {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.location-prompt-msg {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}
.location-prompt-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
#enable-location-btn {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-full);
  background: var(--green);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}
#enable-location-btn:hover { background: var(--green-dark); }
.location-or {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 0.15rem;
}
.location-zip-row {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  min-width: 160px;
}
.location-zip-row input {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
}
.location-zip-row input:focus {
  outline: none;
  border-color: var(--green);
}
#location-zip-submit {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color var(--transition), color var(--transition);
}
#location-zip-submit:hover { border-color: var(--green); color: var(--green); }

/* Expanded-beyond-radius notice */
#search-expanded-banner {
  background: var(--yellow-light);
  border: 1px solid var(--yellow-dark);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  color: #7a6200;
  margin-bottom: 0.75rem;
}

/* Empty-nearby empty state */
.empty-nearby-state {
  text-align: center;
  padding: 2.5rem 1rem;
}
.empty-nearby-state p {
  margin-bottom: 1.1rem;
  color: var(--text-muted);
}

/* ---- Stats Page ---- */
.stats-hero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem 0.6rem;
  text-align: center;
  margin-bottom: 0;
}
.stat-card-secondary {
  text-align: left;
  padding: 1rem 1.1rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.stat-green  { color: var(--green); }
.stat-streak { color: #b89200; }

.stat-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.stat-secondary-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.stat-secondary-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ---- Session Type Breakdown ---- */
.session-bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}
.session-bar-label {
  min-width: 68px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.session-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.session-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease);
}
.session-bar-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  min-width: 1.5rem;
  text-align: right;
}

/* ---- Session History Cards ---- */
.history-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem;
  border-left: 3px solid var(--border);
}
.history-card:has(.badge-match)    { border-left-color: var(--green); }
.history-card:has(.badge-practice) { border-left-color: #1d4ed8; }
.history-card:has(.badge-lesson)   { border-left-color: #6d28d9; }
.history-card:has(.badge-hitting)  { border-left-color: #b45309; }
.history-card:has(.badge-other)    { border-left-color: var(--text-muted); }

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.history-card-main a {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
}
.history-card-main a:hover { color: var(--green); }
.history-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  margin-bottom: 0;
}
.history-detail {
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.history-notes {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.3rem;
  margin-bottom: 0;
  white-space: pre-wrap;
}
.session-gear-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.gear-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.submitter-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.history-card-footer {
  text-align: right;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.edit-recap-btn {
  background: none;
  border: none;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  box-shadow: none;
  transform: none;
  border-radius: 0;
}
.edit-recap-btn:hover {
  color: var(--green-dark);
  box-shadow: none;
  transform: none;
  background: transparent;
}

/* ---- Session Badges ---- */
.session-badge, .badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.badge-match    { background: var(--green-subtle); color: var(--green); }
.badge-practice { background: #eff6ff; color: #1d4ed8; }
.badge-lesson   { background: #f5f3ff; color: #6d28d9; }
.badge-hitting  { background: #fffbeb; color: #b45309; }
.badge-other    { background: #f1f5f9; color: #64748b; }

/* Moderation Badges */
.badge-closed   { background: #fee2e2; color: #991b1b; } /* Red */
.badge-count    { background: #e0f2fe; color: #075985; } /* Blue */

/* ---- Star Rating ---- */
/* Primary definition inline in _footer.html; these are overrides */
.rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}
.rating > input { display: none; }
.rating > label { font-size: 2.25rem; color: #ccc; cursor: pointer; transition: color 0.15s; }
.rating > label:hover,
.rating > label:hover ~ label,
.rating > input:checked ~ label { color: var(--yellow); }

/* ---- Guest CTA (facility detail — logged-out) ---- */
.guest-cta-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.guest-cta-divider::before,
.guest-cta-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.guest-cta-btns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.guest-cta-btns a[role="button"] {
  width: 100%;
  text-align: center;
  margin: 0;
}
@media (min-width: 640px) {
  .guest-cta-btns { flex-direction: row; }
  .guest-cta-btns a[role="button"] { flex: 1; }
}

/* ---- Footer ---- */
footer p { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.25rem; }
footer a  { color: var(--text-muted); text-decoration: underline; }
footer a:hover { color: var(--green); }

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-tennis { color: var(--color-tennis); }
.text-pickleball { color: var(--color-pickleball); }

.tennis-body { fill: var(--color-tennis); }
.pb-body { fill: var(--color-pickleball); }

.icon-tennis { color: #CEFF00 !important; }
.icon-pickleball { color: #FF6B00 !important; }

.icon-svg {
  width: 32px;
  height: 32px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Onboarding Modal Icons */
.onboarding-sport-icon .icon-svg {
    width: 48px;
    height: 48px;
}
.onboarding-sport-btn.contrast {
    border-color: var(--green);
    background: var(--green-subtle);
    box-shadow: 0 0 0 2px var(--green);
}
.theme-pickleball .onboarding-sport-btn.contrast {
    border-color: var(--color-pickleball);
    background: var(--yellow-light);
    box-shadow: 0 0 0 2px var(--color-pickleball);
}

/* Onboarding Result Items */
.onboarding-facility-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    transition: background var(--transition);
}
.onboarding-facility-item:last-child {
    border-bottom: none;
}
.onboarding-facility-item:hover {
    background: var(--green-subtle);
}
.onboarding-facility-item.selected {
    background: var(--green);
    color: white;
}
.onboarding-facility-item.selected small {
    color: rgba(255, 255, 255, 0.8);
}
.theme-pickleball .onboarding-facility-item.selected {
    background: var(--color-pickleball);
}

.dual-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2.5px solid var(--green);
  border-radius: 24px; /* Original rounded-rect look */
  padding: 4px 8px;
  gap: 4px;
  position: relative;
  width: fit-content;
}

.dual-marker .icon-svg.map-marker-side {
  width: 20px;
  height: 20px;
}

.single-marker {
  position: relative;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
  display: flex;
  align-items: center;
  justify-content: center;
}

.single-marker .icon-svg.map-marker-large {
  width: 40px;
  height: 40px;
}

.dual-marker .map-marker-badge,
.single-marker .map-marker-badge {
  top: -8px;
  right: -8px;
}

/* ---- My Bag / Gear ---- */

.gear-section { margin-bottom: 1.75rem; }

.gear-section-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

/* Gear card — left accent border, same shadow pattern as history cards */
.gear-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.65rem;
  border-left: 4px solid var(--border);
}

/* Accent colors by type */
.gear-accent-racket { border-left-color: var(--green); }
.gear-accent-shoe   { border-left-color: #1d4ed8; }
.gear-accent-bag    { border-left-color: var(--yellow-dark); }
.gear-accent-other  { border-left-color: var(--text-muted); }

/* Retired cards are dimmed */
.gear-card-retired { opacity: 0.55; }
.gear-section-retired .gear-section-heading { color: var(--border); }

.gear-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.gear-card-name {
  font-weight: 700;
  font-size: 0.975rem;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.gear-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.gear-card-notes {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.4rem;
  margin-bottom: 0;
}
.gear-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: flex-start;
}

/* Attribute chips (grip size, surface, etc.) */
.gear-attr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}
.gear-attr-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--green-subtle);
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gear-retired-label {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.2rem;
}

/* Gear type toggle (button group) */
.gear-type-toggle {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.gear-type-btn {
  flex: 1;
  min-width: 72px;
  padding: 0.5rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 44px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
}
.gear-type-btn:hover {
  background: var(--green-subtle);
  border-color: var(--green);
  color: var(--green);
  box-shadow: none;
}
.gear-type-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
  box-shadow: none;
}
.gear-type-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Type-specific fields (shown/hidden by JS) */
.gear-type-fields { margin-bottom: 0.25rem; }

/* Stringing section inside a racket card */
.current-setup {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin-top: 0.65rem;
}
.setup-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.setup-mains {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.setup-crosses {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.setup-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.setup-notes {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.3rem;
}
.current-setup-loading,
.current-setup-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.4rem 0;
}

/* Individual string job rows in expanded history */
.string-job-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.string-job-row:last-child { border-bottom: none; }

/* Stringing modal — override max-height for longer form */
#stringing-modal {
  max-height: min(96vh, 760px);
}

/* Stringing modal fieldset labels: undo the global fieldset label override */
#stringing-form fieldset label {
  display: block;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-items: unset;
  cursor: auto;
  margin-bottom: 0.3rem;
}

/* ---- Toggle switch (same-as-mains) ---- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.toggle-label-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* Override global <label> defaults for the switch wrapper */
label.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  font-weight: 400;
}
label.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  margin: 0;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background 0.2s var(--ease);
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
label.toggle-switch input:checked + .toggle-track {
  background: var(--green);
}
label.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* ---- Crosses fieldset — animated slide-in ---- */
#crosses-fieldset {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  /* slight negative margin so there's no gap above when collapsed */
  transition: max-height 0.3s var(--ease), opacity 0.25s ease;
}
#crosses-fieldset.is-open {
  max-height: 400px;
  opacity: 1;
}

/* ---- Sport Boxes (Facility Cards) ---- */
.sport-box-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.sport-box {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}
.sport-box-tennis { border-left: 3px solid var(--green); }
.sport-box-pickleball { border-left: 3px solid #1d4ed8; }

.sport-box-icon {
  font-size: 1.2rem;
  margin-bottom: 0.1rem;
}
.sport-box-count {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.1;
}
.sport-box-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.sport-box-timestamp {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

/* ---- Responsive: 640px+ ---- */
@media (min-width: 640px) {
  h1 { font-size: 2.1rem; }

  nav { height: 60px; padding: 0 1.5rem; }
  #nav-dropdown { top: 60px; }
  .logo { height: 36px; }
  .container { padding: 0 1.5rem; }

  hgroup {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0 1rem;
  }

  #view-toggle { justify-content: flex-end; }

  .stat-number { font-size: 3rem; }
  .court-count h1 { font-size: 4.5rem; }
}

/* ---- Search Header & View Toggles ---- */
#search-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: nowrap;
}

#search-header #search-bar-wrap {
  flex: 1;
  margin-bottom: 0;
  min-width: 0;
}

#use-my-location-btn {
  flex-shrink: 0;
  min-height: 44px;
  height: 44px;
}

#view-toggle-icons {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 400px) {
  #use-my-location-btn {
    padding: 0.5rem;
    font-size: 0; /* Hide text on very small screens */
    width: 44px;
  }
  #use-my-location-btn::before {
    content: '📍';
    font-size: 1rem;
  }
}

.icon-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: none;
  transform: none;
}
.icon-btn:hover {
  background: var(--green-subtle);
  border-color: var(--green);
  color: var(--green);
  box-shadow: none;
}
.icon-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ---- Skeleton Loader ---- */
#skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skeleton-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.skeleton-bar {
  border-radius: 4px;
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  margin-bottom: 0.6rem;
}
.skeleton-bar:last-child { margin-bottom: 0; }

.skeleton-bar--title {
  width: 62%;
  height: 18px;
  margin-bottom: 0.8rem;
}
.skeleton-bar--address {
  width: 78%;
  height: 13px;
}
.skeleton-bar--sport {
  width: 100%;
  height: 52px;
  border-radius: var(--radius);
  margin-top: 0.4rem;
  margin-bottom: 0.8rem;
}
.skeleton-bar--footer {
  width: 55%;
  height: 32px;
  border-radius: var(--radius-sm);
}

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

/* ---- Search Spinner ---- */
.search-spinner {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}
.search-spinner:not([hidden]) {
  display: block;
}

@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}

/* ---- Controls Row Refined ---- */
#controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

#my-courts-wrap #my-courts-view-btn {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  min-height: 44px;
}
#my-courts-wrap #my-courts-view-btn.my-courts-active {
  background: var(--yellow);
  border-color: var(--yellow-dark);
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 480px) {
  #controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  #my-courts-wrap #my-courts-view-btn {
    width: 100%;
  }
}


@media (min-width: 768px) {
  h1 { font-size: 2.4rem; }
  .stat-number { font-size: 3.5rem; }
}

/* ---- Location Indicator ---- */
.location-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.location-indicator span {
  font-weight: 500;
}
.location-change-btn {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
  font-weight: 500;
}
.location-change-btn:hover {
  color: var(--green-dark);
}

/* ---- Facility Distance ---- */
.facility-distance {
  margin-bottom: 0.25rem;
  margin-top: 0;
}
.facility-distance small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---- Result Count ---- */
.result-count {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ---- Search This Area (map overlay) ---- */
.search-this-area-btn {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--transition);
}
.search-this-area-btn:hover {
  background: var(--green-subtle);
}

/* ---- Facilities: State Message Components ---- */

/* Empty state — neutral, informational */
.empty-state {
  background: var(--green-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  text-align: center;
  color: var(--text);
  margin-bottom: 1rem;
}
.empty-state p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
.empty-state-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.9rem;
}
.empty-action-btn {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.45rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.empty-action-btn:hover { background: var(--green-dark); }
.empty-action-btn.secondary {
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--green);
}
.empty-action-btn.secondary:hover { background: var(--green-subtle); }

/* Error state — warning, with retry */
.error-state {
  border-left: 4px solid var(--status-busy);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.error-state p {
  margin: 0;
  font-size: 0.95rem;
}
.error-retry-btn {
  background: transparent;
  border: 1.5px solid var(--status-busy);
  color: var(--status-busy);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.error-retry-btn:hover {
  background: var(--status-busy);
  color: #fff;
}

/* Load-more inline error */
.load-more-error-msg {
  margin-top: 0.65rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.load-more-retry-btn {
  background: none;
  border: none;
  color: var(--green);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  padding: 0;
}
.load-more-retry-btn:hover { color: var(--green-dark); }

/* Location needed — subtle below-fold hint */
.location-hint-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1.5rem 0;
  margin: 0;
}
