:root {
  color-scheme: light dark;
  
  --section-max-width: 900px;

  font-family: system-ui, -apple-system;
  font-size: 0.9rem;
}

body {
    margin: 0;
}

a {
  text-decoration: none;
  color: var(--system-blue-color);
}

/* MARK: - Flashes */

@keyframes flashAnimation {
  0%, 100% {
    opacity: 0;
    transform: translateX(calc(100% + 20px));
  }
  10%, 90% {
    opacity: 1;
    transform: translateX(0%);
  }
}

header.flash {
  --padding: 20px;
  --icon-size: 17px;
  
  padding: var(--padding);
  padding-left: calc(var(--padding) + var(--icon-size) + 10px);
  position: fixed;
  top: var(--padding);
  right: var(--padding);
  border-radius: 8px;
  max-width: 300px;
  border: 0.5px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.10);
  width: 100%;
  background-color: var(--text-background-color);
  background-repeat: no-repeat;
  background-size: var(--icon-size) var(--icon-size);
  background-position: var(--padding) calc(var(--padding) + 0.25px);

  animation: flashAnimation 5s ease-in-out;
  animation-fill-mode: forwards;
}

header.flash.success { background-image: url("/images/flash-icon-success.png"); }
header.flash.info { background-image: url("/images/flash-icon-info.png"); }
header.flash.warning { background-image: url("/images/flash-icon-warning.png"); }
header.flash.error { background-image: url("/images/flash-icon-error.png"); }

@media (prefers-color-scheme: dark) {
    header.flash {
      border-color: black;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    }
    
    header.flash.success { background-image: url("/images/flash-icon-success-dark.png"); }
    header.flash.info { background-image: url("/images/flash-icon-info-dark.png"); }
    header.flash.warning { background-image: url("/images/flash-icon-warning-dark.png"); }
    header.flash.error { background-image: url("/images/flash-icon-error-dark.png"); }
}

/* MARK: Nav bar */

nav {
  border-bottom: 1px solid var(--separator-color);
  width: 100%;
  padding: 0;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

nav .container {
  width: 100%;
  max-width: var(--section-max-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .tabs {
  display: flex;
  flex-direction: row;
  gap: 24px;
}

nav .tabs #app-icon {
  width: 48px;
  height: 48px;
  margin: 8px 0 7px -5px;
}

nav .action {
  display: flex;
  align-items: center;
}

nav .nav-item {
  color: var(--label-color);
  font-weight: bold;
  display: flex;
}

nav .nav-item .content {
  display: flex;
  align-items: center;
}

nav .nav-item > a {
  color: inherit;
  text-decoration: none;
}

nav .nav-item.selected {
  color: var(--label-color);
  border-bottom: 2px solid var(--system-blue-color);
  margin-top: 2px; /* To offset the border and keep the contents centered */
}

nav .nav-item .primary-button {
  float: right;
}

/* MARK: Main section */

section {
  background-color: var(--text-background-color);
  border: 1px solid var(--separator-color);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  margin-bottom: 20px;
  max-width: var(--section-max-width);
  margin: 0 auto;
}

section + section {
    margin-top: 20px;
}

section header {
  font-weight: bold;
  font-size: large;
  border-bottom: 1px solid var(--separator-color);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

section table {
  padding: 16px;
}

section .sub-section {
  padding: 16px;
}

section table td,th {
  text-align: left; 
}

section table th {
  color: darkgray;
}

section table td.title {
  text-align: right;
  vertical-align: middle;
  font-weight: bold;
  padding-right: 10px;
}

table tr {
  line-height: 30px;
}

a.header-link {
  font-size: 10pt;
  font-weight: bold;
  /* For links with JS alerts */
  cursor: pointer;
}

.no-border {
  background-color: inherit;
  border: inherit;
  box-shadow: inherit;
}

/* MARK: Buttons and Form Elements */

input[type="text"], input[type="password"] {
  border: 1px solid var(--grid-color);
  border-radius: 4px;
  padding: 10px;
}

.button {
  display: inline-block;
  padding: 10px 14px;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  border-radius: 6px;
  border: none;

  font-size: 10pt;
  color: #fff;
  background: var(--system-blue-color);
  background-origin: border-box;
  box-shadow: 0px 0.5px 1.5px rgba(54, 122, 246, 0.25), inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

.button:disabled {
  background: var(--tertiary-label-color);
  cursor: inherit;
}

.button.warning {
  background: var(--system-red-color);
}

.small-button {
  padding: 4px 7px;
}

.button:focus {
  box-shadow: inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2), 0px 0.5px 1.5px rgba(54, 122, 246, 0.25), 0px 0px 0px 3.5px rgba(58, 108, 217, 0.5);
  outline: 0;
}

img.status-badge {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-bottom: 2px;
}

img.card-type {
  width: 24px;
  height: 24px;
  vertical-align: middle;
}

table.devices {
  min-width: 650px;
}

table.transactions {
  min-width: 650px;
}

table.transactions td {
  vertical-align: top;
}

table.member-validation-context td {
  padding: 1px;
}

table.member-validation-context tr:nth-child(odd) td {
  background-color: var(--alternating-content-background-color);
}

table.member-validation-context tr:nth-child(even) td {
  background-color: var(--text-background-color);
}

table.member-validation-context {
  border: solid 1px var(--grid-color);
  padding: inherit;
  width: 70%;
  margin-left: 16px;
}

/* MARK: Slider */

/* https://www.w3schools.com/howto/howto_css_switch.asp */

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  top: 4px;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(14px);
  -ms-transform: translateX(14px);
  transform: translateX(14px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* MARK: Footer */

footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 0;
  color: var(--secondary-label-color);
  max-width: var(--section-max-width);
  border-top: 1px solid var(--separator-color);
  margin: 20px auto 0 auto;
}

/* MARK: Mobile Styles */

@media (max-width: 750px) {
  nav {
    padding: 0 20px;
    box-sizing: border-box;
  }
  
  section {
    margin: 20px;
  }
  
  footer {
    font-size: 0.8em;
    flex-direction: column;
    align-items: center;
  }
}
