* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --app-bg: #111;
  --header-bg: black;
  --header-heigt: 64px;
  --footer-heigt: 48px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #222;
}

div {
  user-select: none;
}

svg {
  width: 100%;
  height: 100%;
}

#app {
  background-color: var(--app-bg);
  color: white;
}

#cacheMajorVersion,
#indexedDbVersion {
  background-color: white;
  color: black;
  padding: 4px;
  border-radius: 4px;
  font-size: 16px;
}

#indexedDbVersion {
  background-color: cyan;
}

#mainHeader {
  min-height: var(--header-heigt);
  background-color: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: none;
}

.page-title {
  font-size: 34px;
  padding-left: 1rem;
  color: white;
}

.views {
  background-color: #001a22;
}

.views .page {
  min-height: calc(100dvh - var(--header-heigt) - var(--footer-heigt));
}

#mainFooter {
  background-color: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1dvw;
}

#mainFooter .btn {
  padding: 3dvw;
  color: white;
}

#exerciseListView {
  --list-row-bg: #6d18ad;
  --title-bg: crimson;
  --row-bg: rgba(0, 0, 0, 0.75);
  padding-bottom: 4.5rem;
}

#exerciseListView .list {
  padding: 0.5rem 0.25rem;
}

#exerciseListView .list .row {
  background: var(--list-row-bg);
}

#exerciseListView .btns {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

#newExerciseBtn {
  position: fixed;
  bottom: calc(var(--footer-heigt) + 1dvh);
  right: 2.5dvw;
  width: 80px;
  height: 80px;
  z-index: 1;
  border: 1px solid white;
  border-radius: 50%;
  background-color: var(--list-row-bg);
  color: white;
  font-size: 40px;
}

#newExerciseBtn:active {
  background-color: #8b3cc7;
}

#singleExerciseView {}

#singleExerciseView .heading,
#sessionForm .heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-items: center;
}

#singleExerciseView .heading {
  background-color: #7f031c;
}

#singleExerciseView .name {
  font-size: 26px;
  padding: 1rem 0.75rem;
}

#singleExerciseView .session-history-container {
  background-color: #1c0006;
  padding-bottom: 0.125rem;
  margin-top: 0.75rem;
}

.session-history-container h4 {
  font-size: 18px;
  padding: 0.25rem;
}

.session-history {
  font-size: 20px;
  margin-bottom: 12px;
  font-family: 'Courier New', Courier, monospace;
}

.session-history.current-date-log {
  background-color: #002d00;
  font-size: 24px;
}

.session-history .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 4px;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  margin-bottom: 4px;
}

.session-history .row .weight-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.75rem;
}

.weight-container .weight {
  background-color: rgba(0, 0, 0, 0.5);
  padding: 2px;
  border-radius: 4px;
}

.session-history .row .right-side {
  display: flex;
  gap: 4px;
}
.has-notes {
  color: white;
  width: 25px;
}

.session-history .row .date {
  background-color: rgba(255, 255, 255, 0.137);
  padding: 0 2px;
  border-radius: 4px;
}

/* Generic for lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2dvw;
  color: white;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

#exerciseListView .list .row[data-timestamp="hoy"] {
  order: -1;
  --list-row-bg: #ad189b;
}

.list .row:active {
  background-color: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.5);
}

.list .row .exerciseName {
  font-size: 22px;
  background-color: #ffffff29;
  padding: .5rem 1rem;
  border-radius: 6px;
}

.list .row .right-side {
  display: flex;
  flex-direction: column;
  align-items: end;
  text-align: right;
  color: #ffc8c8;
  gap: 4px;
}

.list .row .timestamp {
  color: white;
  font-size: 20px;
}

.list .row .last-set-data {
  font-size: 16px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 10;

  display: flex;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 1dvw;
}

.modal .backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
}

.modal .close-modal {
  position: absolute;
  top: 1dvh;
  right: 5dvw;
  font-size: 42px;
}

.modal .content {
  position: absolute;
  top: 60px;
  width: 90%;
  max-width: 600px;
  border-radius: 8px;
  max-height: 85dvh;
  overflow-y: auto;
}

/* State Machine */

/* Modal/Forms state */
#app[data-show-exercise-form='true'] .modal,
#app[data-show-session-form='true'] .modal {
  display: flex;
}

#app[data-show-exercise-form='false'] #exerciseForm,
#app[data-show-session-form='false'] #sessionForm {
  display: none;
}

/* Views state */
#app:not([data-current-view='ExerciseList']) #exerciseListView,
#app:not([data-current-view='SingleExercise']) #singleExerciseView {
  display: none;
}

/* Go Back button visibility */
#app[data-current-view='ExerciseList'] .go-back {
  visibility: hidden;
}