/* Places, place editor and rules (PlacesController, PlaceRulesController). */

/* --- Maps --------------------------------------------------------------- */
.places-map {
  height: 42vh; min-height: 220px;
  margin-bottom: var(--gap);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; position: relative; z-index: 0; isolation: isolate;
}
.places-map--short { height: 30vh; }
.places-map--editor { height: 50vh; min-height: 280px; margin-bottom: 0; cursor: crosshair; }

.place-label {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 0; box-shadow: none; padding: 0 0.35rem;
  font-weight: 650; color: var(--text);
}
.place-label::before { display: none; }
.place-label--other { color: var(--muted); font-weight: 500; }

.place-pin { background: none; border: 0; }
.place-pin__dot {
  display: block; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); border: 4px solid #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45);
  cursor: grab;
}

/* --- Places list -------------------------------------------------------- */
.place-dot { font-size: 1.3rem; color: var(--primary); }
.places__states { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.places-sync .row + .row { margin-top: 0.35rem; }
.places-sync p { margin: 0.5rem 0 0; }

.place-form__label { font-weight: 600; font-size: 0.9rem; }
.place-form__radius { flex-wrap: nowrap; }
.place-form__radius input[type="range"] { flex: 1; min-height: 2.75rem; accent-color: var(--primary); }
.place-form__radius input[type="number"] { width: 6.5rem; flex: none; }

/* --- Rules list ----------------------------------------------------------- */
.rules__place .section-title a { color: inherit; text-decoration: none; }
.rule { align-items: flex-start; }
.rule__summary { margin: 0 0 0.25rem; }
.rule--off .rule__summary { color: var(--muted); }

.rule-switch__form { display: inline; }
.rule-switch {
  min-height: 2.75rem; padding: 0 0.4rem; gap: 0.4rem;
  border: 0; background: transparent; color: var(--muted); font-size: 0.8rem;
}
.rule-switch__track {
  position: relative; display: inline-block; width: 2.9rem; height: 1.7rem;
  border-radius: 999px; background: var(--border); transition: background .15s;
}
.rule-switch__knob {
  position: absolute; top: 0.15rem; left: 0.15rem; width: 1.4rem; height: 1.4rem;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.rule-switch.is-on { color: var(--ok); }
.rule-switch.is-on .rule-switch__track { background: var(--ok); }
.rule-switch.is-on .rule-switch__knob { transform: translateX(1.2rem); }

/* --- Rule form ------------------------------------------------------------ */
.rule-form__group { border: 0; padding: 0; margin: 1.1rem 0 0; min-width: 0; }
.rule-form__group legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; padding: 0; }
.rule-form__group .checkbox { min-height: 2.5rem; }
.rule-form__priority { align-items: flex-start; padding: 0.25rem 0; }
.rule-form__priority input { margin-top: 0.3rem; }

.rule-segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface);
}
.rule-segmented__input { position: absolute; opacity: 0; pointer-events: none; }
.rule-segmented__option {
  display: flex; align-items: center; justify-content: center; min-height: 2.75rem;
  font-weight: 600; cursor: pointer; border-left: 1px solid var(--border);
}
.rule-segmented__option:first-of-type { border-left: 0; }
.rule-segmented__input:checked + .rule-segmented__option { background: var(--primary); color: var(--primary-text); }
.rule-segmented__input:focus-visible + .rule-segmented__option { outline: 2px solid var(--primary); outline-offset: -4px; }

/* Revealed by a checked radio/checkbox in the same fieldset (no JS needed). */
.rule-reveal { display: none; margin-top: 0.5rem; padding-left: 0.75rem; border-left: 3px solid var(--border); }
.rule-schedule:has(.rule-schedule__during:checked) .rule-schedule__options,
.rule-enhance:has(.rule-enhance__toggle:checked) .rule-enhance__options { display: block; }
.rule-reveal .field + .field, .rule-reveal .hint { margin-top: 0.6rem; display: block; }

.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.3rem; }
.weekday-picker__input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-picker__day {
  display: flex; align-items: center; justify-content: center; min-height: 2.75rem;
  border: 1px solid var(--border); border-radius: 10px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  background: var(--surface);
}
.weekday-picker__input:checked + .weekday-picker__day { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.weekday-picker__input:focus-visible + .weekday-picker__day { outline: 2px solid var(--primary); outline-offset: 2px; }

.rule-schedule__times { flex-wrap: nowrap; align-items: flex-start; margin-top: 0.6rem; }
.rule-schedule__times .field { flex: 1; margin-top: 0 !important; }
