/* EVrace — component: registry filter sheet (.srf-*).
   Канон: CSS/components/registry-filter.css. Страницы: /stations, /map, /plan, /gesheft. */

html.srf-open,
html.srf-open body {
  overflow: hidden;
}

.srf-empty-reset {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-display);
  font-size: 9px;
  padding: 5px 12px;
  border: 1px solid var(--err);
  border-radius: var(--radius, 4px);
  color: var(--err);
  background: rgba(255, 68, 68, 0.1);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
  -webkit-tap-highlight-color: transparent;
}
.srf-empty-reset:hover {
  background: rgba(255, 68, 68, 0.25);
}

.srf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.srf-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 9px;
  padding: 5px 11px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius, 4px);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  cursor: pointer;
  opacity: 0.85;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.srf-open-btn:hover {
  opacity: 1;
  border-color: var(--accent);
}
.srf-open-btn.has-active {
  opacity: 1;
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--accent);
}

.srf-open-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 8px;
  line-height: 1;
  background: var(--accent);
  /* нет подходящей роли, задокументировано STYLE-AUDIT-02 */
  color: #000;
}
.srf-open-badge.is-on {
  display: inline-flex;
}

/* Отступы со всех сторон — попап, не edge-to-edge */
.srf-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
}
.srf-overlay.srf-is-open {
  display: flex;
}

/* По контенту + потолок высоты — без растягивания на 100% */
.srf-sheet {
  width: 100%;
  max-width: 440px;
  height: auto;
  max-height: min(82dvh, 82vh);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  box-sizing: border-box;
}

.srf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.srf-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.srf-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius, 4px);
  background: transparent;
  color: var(--fg-3);
  font-family: var(--font);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.srf-close:hover {
  color: var(--fg);
  border-color: var(--accent);
}

/* Плотные секции — без flex-grow (он давал «воздух» между чипами) */
.srf-body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.srf-section {
  margin: 0;
  min-width: 0;
  flex: 0 0 auto;
  padding: 0;
}
.srf-section.srf-toggle-row {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 0;
}

.srf-label {
  font-family: var(--font-display);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
  flex-shrink: 0;
}

.srf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

/* Разъёмы: ряд DC, затем ряд AC (NACS / NACS AC — последние в своей группе) */
.srf-gun-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.srf-gun-row .srf-chips {
  gap: 6px;
}

.srf-chip {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: var(--t-caption);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-chip);
  color: var(--fg-2);
  background: var(--surface);
  cursor: pointer;
  opacity: 1;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.srf-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.srf-chip.on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* DC/AC — роли --dc / --ac */
.srf-chip.srf-chip--dc {
  border-color: color-mix(in srgb, var(--dc) 40%, var(--hairline));
  color: var(--dc);
}
.srf-chip.srf-chip--ac {
  border-color: color-mix(in srgb, var(--ac) 40%, var(--hairline));
  color: var(--ac);
}
.srf-chip.srf-chip--dc.on {
  color: var(--dc);
  border-color: var(--dc);
  background: var(--dc-bg);
}
.srf-chip.srf-chip--ac.on {
  color: var(--ac);
  border-color: var(--ac);
  background: var(--ac-bg);
}

.srf-chip.op-bf,
.srf-chip.op-ma,
.srf-chip.op-za,
.srf-chip.op-ev,
.srf-chip.op-eo,
.srf-chip.op-on,
.srf-chip.op-fo,
.srf-chip.op-uc,
.srf-chip.op-cs,
.srf-chip.op-or,
.srf-chip.op-sk,
.srf-chip.op-pr {
  color: var(--c);
  border-color: color-mix(in srgb, var(--c) 40%, var(--hairline));
}
.srf-chip.op-bf.on,
.srf-chip.op-ma.on,
.srf-chip.op-za.on,
.srf-chip.op-ev.on,
.srf-chip.op-eo.on,
.srf-chip.op-on.on,
.srf-chip.op-fo.on,
.srf-chip.op-uc.on,
.srf-chip.op-cs.on,
.srf-chip.op-or.on,
.srf-chip.op-sk.on,
.srf-chip.op-pr.on {
  color: var(--c);
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}

.srf-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.srf-toggle-label {
  font-family: var(--font);
  font-size: 13px;
  color: var(--fg);
}
.srf-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: 1px solid var(--border-dim);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.srf-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: transform 0.15s ease, background 0.15s ease;
}
.srf-toggle.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.srf-toggle.on::after {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* Checkboxes (Свободно / Банковская карта / С отзывами) */
.srf-checks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding-top: 2px;
  padding-bottom: 2px;
}
.srf-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  flex: 0 1 auto;
  min-width: 0;
}
.srf-check-input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.srf-check-label {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg);
}
html[data-theme="light"] .srf-check-label,
html[data-theme="dark"] .srf-check-label {
  font-family: var(--font);
  font-size: var(--t-label);
  color: var(--fg);
}
html[data-theme="light"] .srf-check-input,
html[data-theme="dark"] .srf-check-input {
  accent-color: var(--fg);
}

/* Жёстко равные колонки — flex ломался от длинного Press Start текста */
.srf-foot {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
}

.srf-reset,
.srf-apply {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  font-family: var(--font-display);
  font-size: 8px;
  line-height: 1.3;
  padding: 12px 6px;
  border-radius: var(--radius, 4px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.srf-reset {
  border: 1px solid var(--err);
  color: var(--err);
  background: rgba(255, 68, 68, 0.1);
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.35);
}
.srf-reset:hover {
  background: rgba(255, 68, 68, 0.25);
}

.srf-apply {
  border: 1px solid var(--accent);
  /* нет подходящей роли, задокументировано STYLE-AUDIT-02 */
  color: #000;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 40%, transparent);
}
.srf-apply:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  background: transparent;
  color: var(--fg-3);
  border-color: var(--border-dim);
}

@media (min-width: 768px) {
  .srf-overlay {
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    padding-left: max(24px, env(safe-area-inset-left, 0px));
  }
  .srf-sheet {
    max-width: 480px;
    max-height: min(88dvh, 720px);
  }
  .srf-open-btn,
  .srf-chip,
  .srf-empty-reset {
    font-size: 10px;
    padding: 7px 11px;
  }
  .srf-reset,
  .srf-apply {
    font-size: 9px;
    padding: 14px 10px;
  }
  .srf-title {
    font-size: 12px;
  }
}
