/* === Инструмент "Расход топлива ПА" === */

.main-content:has(.fuel-page) { padding-top: 0; }

/* Тулбар fuel-страницы без боковых отступов */
.fuel-page > .tool-toolbar {
  padding-left: 0;
  padding-right: 0;
}

.fuel-page {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fuel-content {
  padding: 16px 0 32px;
}

.fuel-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.fuel-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.fuel-right {
  position: sticky;
  top: 64px;
  min-width: 0;
}
.fuel-right-sticky {
  display: flex;
  flex-direction: column;
}

@media (max-width: 1100px) {
  .fuel-inner {
    grid-template-columns: 1fr;
  }
  .fuel-right { position: static; }
}

/* Селектор текущего автомобиля */
.fuel-vehicle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--color-primary) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, transparent);
  border-radius: 12px;
  color: var(--color-on-surface);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.fuel-vehicle-btn:hover {
  background: color-mix(in srgb, var(--color-primary) 30%, transparent);
  border-color: var(--color-primary);
}
.fuel-vehicle-btn__title {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fuel-vehicle-btn__chevron {
  display: inline-flex;
  color: var(--color-primary);
}

/* Компактная версия кнопки в тулбаре */
.fuel-vehicle-btn--toolbar {
  height: 34px;
  min-width: 180px;
  max-width: 280px;
  padding: 0 10px 0 12px;
  font-size: 13px;
  gap: 8px;
}
.fuel-vehicle-btn--toolbar .fuel-vehicle-btn__chevron svg {
  width: 18px;
  height: 18px;
}

/* Строка с инпутом + описанием */
.fuel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.fuel-row--season {
  padding-top: 6px;
  padding-bottom: 2px;
}
.fuel-row__label-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.fuel-row__label {
  font-size: 14px;
  color: var(--color-on-surface);
  line-height: 1.3;
}
.fuel-row__hint {
  font-size: 11px;
  color: var(--color-on-surface-secondary);
  line-height: 1.3;
}

/* Иконка «замер по карте» — открывает модалку выбора маршрута */
.fuel-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 40px;
  flex-shrink: 0;
  color: var(--color-on-surface-secondary);
}
.fuel-row__icon--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.fuel-row__icon--action {
  color: var(--color-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.fuel-row__icon--action:hover,
.fuel-row__icon--action:focus-visible {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  outline: none;
}

.fuel-input-wrap {
  position: relative;
  width: 110px;
  flex-shrink: 0;
}
.fuel-input-wrap--wide {
  width: 180px;
}

.fuel-input {
  width: 100%;
  height: 40px;
  padding: 0 32px 0 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-primary);
  border-radius: 12px;
  color: var(--color-on-surface);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.fuel-input:focus {
  background: var(--color-surface);
  border-width: 2px;
  padding-left: 11px;
}
.fuel-input-wrap--wide .fuel-input {
  padding-right: 12px;
}

.fuel-input-suffix {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--color-on-surface-secondary);
  pointer-events: none;
}

.fuel-input--wide {
  width: 100%;
}

/* Кнопка сезона — 1:1 с мобильным (AnimatedContainer 100×40, radius 12,
   цвет Colors.green/blue alpha .7; AnimatedSwitcher слайдит текст сверху). */
.fuel-season-btn {
  width: 100px;
  height: 40px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 12px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.fuel-season-btn--summer {
  background: rgba(76, 175, 80, 0.7);
}
.fuel-season-btn--winter {
  background: rgba(33, 150, 243, 0.7);
}
.fuel-season-btn__label {
  display: inline-block;
  line-height: 1;
}

/* Карточка результатов (сезонный tinted фон + плавный transition фона) */
.fuel-results-card {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.fuel-results-card--summer {
  background: color-mix(in srgb, #4CAF50 14%, transparent);
  border-color: color-mix(in srgb, #4CAF50 35%, transparent);
}
.fuel-results-card--winter {
  background: color-mix(in srgb, #2196F3 14%, transparent);
  border-color: color-mix(in srgb, #2196F3 35%, transparent);
}
.fuel-results-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 4px;
}
.fuel-results-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fuel-results__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-on-surface);
  letter-spacing: 0.2px;
  margin: 0;
}
.fuel-result {
  font-size: 14px;
  color: var(--color-on-surface);
  line-height: 1.4;
}
.fuel-result b {
  font-weight: 700;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}
.fuel-result--total b {
  color: var(--color-primary);
  font-size: 15px;
}
.fuel-result-secondary {
  font-size: 12px;
  color: var(--color-primary);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* Строка "Округлять до ... знаков" внутри блока результатов */
.fuel-row--short {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* Toggle доп. полей */
.fuel-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  cursor: pointer;
  user-select: none;
}
.fuel-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  background: var(--color-border);
  border-radius: 999px;
  transition: background 0.2s;
}
.fuel-toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.fuel-toggle--on {
  background: #4CAF50;
}
[data-theme="dark"] .fuel-toggle--on {
  background: #66BB6A;
}
.fuel-toggle--on .fuel-toggle__knob {
  transform: translateX(18px);
}
.fuel-toggle-row__label {
  font-size: 14px;
  color: var(--color-on-surface);
}

.fuel-names {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 2px;
}

/* Плавное раскрытие доп. полей (пробег 2/3, названия местностей).
   Негативный margin-top «съедает» flex gap у .fuel-left, чтобы при
   закрытом состоянии не оставалось лишних 10px пустого пространства. */
.fuel-collapsible {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: -10px;
  transition: grid-template-rows 0.3s ease, margin-top 0.3s ease;
}
.fuel-collapsible--open {
  grid-template-rows: 1fr;
  margin-top: 0;
}
.fuel-collapsible__inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Суффикс «(Город)» в метке distance1 — показываем только при addOn. */
.fuel-row__label-suffix--hidden {
  display: none;
}

/* Ссылка на приказ */
.fuel-n737-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  border: none;
  border-radius: 12px;
  color: var(--color-primary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.fuel-n737-link:hover {
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.fuel-n737-link__arrow {
  display: inline-flex;
}

/* === Модалка списка === */
.fuel-hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-on-surface-secondary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  border-radius: 10px;
}

.fuel-vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fuel-vehicle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fuel-vehicle-tile {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--color-primary) 15%, transparent);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--color-on-surface);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.fuel-vehicle-tile:hover {
  background: color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.fuel-vehicle-tile--active {
  background: color-mix(in srgb, var(--color-primary) 35%, transparent);
  border-color: var(--color-primary);
}

.fuel-vehicle-action {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--color-on-surface-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.fuel-vehicle-action:hover {
  background: var(--color-hover);
  color: var(--color-on-surface);
}

.tool-modal__footer--between {
  justify-content: space-between;
}

/* === Редактор === */
.fuel-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fuel-editor-field {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fuel-editor-field__label {
  font-size: 13px;
  color: var(--color-on-surface);
  line-height: 1.3;
  flex: 1;
}
.fuel-editor-field .fuel-input-wrap {
  width: 120px;
}
.fuel-editor-field .fuel-input--wide {
  width: 100%;
  padding-right: 12px;
}

.fuel-editor-section-title {
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.2px;
}

.fuel-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, #D32F2F 10%, transparent);
  border-radius: 10px;
  color: #D32F2F;
  font-size: 13px;
  line-height: 1.4;
}
[data-theme="dark"] .fuel-error {
  color: #F28B82;
}

/* Кнопка удалить */
.fuel-btn-danger {
  background: #D32F2F;
}
.fuel-btn-danger:hover:not(:disabled) {
  background: #B71C1C;
}
[data-theme="dark"] .fuel-btn-danger {
  color: #fff;
}

/* Confirm-модалка */
.fuel-confirm-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-on-surface);
}

/* Второй оверлей выше первого */
.fuel-modal-overlay--confirm {
  z-index: 1010;
}
.fuel-modal-overlay--editor {
  z-index: 1005;
}
