:root {
  --gray-444: #2d3748;
  --gray-ccc: #cbd5e0;
  --gray-bbb: #a0aec0;
  --gray-777: #718096;
  --gray-888: #4a5568;
  --white-f3: #f7fafc;
  --white-eee: #edf2f7;
  --solid-white: #ffffff;
  --primary-color-1: #3182ce;
  --primary-color-1-1: #63b3ed;
  --primary-variant-1: #4299e1;
  --secondary-color-1: #805ad5;
  --secondary-color-1-1: #9f7aea;
  --secondary-variant-1: #6b46c1;
  --tertiary-color-1: #f6ad55;
  --tertiary-color-1-1: #fbd38d;
  --transparent-1: rgba(255, 255, 255, 0.5);
  --transparent-2: rgba(255, 255, 255, 0.7);
  --transparent-3: rgba(255, 255, 255, 0.9);
}

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

html {
  font-size: 62.5%;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--gray-444);
  background-color: var(--white-eee);
  height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

/* not logged in yet */

/* end of */

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.welcome {
  font-size: 1.9rem;
  font-weight: 500;
}

.logo {
  height: 5.25rem;
}

.login {
  display: flex;
}

.login__input {
  border: none;
  padding: 0.5rem 2rem;
  font-size: 1.6rem;
  font-family: inherit;
  text-align: center;
  width: 12rem;
  border-radius: 10rem;
  margin-right: 1rem;
  color: inherit;
  border: 1px solid var(--solid-white);
  transition: all 0.3s;
}

.login__input:focus {
  outline: none;
  border: 1px solid var(--gray-ccc);
}

.login__input::placeholder {
  color: var(--gray-bbb);
}

.login__btn {
  border: none;
  background: none;
  font-size: 2.2rem;
  color: inherit;
  cursor: pointer;
  transition: all 0.3s;
}

.login__btn:hover,
.login__btn:focus,
.btn--sort:hover,
.btn--sort:focus {
  outline: none;
  color: var(--gray-777);
}

/* MAIN */
.app {
  flex: 1;
  position: relative;
  max-width: 100rem;
  margin: 4rem auto;
  display: grid;
  grid-template-columns: 4fr 3fr;
  grid-template-rows: auto repeat(3, 15rem) auto;
  gap: 2rem;
  /* fade in/out animation */
  opacity: 0;
  transition: all 1s;
}

.balance {
  grid-column: 1 / span 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.balance__label {
  font-size: 2.2rem;
  font-weight: 500;
  margin-bottom: -0.2rem;
}

.balance__date {
  font-size: 1.4rem;
  color: var(--gray-888);
}

.balance__value {
  font-size: 4.5rem;
  font-weight: 400;
}

/* MOVEMENTS */
.movements {
  grid-row: 2 / span 3;
  background-color: var(--solid-white);
  border-radius: 1rem;
  overflow: scroll;
}

.movements__row {
  padding: 2.25rem 4rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--white-eee);
}

.movements__type {
  font-size: 1.1rem;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--solid-white);
  padding: 0.1rem 1rem;
  border-radius: 10rem;
  margin-right: 2rem;
}

.movements__date {
  font-size: 1.1rem;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--gray-444);
}

.movements__type--deposit {
  background-image: linear-gradient(
    to top left,
    var(--primary-color-1),
    var(--primary-color-1-1)
  );
}

.movements__type--withdrawal {
  background-image: linear-gradient(
    to top left,
    var(--secondary-color-1),
    var(--secondary-color-1-1)
  );
}

.movements__value {
  font-size: 1.7rem;
  margin-left: auto;
}

/* SUMMARY */
.summary {
  grid-row: 5 / 6;
  display: flex;
  align-items: baseline;
  padding: 0 0.3rem;
  margin-top: 1rem;
}

.summary__label {
  font-size: 1.2rem;
  font-weight: 500;
  text-transform: uppercase;
  margin-right: 0.8rem;
}

.summary__value {
  font-size: 2.2rem;
  margin-right: 2.5rem;
}

.summary__value--in,
.summary__value--interest {
  color: var(--primary-variant-1);
}

