/* KEC Parking Status — styles
   Widget is scoped under .kec-lots so it can also be dropped into a host
   page's stylesheet without collisions. */

html, body {
  margin: 0;
  padding: 0;
  background: #0f1638;
  min-height: 100%;
}
html.kl-embed, html.kl-embed body { background: #1a2456; height: 100%; overflow: hidden; }

.kec-lots {
  --kl-navy: #1a2456;
  --kl-navy-light: #243270;
  --kl-navy-surface: #1e2a5e;
  --kl-green: #2a8f5a;
  --kl-green-bright: #34b36a;
  --kl-green-bg: rgba(42,143,90,0.12);
  --kl-green-border: rgba(42,143,90,0.30);
  --kl-white: #ffffff;
  --kl-white-95: rgba(255,255,255,0.95);
  --kl-white-70: rgba(255,255,255,0.70);
  --kl-white-50: rgba(255,255,255,0.50);
  --kl-white-30: rgba(255,255,255,0.30);
  --kl-white-15: rgba(255,255,255,0.12);
  --kl-white-08: rgba(255,255,255,0.06);
  --kl-red: #d94040;
  --kl-red-bg: rgba(217,64,64,0.12);
  --kl-red-border: rgba(217,64,64,0.30);
  --kl-amber: #e8a832;
  --kl-amber-bg: rgba(232,168,50,0.10);

  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--kl-white);
  background: var(--kl-navy);
  border-radius: 14px;
  overflow: hidden;
  max-width: 1040px;
  margin: 2rem auto 2.5rem;
  box-shadow: 0 8px 40px rgba(26,36,86,0.35);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.kec-lots *, .kec-lots *::before, .kec-lots *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Header ── */
.kec-lots .kl-header {
  background: linear-gradient(135deg, var(--kl-navy) 0%, var(--kl-navy-light) 100%);
  padding: 1rem 1.15rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--kl-green);
}
.kec-lots .kl-hdr-left { display: flex; align-items: center; gap: 0.7rem; }
.kec-lots .kl-logo {
  width: 34px; height: 34px; background: var(--kl-green); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.6rem; color: var(--kl-white); line-height: 1;
  flex-shrink: 0; letter-spacing: 0.04em;
}
.kec-lots .kl-hdr-titles { display: flex; flex-direction: column; }
.kec-lots .kl-title {
  font-size: 1.05rem; font-weight: 800; color: var(--kl-white); line-height: 1.15;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.kec-lots .kl-subtitle {
  font-size: 0.62rem; font-weight: 600; color: var(--kl-green-bright);
  text-transform: uppercase; letter-spacing: 0.1em; line-height: 1; margin-top: 0.15rem;
}
.kec-lots .kl-hdr-right {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--kl-white-08); border: 1px solid var(--kl-white-15);
  border-radius: 100px; padding: 0.3rem 0.7rem;
}
.kec-lots .kl-live-dot {
  width: 7px; height: 7px; background: var(--kl-green-bright);
  border-radius: 50%; animation: keclotsPulse 2s infinite;
}
@keyframes keclotsPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(52,179,106,0.5); }
  50% { box-shadow: 0 0 0 5px rgba(52,179,106,0); }
}
.kec-lots .kl-updated { font-size: 0.62rem; color: var(--kl-white-70); font-weight: 600; white-space: nowrap; }
.kec-lots .kl-updated.loading { animation: keclotsLoadPulse 1.5s ease-in-out infinite; }
@keyframes keclotsLoadPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Toolbar ── */
.kec-lots .kl-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 0.55rem 1rem;
  background: var(--kl-navy); border-bottom: 1px solid var(--kl-white-15);
}
.kec-lots .kl-search-wrap { flex: 1; position: relative; min-width: 0; }
.kec-lots .kl-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: rgba(255,255,255,0.4); pointer-events: none;
}
.kec-lots .kl-search {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 9px;
  border: 1.5px solid var(--kl-white-15); background: var(--kl-white-08);
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--kl-white);
  outline: none; transition: border-color 0.2s; -webkit-appearance: none; appearance: none;
}
.kec-lots .kl-search::-webkit-search-cancel-button { display: none; }
.kec-lots .kl-search::placeholder { color: rgba(255,255,255,0.35); font-weight: 500; }
.kec-lots .kl-search:focus { border-color: var(--kl-green); background: rgba(255,255,255,0.08); }
.kec-lots .kl-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: none; color: rgba(255,255,255,0.6);
  cursor: pointer; display: none; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; padding: 0;
}
.kec-lots .kl-search-clear.visible { display: flex; }

