/* ================= */
/* SETTINGS MODAL    */
/* ================= */

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.settings-modal.open {
  pointer-events: auto;
  opacity: 1;
}

.settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 5, 15, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.settings-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(
    175deg,
    rgba(18, 26, 48, 0.98) 0%,
    rgba(8, 12, 24, 0.99) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 28px 20px calc(48px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.settings-modal.open .settings-modal__panel {
  transform: translateY(0);
}

/* ================= */
/* HEADER            */
/* ================= */

.settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.settings-modal__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.95);
}

.settings-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.65);
  transition: background 0.2s ease, color 0.2s ease;
}

.settings-modal__close:active {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

/* ================= */
/* SECTION           */
/* ================= */

.settings-section__label {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.settings-section + .settings-section {
  margin-top: 28px;
}

.settings-section--adaptive + .settings-section--adaptive {
  margin-top: 0;
}

.adaptive-radio-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.adaptive-radio-setting__copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.adaptive-radio-setting__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.adaptive-radio-setting__description {
  max-width: 260px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.48);
}

.adaptive-radio-switch {
  flex: 0 0 auto;
}

.adaptive-radio-switch__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.adaptive-radio-switch__track {
  position: relative;
  display: block;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.adaptive-radio-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

.adaptive-radio-switch__input:checked + .adaptive-radio-switch__track {
  background: #2563eb;
  border-color: #3b82f6;
}

.adaptive-radio-switch__input:checked + .adaptive-radio-switch__track .adaptive-radio-switch__thumb {
  transform: translateX(20px);
}

/* ================= */
/* CAR TYPE GRID     */
/* ================= */

.car-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.weather-mode-carousel {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding-bottom: 4px;
  padding-right: 8px;
  scrollbar-width: none;
}

.weather-mode-carousel::-webkit-scrollbar {
  display: none;
}

.weather-mode-carousel .car-type-btn {
  flex: 0 0 92px;
  width: 92px;
  min-width: 92px;
  gap: 8px;
  font-size: 11px;
  white-space: normal;
  text-align: center;
}

.weather-mode-emoji {
  font-size: 1.4rem;
  line-height: 1;
}

#weatherModeSection {
  margin-top: 12px;
}

.settings-section__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 6px;
}

.car-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px;
  min-height: 88px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.car-type-btn:active {
  transform: scale(0.97);
}

.car-type-btn.active {
  background: rgba(47, 108, 255, 0.12);
  border-color: rgba(120, 160, 255, 0.55);
  color: #ffffff;
  font-weight: 600;
}

.car-type-icon {
  width: 42px;
  height: 42px;
  display: block;
  filter: brightness(0) invert(1) opacity(0.38);
  transition: filter 0.2s ease;
}

.car-type-btn.active .car-type-icon {
  filter: brightness(0) saturate(100%) invert(47%) sepia(96%) saturate(400%) hue-rotate(196deg) brightness(104%) contrast(96%);
}

[data-car="truck"] .car-type-icon {
  width: 38px;
  height: 38px;
}

.fuel-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.fuel-type-icon {
  width: 25px;
  height: 25px;
  display: block;
  filter: brightness(0) invert(1) opacity(0.38);
  transition: filter 0.2s ease;
}

.fuel-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 88px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.fuel-type-btn:active {
  transform: scale(0.97);
}

.fuel-type-btn.active {
  background: rgba(47, 108, 255, 0.12);
  border-color: rgba(120, 160, 255, 0.55);
  color: #ffffff;
  font-weight: 600;
}

.fuel-type-btn.active .fuel-type-icon {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(47%) sepia(96%) saturate(400%) hue-rotate(196deg) brightness(104%) contrast(96%);
}

.language-options {
  display: grid;
  gap: 10px;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.95rem;
  font-weight: 600;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
}

.language-option:active {
  transform: scale(0.98);
}

.language-option.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.95);
}

/* ================= */
/* WEATHER PILL      */
/* ================= */

.weather-widget {
  cursor: pointer;
  transition: opacity 0.2s ease;
  user-select: none;
}

.weather-widget:active {
  opacity: 0.75;
}

.weather-widget.loading .weather-temp {
  opacity: 0.5;
}

/* ================= */
/* WEATHER MODAL     */
/* ================= */

.weather-modal {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.weather-modal.open {
  pointer-events: auto;
  opacity: 1;
}

.weather-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 5, 15, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.weather-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(
    175deg,
    rgba(18, 26, 48, 0.98) 0%,
    rgba(8, 12, 24, 0.99) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 28px 20px calc(48px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.weather-modal.open .weather-modal__panel {
  transform: translateY(0);
}

.weather-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.weather-modal__location-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 6px;
}

.weather-modal__location-icon {
  width: 14px;
  height: 14px;
  opacity: 0.65;
  flex-shrink: 0;
}

.weather-modal__location {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.weather-modal__current {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-modal__current-icon {
  font-size: 2rem;
  line-height: 1;
}

.weather-modal__current-temp {
  font-size: 2.2rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.02em;
}

.weather-modal__wind-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.weather-modal__wind-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.7);
}

.weather-modal__wind {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}

/* ================= */
/* FORECAST SCROLL   */
/* ================= */

.forecast-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding-bottom: 2px;
}

.forecast-scroll::-webkit-scrollbar {
  display: none;
}

.forecast-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 58px;
}

