/* Fonts */
@font-face {
  font-display: swap;
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/roboto-v32-latin-regular.woff2') format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/roboto-v32-latin-500.woff2') format('woff2');
}

/* Global styles */
html {
  font-size: 62.5%;
  box-sizing: border-box;
}

*,
*::after,
*::before {
  box-sizing: inherit;
}

body {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.6rem;
  color: #e8e8e8;
  background-color: #fff;
}

/* Layout - Grid wrapper */
.wrapper {
  height: 100vh;
  background-color: black;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  position: relative;
}

.sidebar {
  padding: 15rem 0 10rem 0;
}

.header {
  padding-top: 4rem;
  position: absolute;
  left: 0rem;
  top: 0;
  width: 50%;
  text-align: center;
}

.icon {
  width: 11rem;
}

.title {
  font-size: 2.4rem;
  margin-bottom: 3rem;
}

/* Form styles */
.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 2.5rem;
  padding: 1.5rem 2.75rem;
  margin-bottom: 1.75rem;
  background-color: #3f464d;
  border-radius: 5px;
  transition: all 0.5s, transform 1ms;
}

.form-hidden {
  transform: translateY(-30rem);
  height: 0;
  padding: 0 2.25rem;
  margin-bottom: 0;
  opacity: 0;
}

.form__group {
  display: flex;
  align-items: center;
}

.form__label {
  flex: 0 0 40%;
}

.form__input {
  width: 100%;
  padding: 0.3rem 1.1rem;
  font-family: inherit;
  font-size: 1.4rem;
  border: none;
  border-radius: 3px;
  line-height: 1.6rem;
}
.form__input:focus {
  outline: none;
  background-color: #fff;
}

.form__input-type {
  color: black;
  appearance: none;
  background: url(../img/arrow.svg) no-repeat right 1rem center white;
  background-size: 1.2rem;
  padding-right: 3rem;
}

/* Workouts section */
.workouts {
  padding: 0 3rem 0 4rem;
  height: 57vh;
  overflow-y: auto;
  width: 100%;
}

.workouts::-webkit-scrollbar {
  width: 0;
}

.workout {
  background-color: #3f464d;
  border-radius: 5px;
  padding: 1.5rem 2.25rem;
  margin-bottom: 1.75rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.2fr 1.2fr;
  gap: 0.75rem 0.75rem;
  position: relative;
}

.workout-running {
  border-left: 5px solid green;
}

.workout-cycling {
  border-left: 5px solid orange;
}

.workout__title {
  grid-column: 1 / -1;
  margin-bottom: 1rem;
}

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

.workout__icon {
  font-size: 1.6rem;
  margin-right: 0.2rem;
  height: 0.28rem;
}

.workout__value {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

.workout__unit {
  font-size: 1.1rem;
  color: var(--color-light--1);
  font-weight: 800;
}

.hidden {
  display: none;
}

.footer {
  position: absolute;
  left: 0;
  bottom: 0;
  display: inline-block;
  width: 50%;
  text-align: center;
  padding-bottom: 2rem;
}

/* Buttons and interaction */
.reset {
  margin-bottom: 2rem;
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  padding: 0.3rem 1.1rem;
  border-radius: 5px;
  color: black;
  cursor: pointer;
}

.reset:focus,
.reset:hover,
.reset:active {
  background-color: #ff4d4d;
  color: white;
  border: 2px solid #cc0000;
  transition: all 0.5s ease;
  outline: none;
}

.delete-workout {
  position: absolute;
  top: 0.8rem;
  right: 1.2rem;
  font-size: 2rem;
  color: #ff4d4d;
  border: none;
  background: none;
  cursor: pointer;
}

/* Loader animation */
.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Map */
#map {
  width: 100%;
  height: 100vh;
  background-color: rgb(170, 170, 170);
  position: relative;
}

/* Popup width is defined in JS using options */
.leaflet-popup .leaflet-popup-content-wrapper {
  background-color: #0a151d;
  color: #e8e8e8;
  border-radius: 5px;
  padding-right: 0.6rem;
}

.leaflet-popup .leaflet-popup-content {
  font-size: 1.4rem;
}

.leaflet-popup .leaflet-popup-tip {
  background-color: #0a151d;
}

.running-popup .leaflet-popup-content-wrapper {
  border-left: 5px solid green;
}

.cycling-popup .leaflet-popup-content-wrapper {
  border-left: 5px solid orange;
}

/* Media starts */
@media (max-width: 1040px) {
  .form {
    grid-template-columns: 1fr;
  }

  .workout {
    padding: 1.5rem;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .wrapper {
    height: auto;
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
    width: 100%;
    padding: 2rem 2rem 7rem 2rem;
  }
  .header {
    padding: 2rem 0;
    width: 100%;
  }
  .icon {
    width: 6rem;
  }
  .title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  .reset {
    margin-bottom: 1rem;
    font-size: 1.4rem;
  }
  .wrapper-map {
    padding: 8rem 2rem 0 2rem;
  }
  #map {
    height: 30vh;
    order: 1;
  }
  .form {
    padding: 1rem;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }
  .workout {
    grid-template-columns: 0.7fr 0.7fr 1.3fr 1.3fr;
    padding: 1rem;
    margin-bottom: 1rem;
    gap: 0.75rem;
  }
  .footer {
    font-size: 1.4rem;
    width: 100%;
    padding-bottom: 1rem;
  }
}

@media (max-width: 560px) {
  .form {
    font-size: 1.4rem;
  }
  .workout {
    grid-template-columns: repeat(2, 1fr);
    font-size: 1.4rem;
  }
  .workout__value {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .sidebar {
    padding: 1rem 1.5rem 7rem 1.5rem;
  }
  .form__label {
    flex: 0 0 35%;
    margin-right: 0.3rem;
  }
  .form__input {
    font-size: 1.2rem;
    padding: 0.3rem 0.7rem;
  }
  .form__input-type {
    background-position: right 0.7rem center;
    background-size: 1rem;
  }
  .workouts {
    padding: 0;
  }
  .workout {
    padding: 0.75rem;
  }
  .workout__icon {
    font-size: 1.4rem;
  }
}

.form__input-type option {
  width: 1000px;
}