.kec-lots .kl-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1e2a5e; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; max-height: 200px; overflow-y: auto;
  z-index: 1500; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.kec-lots .kl-search-results.visible { display: block; }
.kec-lots .kl-search-result {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  transition: background 0.1s; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.kec-lots .kl-search-result:last-child { border-bottom: none; }
.kec-lots .kl-search-result:hover, .kec-lots .kl-search-result:active { background: rgba(255,255,255,0.08); }
.kec-lots .kl-search-result-icon {
  width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.kec-lots .kl-search-result-icon.open { background: rgba(42,143,90,0.15); color: #34b36a; }
.kec-lots .kl-search-result-icon.closed { background: rgba(217,64,64,0.15); color: #e85555; }
.kec-lots .kl-search-result-icon.building { background: rgba(91,125,184,0.12); color: #5b7db8; }
.kec-lots .kl-search-result-name { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); }
.kec-lots .kl-search-result-status {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  margin-left: auto; flex-shrink: 0;
}
.kec-lots .kl-search-result-status.open { color: #34b36a; }
.kec-lots .kl-search-result-status.closed { color: #e85555; }
.kec-lots .kl-search-empty { padding: 12px 14px; font-size: 12px; color: rgba(255,255,255,0.35); }

.kec-lots .kl-filter-pills { display: flex; gap: 4px; flex-shrink: 0; }
.kec-lots .kl-fpill {
  padding: 7px 12px; border-radius: 100px; border: 1.5px solid var(--kl-white-15);
  background: var(--kl-white-08); font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--kl-white-50); cursor: pointer; transition: all 0.15s;
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1;
}
.kec-lots .kl-fpill:hover { border-color: var(--kl-white-30); color: var(--kl-white-70); }
.kec-lots .kl-fpill.active { border-color: var(--kl-green); background: var(--kl-green); color: var(--kl-white); }
.kec-lots .kl-fpill.active-red { border-color: var(--kl-red); background: var(--kl-red); color: var(--kl-white); }
@media (max-width: 400px) { .kec-lots .kl-fpill { padding: 7px 9px; font-size: 10px; } }

/* ── Map ── */
.kec-lots .kl-map-section {
  display: none; border-bottom: 1px solid var(--kl-white-15);
  background: var(--kl-navy-surface); position: relative;
}
.kec-lots .kl-map-section.visible { display: block; }
.kec-lots .kl-map-frame { width: 100%; height: 70vh; min-height: 500px; max-height: 800px; background: #e8ecf0; }
.kec-lots .leaflet-popup-pane, .kec-lots .leaflet-popup-tip-container { display: none !important; }
/* Basemap attribution: keep it compact */
.kec-lots .leaflet-control-attribution { background: rgba(255,255,255,0.75); font-size: 10px; }
/* Neutralize the basemap's colors so lot/building overlays stand out */
.kec-lots .leaflet-tile-pane { filter: grayscale(0.9) brightness(1.06) contrast(0.92); }

/* ── Bottom sheet ── */
.kec-lots .kl-sheet-overlay {
  display: none; position: absolute; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.35); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.kec-lots .kl-sheet-overlay.visible { display: block; }
.kec-lots .kl-sheet {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1200;
  background: #1e2a5e; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  color: #fff; max-height: 70%; overflow-y: auto;
}
.kec-lots .kl-sheet.visible { transform: translateY(0); }
.kec-lots .kl-sheet-handle { display: flex; justify-content: center; padding: 10px 0 4px; }
.kec-lots .kl-sheet-handle-bar { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.2); }
.kec-lots .kl-sheet-header { padding: 8px 20px 10px; display: flex; align-items: flex-start; gap: 14px; }
.kec-lots .kl-sheet-info { flex: 1; min-width: 0; }
.kec-lots .kl-sheet-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kec-lots .kl-sheet-title { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: 0.02em; line-height: 1.2; }
.kec-lots .kl-sheet-badge {
  font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 100px;
  text-transform: uppercase; letter-spacing: 0.05em; display: inline-block; line-height: 1.4;
}
.kec-lots .kl-sheet-badge.open { background: rgba(42,143,90,0.18); color: #34b36a; }
.kec-lots .kl-sheet-badge.closed { background: rgba(217,64,64,0.18); color: #e85555; }
.kec-lots .kl-sheet-note { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 5px; line-height: 1.4; }
.kec-lots .kl-sheet-icon {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kec-lots .kl-sheet-icon.open { background: rgba(42,143,90,0.12); border: 2px solid rgba(42,143,90,0.35); }
.kec-lots .kl-sheet-icon.closed { background: rgba(217,64,64,0.12); border: 2px solid rgba(217,64,64,0.35); }
.kec-lots .kl-sheet-icon.building { background: rgba(91,125,184,0.15); border: 2px solid rgba(91,125,184,0.3); }
.kec-lots .kl-sheet-icon svg { width: 20px; height: 20px; }
.kec-lots .kl-sheet-actions { padding: 4px 20px 20px; display: flex; gap: 8px; }
.kec-lots .kl-sheet-actions.stack { flex-direction: column; }
.kec-lots .kl-sheet-label {
  padding: 0 20px 6px; font-size: 11px; color: rgba(255,255,255,0.4); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.kec-lots .kl-sheet-btn-dir {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 14px 16px; border-radius: 12px; background: #2a8f5a; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700; text-decoration: none; letter-spacing: 0.01em;
  transition: background 0.15s; cursor: pointer; border: none;
}
.kec-lots .kl-sheet-btn-dir:hover { background: #34b36a; }
.kec-lots .kl-sheet-btn-dir.secondary { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); }
.kec-lots .kl-sheet-btn-dir.secondary:hover { background: rgba(255,255,255,0.14); }
.kec-lots .kl-sheet-btn-dir svg { width: 17px; height: 17px; flex-shrink: 0; }
.kec-lots .kl-sheet-btn-share {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 18px; border-radius: 12px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.85);
  font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none;
  transition: all 0.15s; cursor: pointer;
}
.kec-lots .kl-sheet-btn-share:hover { background: rgba(255,255,255,0.1); color: #fff; }
.kec-lots .kl-sheet-btn-share svg { width: 16px; height: 16px; flex-shrink: 0; }
.kec-lots .kl-sheet-empty { padding: 0 20px 20px; font-size: 13px; color: rgba(255,255,255,0.3); text-align: center; }

@media (min-width: 601px) {
  .kec-lots .kl-sheet {
    left: 50%; right: auto; width: 360px; transform: translateX(-50%) translateY(100%);
    border-radius: 14px; bottom: 16px; max-height: 60%;
  }
  .kec-lots .kl-sheet.visible { transform: translateX(-50%) translateY(0); }
  .kec-lots .kl-sheet-handle { display: none; }
}

/* Leaflet marker hygiene: only our SVG div-icons should show */
.kec-lots .leaflet-marker-shadow,
.kec-lots .leaflet-shadow-pane img,
.kec-lots .leaflet-marker-pane img:not([src*="data:"]) { display: none !important; }
.kec-lots .leaflet-div-icon, .kec-lots .kl-lot-badge, .kec-lots .kl-user-loc, .kec-lots .kl-label-icon {
  background: none !important; border: none !important; box-shadow: none !important;
}
.kec-lots .leaflet-marker-pane .leaflet-div-icon { overflow: visible !important; }

.kec-lots .kl-map-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 1000;
  background: rgba(26,36,86,0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 8px; padding: 0.5rem 0.7rem; display: flex; gap: 0.75rem; border: 1px solid rgba(255,255,255,0.1);
}
.kec-lots .kl-legend-item {
  display: flex; align-items: center; gap: 0.3rem; font-size: 0.62rem; font-weight: 700;
  color: rgba(255,255,255,0.8); text-transform: uppercase; letter-spacing: 0.04em;
}
.kec-lots .kl-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Clusters */
.kec-lots .marker-cluster { background: rgba(42,143,90,0.25) !important; border-radius: 50% !important; }
.kec-lots .marker-cluster div {
  background: #2a8f5a !important; color: #fff !important; font-family: inherit !important;
  font-weight: 800 !important; font-size: 13px !important; border-radius: 50% !important;
  width: 36px !important; height: 36px !important; line-height: 36px !important;
  margin-left: 2px !important; margin-top: 2px !important; text-align: center !important;
}
.kec-lots .marker-cluster-medium { background: rgba(232,168,50,0.25) !important; }
.kec-lots .marker-cluster-medium div { background: #d4922a !important; }
.kec-lots .marker-cluster-large { background: rgba(217,64,64,0.2) !important; }
.kec-lots .marker-cluster-large div { background: #d94040 !important; }

/* User location */
.kec-lots .kl-user-dot { width: 20px; height: 20px; position: relative; display: flex; align-items: center; justify-content: center; }
.kec-lots .kl-user-dot::after {
  content: ''; width: 14px; height: 14px; background: #4285f4; border: 2.5px solid #fff; border-radius: 50%;
  box-shadow: 0 1px 6px rgba(66,133,244,0.5); position: relative; z-index: 2;
}
.kec-lots .kl-user-dot-pulse {
  position: absolute; width: 20px; height: 20px; background: rgba(66,133,244,0.3); border-radius: 50%;
  z-index: 1; animation: kecUserPulse 2s ease-out infinite;
}
@keyframes kecUserPulse { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(2.5); opacity: 0; } }

/* POI pins (entrances etc.) */
.kec-lots .kl-poi { background: none !important; border: none !important; overflow: visible !important; }
.kec-lots .kl-poi-wrap { position: relative; width: 32px; height: 42px; }
.kec-lots .kl-poi-wrap svg { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3)); }
.kec-lots .kl-poi-label {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 2px);
  background: rgba(255,255,255,0.92); color: #3a2a8a; border: 1px solid rgba(106,79,216,0.35);
  border-radius: 6px; padding: 2px 7px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.kec-lots .kl-search-result-icon.entrance { background: rgba(106,79,216,0.15); color: #8b74e8; }

/* Polygon labels */
.kec-lots .kl-label-icon { width: 0 !important; height: 0 !important; overflow: visible !important; }
.kec-lots .kl-map-label {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 0.55rem; font-weight: 700; color: #1a2456;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 0 2px rgba(255,255,255,0.7);
  white-space: nowrap; pointer-events: none; text-transform: uppercase; letter-spacing: 0.03em; text-align: center;
}

.kec-lots .kl-map-label-lg {
  font-size: 0.8rem; letter-spacing: 0.08em; color: #2a2060;
  text-shadow: 0 1px 4px rgba(255,255,255,0.95), 0 0 3px rgba(255,255,255,0.9), 0 0 10px rgba(255,255,255,0.8);
}
.kec-lots .kl-sheet-note a { color: #8fb7ff; text-decoration: underline; word-break: break-all; }
.kec-lots .kl-sheet-note a:hover { color: #fff; }

/* ── Announcement / error ── */
.kec-lots .kl-announce {
  display: none; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem;
  background: var(--kl-amber-bg); border-bottom: 1px solid rgba(232,168,50,0.2);
}
.kec-lots .kl-announce.visible { display: flex; }
.kec-lots .kl-announce-icon {
  width: 30px; height: 30px; border-radius: 8px; background: var(--kl-amber);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kec-lots .kl-announce-icon svg { width: 15px; height: 15px; stroke: var(--kl-white); }
.kec-lots .kl-announce-text { font-size: 0.82rem; font-weight: 600; color: var(--kl-white-95); line-height: 1.35; }
.kec-lots .kl-error {
  display: none; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem;
  background: var(--kl-red-bg); border-bottom: 1px solid var(--kl-red-border);
  font-size: 0.72rem; font-weight: 600; color: var(--kl-red);
}
.kec-lots .kl-error.visible { display: flex; }
.kec-lots .kl-error svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Inactive system ── */
.kec-lots.kl-inactive .kl-filter-pills { opacity: 0.3; pointer-events: none; }
.kec-lots.kl-inactive .kl-announce.inactive-banner { background: rgba(91,125,184,0.12); border-bottom-color: rgba(91,125,184,0.2); }
.kec-lots.kl-inactive .kl-announce.inactive-banner .kl-announce-icon { background: #5b7db8; }

.kec-lots .kl-sticky-top { position: sticky; top: 0; z-index: 1300; background: var(--kl-navy); }

/* ── Responsive ── */
@media (min-width: 601px) and (max-width: 900px) {
  .kec-lots { max-width: 100%; margin: 1.5rem 1rem 2rem; border-radius: 12px; }
  .kec-lots .kl-map-frame { height: 60vh; min-height: 450px; max-height: 700px; }
  .kec-lots .kl-map-label { font-size: 0.5rem; }
}
@media (max-width: 600px) {
  .kec-lots { border-radius: 0; margin: 0; max-width: 100%; }
  .kec-lots .kl-map-frame { height: calc(100vh - 120px); height: calc(100dvh - 120px); min-height: 400px; max-height: none; }
  .kec-lots .kl-header { padding: 0.5rem 0.75rem; }
  .kec-lots .kl-title { font-size: 0.92rem; }
  .kec-lots .kl-subtitle { font-size: 0.55rem; }
  .kec-lots .kl-toolbar { padding: 0.45rem 0.75rem; }
  .kec-lots .kl-search { padding: 8px 12px 8px 32px; font-size: 12px; }
  .kec-lots .kl-map-label { font-size: 0.45rem; }
  .kec-lots .kl-sheet { max-height: 50vh; }
  .kec-lots .kl-announce { font-size: 0.72rem; padding: 0.5rem 0.75rem; }
  .kec-lots .kl-map-legend { bottom: 30px; left: 8px; padding: 0.4rem 0.6rem; gap: 0.55rem; }
  .kec-lots .leaflet-control-attribution { font-size: 9px; }
}
@media (min-width: 1100px) {
  .kec-lots .kl-map-frame { height: 70vh; min-height: 550px; max-height: 850px; }
}

/* ── Embed mode (inside an iframe, or ?embed=1): fill the frame edge to edge ── */
html.kl-embed .kec-lots {
  margin: 0; border-radius: 0; max-width: none; box-shadow: none;
  height: 100vh; height: 100dvh; display: flex; flex-direction: column;
}
html.kl-embed .kec-lots .kl-sticky-top { position: relative; flex-shrink: 0; }
html.kl-embed .kec-lots .kl-map-section.visible { flex: 1; min-height: 0; display: flex; flex-direction: column; border-bottom: none; }
html.kl-embed .kec-lots .kl-map-frame { flex: 1; height: auto; min-height: 0; max-height: none; }