.summary__value--out {
  color: var(--secondary-variant-1);
}

.btn--sort {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 1.3rem;
  font-weight: 500;
  cursor: pointer;
}

/* OPERATIONS */
.operation {
  border-radius: 1rem;
  padding: 3rem 4rem;
  color: #333;
}

.operation--transfer {
  background-image: linear-gradient(
    to top left,
    var(--tertiary-color-1),
    var(--tertiary-color-1-1)
  );
}

.operation--loan {
  background-image: linear-gradient(
    to top left,
    var(--primary-color-1),
    var(--primary-color-1-1)
  );
}

.operation--close {
  background-image: linear-gradient(
    to top left,
    var(--secondary-color-1),
    var(--secondary-color-1-1)
  );
}

h2 {
  margin-bottom: 1.5rem;
  font-size: 1.7rem;
  font-weight: 600;
  color: #333;
}

.form {
  display: grid;
  grid-template-columns: 2.5fr 2.5fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.4rem 1rem;
}

/* Exceptions for interst */
.form.form--loan {
  grid-template-columns: 2.5fr 1fr 2.5fr;
}
.form__label--loan {
  grid-row: 2;
}
/* End exceptions */

.form__input {
  width: 100%;
  border: none;
  background-color: var(--transparent-1);
  font-family: inherit;
  font-size: 1.5rem;
  text-align: center;
  color: #333;
  padding: 0.3rem 1rem;
  border-radius: 0.7rem;
  transition: all 0.3s;
}

.form__input:focus {
  outline: none;
  background-color: var(--transparent-2);
}

.form__label {
  font-size: 1.3rem;
  text-align: center;
}

.form__btn {
  border: none;
  border-radius: 0.7rem;
  font-size: 1.8rem;
  background-color: var(--solid-white);
  cursor: pointer;
  transition: all 0.3s;
}

.form__btn:focus {
  outline: none;
  background-color: var(--transparent-3);
}

.logout-timer {
  padding: 0 0.3rem;
  margin-top: 1.9rem;
  text-align: right;
  font-size: 1.25rem;
}

.timer {
  font-weight: 600;
}

/* Footer */
footer {
  font-size: 1.3rem;
  text-align: center;
  padding: 2rem 0;
  color: var(--gray-777);
  margin-top: 2rem;
}

footer a {
  color: var(--primary-color-1);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

footer a:hover {
  color: var(--primary-variant-1);
}

footer a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--primary-variant-1);
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

/* Media Queries */
@media (max-width: 900px) {
  html {
    /* 9px instead of 10px */
    font-size: 56.25%;
  }

  .app {
    max-width: 90%;
  }
}

@media (max-width: 768px) {
  html {
    /* 8px instead of 10px */
    font-size: 50%;
  }

  body {
    padding: 1.5rem;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto auto;
    gap: 1.5rem;
  }

  .balance {
    grid-column: 1;
  }

  .movements {
    grid-row: 2;
    max-height: 40rem;
  }

  .summary {
    grid-row: 3;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .operation {
    padding: 2rem 3rem;
  }

  .summary__value {
    margin-right: 1.5rem;
  }

  .btn--sort {
    margin-top: 1rem;
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  html {
    /* 7px instead of 10px */
    font-size: 43.75%;
  }

  body {
    padding: 1rem;
  }

  nav {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  .login {
    width: 100%;
    justify-content: center;
  }

  .login__input {
    width: 40%;
  }

  .balance {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
  }

  .movements__row {
    padding: 2rem 2rem;
    flex-wrap: wrap;
  }

  .movements__type,
  .movements__date {
    margin-bottom: 0.5rem;
  }

  .movements__value {
    width: 100%;
    text-align: right;
    margin-top: 0.5rem;
  }

  .form {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, auto);
    gap: 1rem;
  }

  .form.form--loan {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, auto);
  }

  .form__label {
    order: -1;
  }

  .form__btn {
    grid-column: 1;
    padding: 0.5rem;
  }

  .form__label--loan {
    grid-row: 1;
  }

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

@media (max-width: 350px) {
  html {
    /* 6px instead of 10px */
    font-size: 37.5%;
  }
}
