/**
 * This file is part of Traintastic,
 * see <https://github.com/traintastic/traintastic>.
 *
 * Copyright (C) 2024-2025 Reinder Feenstra
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

.flex-column
{
  display: flex;
  flex-direction: column;
}

.flex-row
{
  display: flex;
  flex-direction: row;
}

.flex-resize
{
  display: flex;
  flex: 1 1 auto;
}

.flex-fixed
{
  display: flex;
  flex: 0 0 auto;
}

.hide
{
  display: none !important;
}

.stretch
{
  width: 100%;
}

.text-center
{
  text-align: center;
}

.text-right
{
  text-align: right;
}

.right
{
  float: right;
}

.p1
{
  padding: 0.5rem;
}

.pr1
{
  padding-right: 0.5rem;
}

html,
body
{
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

html
{
  font-family: sans-serif;
  height: -webkit-fill-available;
  touch-action: manipulation;
  /* disable iOS double tap zoom */
}

body
{
  background-color: #121212;
  color: white;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

header
{
  flex-shrink: 0;
  padding: 0.5rem;
}

header h1
{
  margin: 0;
}

#open_settings
{
  font-size: 200%;
  text-align: center;
  min-width: 2.5rem;
  cursor: pointer;
}

#body
{
  position: relative;
  flex-grow: 1;
}

#settings
{
  z-index: 3;
  position: absolute;
  background-color: #121212;
  width: 100%;
  height: 100%;
}

#settings div
{
  padding: 0.5rem;
}

#settings label,
#settings span.label
{
  display: block;
}

#settings button
{
  background-color: #bb86fc;
  color: black;
  border: none;
  border-radius: 0.5rem;
  display: inline-block;
  padding: 0.5rem 1rem;
}

#body>div.status
{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

button.control,
select.control
{
  background-color: #bb86fc;
  color: black;
  border: none;
  border-radius: 1.5rem;
  cursor: pointer;
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0.25rem;
  height: 5rem;
}

button.control:disabled
{
  background-color: gray !important;
  cursor: auto !important;
}

button.control.active
{
  background-color: #03dac6;
}

button.red
{
  background-color: #cf6679;
}

button.square
{
  width: 5rem;
}

fieldset
{
  border: none;
  margin: 0.25rem 0;
  padding: 0;
}

fieldset legend
{
  background-color: #444;
  width: 100%;
  border-radius: 0.5rem;
  padding: 0.25rem 0.5rem;
}

label
{
  font-weight: bold;
}

input[type=text]
{
  background-color: rgba(255, 255, 255, .07);
  border: solid 2px #bb86fc;
  border-radius: 1.5rem;
  font-size: 150%;
  color: white;
  padding: 0 0.5rem;
  margin: 0.5rem 0 1rem 0;
}

input.toggle_switch[type=checkbox]
{
  height: 0;
  width: 0;
  visibility: hidden;
}

label.toggle_switch
{
  cursor: pointer;
  width: 3rem;
  height: 1.5rem;
  background: grey;
  display: block;
  border-radius: 1.5rem;
  position: relative;
}

label.toggle_switch:after
{
  content: "";
  position: absolute;
  top: 0.1rem;
  left: 0.1rem;
  width: 1.3rem;
  height: 1.3rem;
  background: white;
  border-radius: 1.3rem;
  transition: 300ms;
}

input.toggle_switch:checked+label.toggle_switch
{
  background: #bbfc86;
  transition: 300ms;
}

input.toggle_switch:checked+label.toggle_switch:after
{
  left: calc(100% - 0.1rem);
  transform: translateX(-100%);
}

label.toggle_switch:active:after
{
  width: 1.95rem;
}

div.message
{
  z-index: 2;
  position: absolute;
  bottom: 0.5rem;
  border: none;
  border-radius: 0.5rem;
  left: 50%;
  margin-right: -50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 0.5rem;
  min-width: 50%;
  font-size: 125%;
}

div.message p
{
  margin: 0.5rem;
}

div.message.error
{
  background-color: #cf6679;
  text-align: center;
}

div.message.error button
{
  background-color: white;
  color: #cf6679;
  border: none;
  border-radius: 0.5rem;
  display: inline-block;
  padding: 0.5rem 1rem;
}