.forecast-item--current {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.forecast-item__time {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.forecast-item--current .forecast-item__time {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

.forecast-item__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.forecast-item__temp {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* ========================= */
/* CALCULATOR MODAL          */
/* ========================= */

#calculatorModal .settings-modal__header {
  align-items: flex-start;
  margin-bottom: 22px;
}

.calc-header-text {
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}

.calc-subtitle {
  margin: 5px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.42);
}

.calculator-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-field__label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.52);
}

.calc-field__input-wrap {
  display: flex;
  align-items: stretch;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.calc-field__input-wrap:focus-within {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
}

.calc-field__input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  padding: 13px 14px;
  font-size: 1.05rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  -webkit-appearance: none;
}

.calc-field__input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.calc-field__suffix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.3);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Result ---- */

.calc-result {
  margin-top: 4px;
  padding: 8px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.calc-result--empty {
  visibility: hidden;
}

.calc-result__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.calc-result__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 2px 0;
}

.calc-result__label {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88);
}

.calc-result__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.calc-result__value--accent {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.95);
}

.app.mode-comfort  .calc-result__value--accent { color: rgba(76, 208, 122, 0.95); }
.app.mode-travel .calc-result__value--accent { color: rgba(255, 165, 80, 0.95); }
.app.mode-sport  .calc-result__value--accent { color: rgba(255, 90, 90, 0.95); }
.app.mode-radio7   .calc-result__value--accent { color: rgba(14, 210, 110, 0.95); }
.app.mode-nonstop .calc-result__value--accent { color: rgba(0, 210, 255, 0.95); }
.app.mode-rap     .calc-result__value--accent { color: rgba(180, 40, 255, 0.95); }
.app.mode-rock    .calc-result__value--accent { color: rgba(255, 90, 30, 0.95); }
.app.mode-deep    .calc-result__value--accent { color: rgba(90, 70, 255, 0.95); }
.app.mode-lofi    .calc-result__value--accent { color: rgba(130, 170, 225, 0.95); }
.app.mode-euro    .calc-result__value--accent { color: rgba(0, 212, 255, 0.95); }
.app.mode-pulse   .calc-result__value--accent { color: rgba(160, 255, 20, 0.95); }
.app.mode-manele  .calc-result__value--accent { color: rgba(255, 155, 0, 0.95); }

/* ---- Reset button ---- */

.calc-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  margin-top: 4px;
}

/* ========================= */
/* MODES MODAL               */
/* ========================= */

#settingsModal .settings-modal__panel,
#modesModal .settings-modal__panel {
  max-width: min(100%, 400px);
  margin-inline: auto;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 10px;
  padding: 2px 0 4px;
}

.mode-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.mode-tile:active {
  background: rgba(255, 255, 255, 0.10);
}

.mode-tile.is-active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.30);
}

.mode-tile.is-paused {
  opacity: 0.55;
}

/* ========================= */
/* MODES MODAL — APPLY BTN  */
/* ========================= */

.modes-apply-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease,
              color 0.18s ease, transform 0.1s ease, opacity 0.18s ease;
}

.modes-apply-btn:not(:disabled):active {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(0.98);
}

.modes-apply-btn:disabled {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.22);
  cursor: default;
  opacity: 1;
}

/* ========================= */
/* MODES MODAL — TOAST       */
/* ========================= */

.modes-toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: rgba(20, 30, 54, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
  max-width: calc(100% - 40px);
  text-align: center;
}

.modes-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mode-tile__icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* ========================= */
/* MODE TILE — PLAYING       */
/* ========================= */

.mode-tile__equalizer {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 28px;
  height: 28px;
  pointer-events: none;
}

.mode-tile__equalizer span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.90);
  transform-origin: bottom center;
  animation: streamBar 0.9s ease-in-out infinite;
}

.mode-tile__equalizer span:nth-child(1) { height: 9px; animation-delay: 0s; }
.mode-tile__equalizer span:nth-child(2) { height: 9px; animation-delay: 0.18s; }
.mode-tile__equalizer span:nth-child(3) { height: 9px; animation-delay: 0.36s; }

.mode-tile.is-playing .mode-tile__icon {
  display: none;
}

.mode-tile.is-playing .mode-tile__equalizer {
  display: flex;
}

/* ========================= */
/* MODE TILE — CONNECTING    */
/* ========================= */

.mode-tile__signal {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  position: relative;
  pointer-events: none;
}

.mode-tile__signal span {
  position: absolute;
  border-radius: 50%;
}

.mode-tile__signal span:nth-child(1) {
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.90);
}

.mode-tile__signal span:nth-child(2),
.mode-tile__signal span:nth-child(3) {
  width: 5px;
  height: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.70);
  opacity: 0;
  animation: signalRing 1.6s ease-out infinite;
}

.mode-tile__signal span:nth-child(2) { animation-delay: 0s; }
.mode-tile__signal span:nth-child(3) { animation-delay: 0.8s; }

.mode-tile.is-connecting {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.22);
}

.mode-tile.is-connecting .mode-tile__icon {
  display: none;
}

.mode-tile.is-connecting .mode-tile__signal {
  display: flex;
}

.mode-tile__icon--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.mode-tile__name {
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
}

.mode-tile__star {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  padding: 3px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-tile__star img {
  width: 13px;
  height: 13px;
  opacity: 0.65;
}

.calc-reset-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.18);
}

