/*-----------------------
  Base
------------------------*/

/* Variables
--------------------*/

:root {
  --accent: #2f5d3a;
  --danger: #b42318;
  --ink: #222;
  --muted: #666;
  --line: #ddd;
  --ground: #e8e4dc;
}

/* Global
--------------------*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ground);
  overscroll-behavior: none;
}



/*-----------------------
  Map
------------------------*/

/* Global
--------------------*/

#map {
  height: 100vh;
  height: 100dvh;
  background: var(--ground);

  /* Long press adds a marker: no selection, no Safari callout */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}


/* Safe areas (installed app)
--------------------*/

.leaflet-top {
  top: env(safe-area-inset-top);
}

.leaflet-bottom {
  bottom: env(safe-area-inset-bottom);
}

.leaflet-left {
  left: env(safe-area-inset-left);
}

.leaflet-right {
  right: env(safe-area-inset-right);
}



/*-----------------------
  UI
------------------------*/

/* Buttons
--------------------*/

.leaflet-bar a.map-button {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.leaflet-bar a.map-button.is-active {
  color: var(--accent);
}

/* Layers switcher, same size as the other buttons */
.leaflet-control-layers .leaflet-control-layers-toggle {
  width: 26px;
  height: 26px;
  background-size: 20px 20px;
}

.leaflet-touch .leaflet-control-layers .leaflet-control-layers-toggle {
  width: 30px;
  height: 30px;
}

.map-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* Popups
--------------------*/

.leaflet-popup-content {
  margin: 10px 12px;
}


/* Legend
--------------------*/

.legend {
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  padding: 12px;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.3);
  outline: none;
  overflow: auto;
}

.legend::backdrop {
  background: rgb(0 0 0 / 0.4);
}

.legend img {
  display: block;
  max-width: 100%;
  height: auto;
}


/* Status
--------------------*/

.status {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.75);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.status[hidden] {
  display: none;
}



/*-----------------------
  Markers
------------------------*/

/* Pins
--------------------*/

.spot__bubble {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 7px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.4);
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.spot__bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

/* Not sent yet: small clock after the icons */
.spot.is-pending .spot__bubble::before {
  content: "";
  order: 1;
  width: 11px;
  height: 11px;
  margin-left: 3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='%23fff' stroke='%23D9822B' stroke-width='2'/%3E%3Cpath d='M8 4.5V8l2.5 1.5' fill='none' stroke='%23D9822B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.symbol {
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.3em;
}


/* Editor
--------------------*/

.spot-editor {
  display: grid;
  gap: 10px;
  min-width: 210px;
  font: 14px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.spot-editor__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.spot-editor__separator {
  flex-basis: 100%;
  height: 0;
  margin: 2px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.chip {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.chip:disabled {
  opacity: 1;
  cursor: default;
}

.spot-editor.is-readonly .chip[aria-pressed="false"],
.spot-editor.is-readonly .spot-editor__separator {
  display: none;
}

.spot-editor__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.spot-editor__delete {
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}

.spot-editor__done {
  margin-left: auto;
  padding: 5px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.spot-editor__status {
  color: var(--muted);
  font-size: 11px;
}



/*-----------------------
  Login
------------------------*/

/* Global
--------------------*/

body.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}

.login__form {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 300px;
  padding: 24px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.15);
}

.login__title {
  margin: 0;
  font-size: 20px;
  text-align: center;
}


/* Fields
--------------------*/

/* 16px avoids the iPhone zoom on focus */
.login__input {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}

.login__error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.login__button {
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
