:root {
  --background-color: #2b2e33;
  --input-background-color: #1e1e1e;
  --iframe-scale: 1.6;
  --font-scale: 1.1rem;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--background-color);
  color: white;
  font-size: var(--font-scale);
  height: auto;
}

input,
textarea,
select {
  background-color: var(--input-background-color);
  color: white;
}

textarea,
input,
input::placeholder,
button,
label,
select,
pre code {
  font-size: 1.1rem;
}

a {
  color: white;
  padding: 5px;
}

svg {
  width: 32px;
  height: 32px;
}

fieldset {
  margin-top: 0.5rem;
}

p {
  margin: 0;
}

input[type="checkbox"],
input[type="radio"] {
  transform: scale(1.5);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  margin-right: 0.7rem;
}

input[type="color"] {
  /* margin-top: 0.5rem;
  margin-bottom: 0.5rem; */
  margin-right: 0.7rem;
}

.input-text-not-full-width {
  width: 10ch;
}

.inline {
  display: flex;
  align-items: baseline;
}

.fieldset-search-mode {
}

.suggestion-container {
  height: calc(6.7 * var(--font-scale));
  overflow-y: auto;
  border: 1px solid white;
  margin-bottom: 0.5rem;
}

.background-selected {
  background-color: #0045ad;
}

.listentry {
  cursor: default;
}

#container-mode1 {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 0px 0px;
  grid-auto-flow: row;
  grid-template-areas:
    "div-inline div-inline fieldset-search-mode"
    "fieldset-departure fieldset-destination fieldset-url"
    "fieldset-additional-time fieldset-products-filter fieldset-preview"
    "fieldset-num-journeys fieldset-products-filter fieldset-preview"
    "fieldset-board-type fieldset-products-filter fieldset-preview"
    /* "fieldset-additional-settings fieldset-products-filter fieldset-preview" */
    "fieldset-update-interval fieldset-products-filter fieldset-preview"
    "fieldset-styling fieldset-styling fieldset-preview";
}

/* fieldset-styling */

#container-mode2 {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 0px 0px;
  grid-auto-flow: row;
  grid-template-areas:
    "div-inline div-inline fieldset-search-mode"
    "fieldset-departure fieldset-destination fieldset-url"
    "fieldset-additional-time fieldset-products-filter fieldset-preview "
    "fieldset-num-journeys fieldset-products-filter fieldset-preview "
    "fieldset-board-type fieldset-products-filter fieldset-preview "
    "fieldset-language fieldset-products-filter fieldset-preview "
    "fieldset-additional-settings fieldset-products-filter fieldset-preview";
}

#container-mode3 {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 0px 0px;
  grid-auto-flow: row;
  grid-template-areas:
    "div-inline div-inline div-inline"
    "fieldset-departure fieldset-board-type fieldset-url"
    "fieldset-departure fieldset-page-number fieldset-url"
    "fieldset-preview fieldset-preview fieldset-preview";
}

.div-inline {
  grid-area: div-inline;
}

.fieldset-search-mode {
  grid-area: fieldset-search-mode;
}

.fieldset-departure {
  grid-area: fieldset-departure;
  display: flexbox;
}

.fieldset-destination {
  grid-area: fieldset-destination;
  display: flexbox;
}

.fieldset-products-filter {
  grid-area: fieldset-products-filter;
}

.fieldset-additional-time {
  grid-area: fieldset-additional-time;
}

.fieldset-board-type {
  grid-area: fieldset-board-type;
}

.fieldset-language {
  grid-area: fieldset-language;
}

.fieldset-additional-settings {
  grid-area: fieldset-additional-settings;
}

.fieldset-num-journeys {
  grid-area: fieldset-num-journeys;
}

.fieldset-update-interval {
  grid-area: fieldset-update-interval;
}

.fieldset-styling {
  grid-area: fieldset-styling;
}

.fieldset-url {
  grid-area: fieldset-url;
}

.fieldset-preview {
  grid-area: fieldset-preview;
}

.fieldset-page-number {
  grid-area: fieldset-page-number;
}

select {
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  height: 100%;
  resize: none;
}

.full-width,
.div-id {
  width: 100%;
}

#input-departure-station-id,
#input-destination-station-id {
  width: 16ch;
}

