@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #252522;
  --muted: #77766f;
  --line: #e9e5dc;
  --paper: #fbfaf7;
  --saffron: #d9673e;
  --saffron-dark: #b94729;
  --olive: #65734d;
  --sidebar-width: 390px;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body { min-width: 320px; min-height: 100vh; margin: 0; }

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #db815e;
  outline-offset: 2px;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: relative;
  z-index: 700;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.location-search { position: relative; z-index: 20; width: min(38vw, 480px); display: flex; align-items: center; gap: 6px; }
.location-search input { flex: 1; min-width: 0; height: 38px; padding: 0 11px; border: 1px solid #ded9cf; border-radius: 6px; color: var(--ink); background: #fff; font-size: 11px; }
.location-search input::placeholder { color: #96948c; }
.location-search .button { min-height: 38px; }
.location-suggestions { position: absolute; z-index: 30; top: calc(100% + 5px); right: 54px; left: 0; max-height: min(55vh, 360px); overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 8px 24px #29241a22; }
.location-suggestions[hidden] { display: none; }
.location-suggestion { width: 100%; display: grid; gap: 3px; padding: 9px 11px; border: 0; border-bottom: 1px solid #f0ede7; color: var(--ink); background: #fff; text-align: left; cursor: pointer; }
.location-suggestion:last-child { border-bottom: 0; }
.location-suggestion:hover, .location-suggestion[aria-selected="true"] { background: #f7f4ed; }
.location-suggestion strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.location-suggestion span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff9ef;
  background: var(--saffron);
  border-radius: 50% 50% 46% 46%;
  font-family: Georgia, serif;
  font-size: 23px;
}
.brand strong { display: block; font-family: "Playfair Display", serif; font-size: 18px; line-height: 1.1; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; letter-spacing: 1.25px; }
.map-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #83a36a; }

.button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-quiet { color: var(--ink); border-color: var(--line); background: transparent; }
.button-quiet:hover, .button-outline:hover { background: #f1eee7; }
.button-primary { color: white; background: var(--saffron); }
.button-primary:hover:not(:disabled) { background: var(--saffron-dark); }
.button-outline { color: var(--ink); border-color: var(--line); background: white; }
.button-more { width: 100%; margin: 5px 0 0; color: var(--saffron-dark); border-color: var(--line); background: transparent; }
.button-small { min-height: 34px; white-space: nowrap; }

.workspace { height: calc(100vh - 72px); min-height: 610px; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { min-height: 0; display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--line); background: var(--paper); }
.intro { padding: 25px 25px 18px; }
.eyebrow { margin: 0 0 8px; color: #9b6954; font-size: 9px; font-weight: 700; letter-spacing: 1.45px; }
h1, h2, p { margin-top: 0; }
.intro h1 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 34px; font-weight: 600; line-height: 1.08; letter-spacing: -.6px; }
.intro h1 span { color: var(--saffron); }
.intro-copy { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.control-section { padding: 13px 20px 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.field-label { display: block; margin: 0 0 6px; color: #68675f; font-size: 10px; font-weight: 600; }
.select-control {
  width: 100%;
  min-width: 0;
  height: 37px;
  padding: 0 29px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
}
.search-box { height: 40px; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 10px; border: 1px solid #ded9cf; border-radius: 6px; background: #fff; }
.search-box > span { color: #8a887f; font-size: 23px; line-height: 1; transform: rotate(-18deg); }
.search-box input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #96948c; }
.search-box kbd { padding: 2px 5px; border: 1px solid #eae6df; border-radius: 4px; color: #97948b; background: #faf9f6; font-size: 9px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.nearby-note { margin-top: 9px; color: var(--olive); font-size: 10px; }

.results-section { padding: 16px 20px 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-heading .eyebrow { margin-bottom: 4px; }
.section-heading h2 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 18px; font-weight: 600; }
.result-count { padding: 4px 7px; border-radius: 12px; color: #747269; background: #f0eee7; font-size: 9px; white-space: nowrap; }
.results-list { display: grid; gap: 7px; margin-top: 12px; }
.empty-state { padding: 18px 10px; color: var(--muted); text-align: center; font-size: 11px; }
.pandal-card {
  position: relative;
  padding: 10px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pandal-card:hover, .pandal-card.is-selected { border-color: #d8896e; box-shadow: 0 2px 8px #5c35200d; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { margin: 0; font-size: 11px; font-weight: 700; line-height: 1.4; }
.card-rating { flex: 0 0 auto; color: #967343; font-size: 10px; }
.card-location { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.pill { padding: 3px 6px; border-radius: 10px; color: #6b6a62; background: #f3f1eb; font-size: 8px; }
.pill-featured { color: #9a4e32; background: #fbede5; }
.card-actions { display: flex; justify-content: flex-end; gap: 11px; margin-top: 7px; }
.card-action { padding: 0; border: 0; color: var(--saffron-dark); background: none; font-size: 10px; font-weight: 600; }
.card-action:hover { text-decoration: underline; }
.card-action:disabled { color: #9a988f; cursor: not-allowed; text-decoration: none; }

.plan-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(760px, calc(100% - 36px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 18px 60px #29241a35;
}
.plan-dialog::backdrop { background: #25252280; backdrop-filter: blur(2px); }
.trip-section { padding: 20px; background: #f7f5ef; }
.trip-heading { align-items: flex-start; }
.trip-heading h2 { display: flex; align-items: center; gap: 7px; }
.plan-dialog-actions { display: flex; align-items: center; gap: 12px; }
.plan-dialog-actions .icon-button { box-shadow: none; font-size: 19px; }
.plan-count { display: inline-grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: #8b4b32; background: #f2e1d7; font-family: "DM Sans", sans-serif; font-size: 9px; }
.text-button { padding: 3px 0; border: 0; color: #8b6d5c; background: transparent; font-size: 10px; }
.plan-list { display: grid; gap: 5px; max-height: min(48vh, 440px); margin-top: 10px; overflow-y: auto; }
.plan-empty { padding: 9px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.plan-item { display: grid; grid-template-columns: 17px 1fr auto; align-items: center; gap: 6px; padding: 6px 7px; border: 1px solid #e8e3d9; border-radius: 6px; background: #fff; }
.plan-item input { accent-color: var(--olive); }
.plan-item.visited .plan-name { color: #85837b; text-decoration: line-through; }
.plan-name { overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.plan-controls { display: flex; gap: 1px; }
.plan-controls button { width: 21px; height: 21px; padding: 0; border: 0; border-radius: 4px; color: #827f75; background: transparent; font-size: 12px; }
.plan-controls button:hover:not(:disabled) { background: #f2f0e9; }
.plan-controls button:disabled { opacity: .3; cursor: default; }
.route-actions { display: grid; grid-template-columns: 1fr; gap: 7px; margin-top: 10px; }
.route-actions .button { width: 100%; min-height: 37px; }
.route-help { margin: 7px 0 0; color: #89877e; font-size: 9px; line-height: 1.45; }

.map-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #e9e8df; }
#map { position: absolute; inset: 0; background: #e9e8df; }
.map-toolbar { position: absolute; z-index: 500; top: 16px; right: 17px; left: 17px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-status, .provider-picker, .icon-button { box-shadow: 0 2px 12px #29241a12; }
.map-status { min-height: 35px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #e9e5dc; border-radius: 6px; background: #fff; font-size: 10px; }
.map-status-dot { width: 7px; height: 7px; }
.map-tools { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.provider-picker { display: flex; align-items: center; gap: 8px; min-height: 35px; padding: 0 9px; border: 1px solid #e9e5dc; border-radius: 6px; background: #fff; }
.provider-picker span { color: #929087; font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.provider-picker select { max-width: 130px; border: 0; outline: 0; color: var(--ink); background: white; font-size: 10px; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid #e9e5dc; border-radius: 6px; color: #747269; background: #fff; font-size: 14px; }
.icon-button:hover { background: #f5f2ec; }
.map-key-panel { position: absolute; z-index: 600; top: 60px; right: 17px; width: min(420px, calc(100% - 34px)); padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 8px 24px #29241a1c; }
.map-key-panel form { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.key-panel-copy { flex: 1 0 100%; display: grid; gap: 4px; }
.key-panel-copy strong { font-size: 12px; }
.key-panel-copy span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.map-key-panel input { flex: 1; min-width: 130px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 10px; }
.map-key-panel .icon-button { width: 31px; height: 31px; box-shadow: none; }
.map-legend { position: absolute; z-index: 400; bottom: 31px; left: 17px; display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 10px; border: 1px solid #e9e5dc; border-radius: 6px; background: #fff; box-shadow: 0 2px 10px #29241a12; }
.map-legend > span { display: inline-flex; align-items: center; gap: 5px; color: #66645c; font-size: 9px; }
.legend-marker { width: 9px; height: 9px; display: inline-block; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #777; }
.legend-city { background: var(--saffron); }
.legend-gov { background: #64764e; }
.legend-cluster { width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 50%; color: white; background: #78694d; font-size: 8px; font-style: normal; }
.map-attribution { position: absolute; z-index: 400; right: 0; bottom: 0; padding: 4px 7px; color: #55534d; background: #ffffffd9; font-size: 9px; }
.map-attribution a { color: #3d6546; }
.toast { position: absolute; z-index: 800; right: 17px; bottom: 58px; max-width: min(390px, calc(100% - 34px)); padding: 11px 14px; border: 1px solid #dfc2b4; border-radius: 7px; color: #6d3929; background: #fff8f3; box-shadow: 0 4px 18px #29241a1c; font-size: 11px; line-height: 1.45; }
.toast.is-error { border-color: #dfb1a8; color: #812f25; background: #fff5f2; }

.cluster-marker { width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: #8a7053; box-shadow: 0 2px 9px #30271e55; font: 700 10px "DM Sans", sans-serif; }
.cluster-marker.large { width: 43px; height: 43px; background: #77543f; font-size: 11px; }
.point-marker { width: 17px; height: 17px; border: 3px solid #fff; border-radius: 50% 50% 50% 3px; background: var(--saffron); box-shadow: 0 1px 5px #30271e70; transform: rotate(-45deg); }
.point-marker.government { background: #65734d; }
.map-popup {
  box-sizing: border-box;
  width: min(340px, calc(100vw - 48px));
  min-width: min(300px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  padding: 14px 16px;
  overflow-wrap: anywhere;
  border: 1px solid #e8e5df;
  border-radius: 11px;
  color: #202124;
  background: #fff;
  box-shadow: 0 4px 16px #2021242b;
  white-space: normal;
  line-height: 1.45;
  font-family: "DM Sans", sans-serif;
}
.map-popup strong { display: block; margin-bottom: 6px; color: #202124; font-size: 14px; font-weight: 700; line-height: 1.35; }
.map-popup span { display: block; max-width: 100%; color: #5f6368; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; white-space: normal; }
.map-popup .map-popup-coordinate { margin-top: 6px; color: #3c4043; font-variant-numeric: tabular-nums; }
.map-popup-coordinate b { color: #70757a; font-weight: 600; }
.map-popup a { display: inline-block; max-width: 100%; margin-top: 10px; color: #1a73e8; font-size: 12px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; white-space: normal; }
.leaflet-tooltip.map-hover-details-tooltip {
  width: min(340px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  white-space: normal;
}
.leaflet-tooltip.map-hover-details-tooltip .map-popup { width: min(340px, calc(100vw - 48px)); }
.leaflet-tooltip.map-hover-details-tooltip::before { display: none; }
.digipin-location-marker { background: #3977ca; }
.user-marker { width: 18px; height: 18px; border: 3px solid white; border-radius: 50%; background: #3977ca; box-shadow: 0 0 0 6px #3977ca35; }

.leaflet-container { font-family: "DM Sans", sans-serif; }
.leaflet-popup-content-wrapper { padding: 0; border-radius: 11px; background: transparent; box-shadow: none; }
.leaflet-popup-content { margin: 0; }
.leaflet-popup-close-button { z-index: 1; }
.leaflet-control-attribution { display: none !important; }
.gm-style .gm-style-iw-c { padding: 0 !important; border: 0; border-radius: 11px; background: transparent; box-shadow: none; }
.gm-style .gm-style-iw-d { max-width: min(340px, calc(100vw - 48px)) !important; overflow: visible !important; }
.gm-style .gm-style-iw-chr { position: absolute; top: 5px; right: 5px; }
.gm-style .gm-style-iw-tc { display: none; }

@media (max-width: 850px) {
  :root { --sidebar-width: 345px; }
  .topbar { padding: 0 18px; }
  .location-search { width: min(34vw, 360px); }
  .intro { padding-left: 20px; }
}

@media (max-width: 660px) {
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; gap: 9px 8px; padding: 9px 13px; }
  .brand-mark { width: 34px; height: 34px; }
  .location-search { order: 3; width: 100%; }
  .button-quiet { min-height: 34px; padding: 0 9px; font-size: 10px; }
  .workspace { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .sidebar { display: contents; }
  .intro { order: 0; padding: 19px 17px 13px; }
  .intro h1 { font-size: 30px; }
  .intro-copy { margin-top: 6px; }
  .control-section { order: 1; padding: 12px 15px; }
  .map-panel { order: 2; height: 54vh; min-height: 360px; }
  .results-section { order: 3; padding: 17px 15px; }
  .map-toolbar { top: 10px; right: 10px; left: 10px; }
  .map-status { max-width: 58%; min-height: 32px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .provider-picker { min-height: 32px; padding: 0 7px; }
  .provider-picker select { max-width: 105px; font-size: 9px; }
  .icon-button { width: 31px; height: 31px; }
  .map-legend { bottom: 28px; left: 9px; gap: 8px; padding: 6px 7px; }
  .map-legend > span { font-size: 8px; }
  .map-key-panel { top: 49px; right: 10px; }
}

@media (max-width: 430px) {
  .topbar-actions { gap: 5px; }
  .topbar-actions .button { min-height: 32px; gap: 5px; padding: 0 7px; font-size: 9px; }
  .location-search input, .location-search .button { height: 35px; min-height: 35px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