.input-station-id::-webkit-outer-spin-button,
.input-station-id::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
.input-station-id[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

iframe {
  width: 100%;
  height: 100%;
  border: none;
  overflow: hidden;
}

.iframe-ratio {
  height: auto;
  aspect-ratio: 16/9;
}

.iframe-scale {
  transform: scale(var(--iframe-scale));
  transform-origin: 0 0;
  width: calc(1 / var(--iframe-scale) * 100%);
  height: calc(1 / var(--iframe-scale) * 100%);
}

.iframe-container {
  /* overflow: hidden; */
  width: 100%; /* Adjust based on your requirements */
  height: 100%;
}

.div-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* TOGGLE */

.toggle {
  cursor: pointer;
  display: inline-block;
}

.toggle-switch {
  display: inline-block;
  background: #ccc;
  border-radius: 16px;
  width: 58px;
  height: 32px;
  position: relative;
  vertical-align: middle;
  transition: background 0.25s;
}
.toggle-switch:before,
.toggle-switch:after {
  content: "";
}
.toggle-switch:before {
  display: block;
  background: linear-gradient(to bottom, #fff 0%, #eee 100%);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  width: 24px;
  height: 24px;
  position: absolute;
  top: 4px;
  left: 4px;
  transition: left 0.25s;
}
.toggle:hover .toggle-switch:before {
  background: linear-gradient(to bottom, #fff 0%, #fff 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}
/* .toggle-checkbox:checked + .toggle-switch {
  background: #56c080;
} */

.toggle-checkbox:checked + .toggle-switch:before {
  left: 30px;
}

.toggle-checkbox {
  position: absolute;
  visibility: hidden;
}

.toggle-label {
  margin-left: 5px;
  position: relative;
  top: 2px;
}

fieldset {
  position: relative;
}

textarea + button,
iframe + button {
  position: absolute;
  opacity: 0;
  transition: opacity 0.1s;
  /* top: 10px; */
  bottom: 20px;
  right: 20px;
}

textarea + button:active,
iframe + button:active {
  scale: 0.8;
}

textarea:hover + button,
textarea + button:hover,
iframe:hover + button,
iframe + button:hover {
  opacity: 1;
}

.btn-back {
  width: 32px;
  height: 32px;
}

/* LOADING SCREEN */
.lds-dual-ring,
.lds-dual-ring:after {
  display: block;
  box-sizing: border-box;
}
.lds-dual-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
}
.lds-dual-ring:after {
  content: " ";
  display: block;
  width: 64px;
  height: 64px;
  margin: 8px;
  border-radius: 50%;
  border: 6.4px solid currentColor;
  border-color: currentColor transparent currentColor transparent;
  animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* MEDIA QUERIES */
@media (max-width: 80em) {
  body {
    /* background-color: rgb(0, 0, 54); */
  }

  #container-mode1 {
    grid-template-columns: 1fr 1fr;
    /* grid-template-rows: 0.1fr 1fr 0.1fr 0.1fr 0.1fr 1fr 0.5fr 1.5fr; */
    grid-template-rows: auto auto auto auto auto auto auto 10rem 30rem;

    grid-template-areas:
      "div-inline fieldset-search-mode"
      "fieldset-departure fieldset-destination"
      "fieldset-additional-time fieldset-products-filter"
      "fieldset-num-journeys fieldset-products-filter"
      "fieldset-board-type fieldset-products-filter"
      /* "fieldset-language fieldset-products-filter" */
      /* "fieldset-additional-settings  fieldset-products-filter" */
      "fieldset-update-interval fieldset-products-filter"
      "fieldset-styling fieldset-styling"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }

  #container-mode2 {
    grid-template-columns: 1fr 1fr;
    /* grid-template-rows: 0.1fr 1fr 0.1fr 0.1fr 0.1fr 1fr 0.5fr 1.5fr; */
    grid-template-rows: auto auto auto auto auto auto auto 10rem 30rem;

    grid-template-areas:
      "div-inline fieldset-search-mode"
      "fieldset-departure fieldset-destination"
      "fieldset-additional-time fieldset-products-filter"
      "fieldset-num-journeys fieldset-products-filter"
      "fieldset-board-type fieldset-products-filter"
      "fieldset-language fieldset-products-filter"
      "fieldset-additional-settings fieldset-products-filter"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }

  #container-mode3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 8rem auto;
    gap: 0px 0px;
    grid-auto-flow: row;
    grid-template-areas:
      "div-inline div-inline"
      "fieldset-departure fieldset-board-type"
      "fieldset-departure fieldset-page-number"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }
}

@media (max-width: 40em) {
  body {
    /* background-color: rgb(0, 27, 0); */
  }
  :root {
    --iframe-scale: 1.1;
  }

  #container-mode1 {
    grid-template-columns: 1fr 1fr;
    /* grid-template-rows: 0.1fr 0.1fr 0.1fr 0.1fr 0.1fr 0.1fr 1fr 0.7fr 1.7fr; */
    grid-template-rows: auto auto auto auto auto auto auto auto auto 14rem 30rem;
    grid-template-areas:
      "div-inline div-inline"
      "fieldset-search-mode fieldset-search-mode"
      "fieldset-departure fieldset-departure"
      "fieldset-destination fieldset-destination"
      "fieldset-additional-time fieldset-products-filter"
      "fieldset-num-journeys fieldset-products-filter"
      "fieldset-board-type fieldset-products-filter"
      /* "fieldset-additional-settings fieldset-products-filter" */
      "fieldset-update-interval fieldset-products-filter"
      "fieldset-styling fieldset-styling"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }

  #container-mode2 {
    grid-template-columns: 1fr 1fr;
    /* grid-template-rows: 0.1fr 0.1fr 0.1fr 0.1fr 0.1fr 0.1fr 1fr 0.7fr 1.7fr; */
    grid-template-rows: auto auto auto auto auto auto auto auto auto 14rem 20rem;
    grid-template-areas:
      "div-inline div-inline"
      "fieldset-search-mode fieldset-search-mode"
      "fieldset-departure fieldset-departure"
      "fieldset-destination fieldset-destination"
      "fieldset-additional-time fieldset-products-filter"
      "fieldset-num-journeys fieldset-products-filter"
      "fieldset-board-type fieldset-products-filter"
      "fieldset-language fieldset-products-filter"
      "fieldset-additional-settings fieldset-products-filter"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }

  #container-mode3 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto 10rem auto;
    gap: 0px 0px;
    grid-auto-flow: row;
    grid-template-areas:
      "div-inline div-inline"
      "fieldset-departure fieldset-departure"
      "fieldset-board-type fieldset-page-number"
      "fieldset-url fieldset-url"
      "fieldset-preview fieldset-preview";
  }

  textarea + button,
  iframe + button {
    opacity: 1;
  }
}

/* Leave at bottom of style sheet */
.display-none {
  display: none;
}
