@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap");

:root {
  --lime: hsl(61, 70%, 52%);
  --red: hsl(4, 69%, 50%);

  --white: hsl(0, 0%, 100%);
  --slate100: hsl(202, 86%, 94%);
  --slate300: hsl(203, 41%, 72%);
  --slate500: hsl(200, 26%, 54%);
  --slate700: hsl(200, 24%, 40%);
  --slate900: hsl(202, 55%, 16%);
}

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

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  color: var(--slate900);

  background-color: var(--slate100);
}

/* mortgage box */
.mortgage-box-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.mortgage-box {
  height: 560px;
  width: 900px;
  display: flex;
  border-radius: 15px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  background: var(--white);
  flex-direction: row;
}

/*
=======
Mortgage calculator - left
=======
*/
.mortgage-calculator {
  flex: 1;
  padding: 20px;
  background: var(--white);
  border-radius: 15px 0 0 15px;
}

.heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.mortgage-heading-title,
.calculate-repayments-button {
  color: var(--slate900);
}

.clear-all-button {
  border: none;
  padding: 5px;
  cursor: pointer;
  background-color: var(--white);
  text-decoration: underline;
  color: var(--slate500);
  font-size: 1rem;
  text-transform: capitalize;
}

/*
=======
Form
=======
*/
.mortgage-form {
  height: 90%;
  overflow: auto;
  padding: 5px;
}

.input-field {
  height: 100px;

  display: flex;
  flex-direction: column;

  margin-bottom: 10px;
}

.mortgage-form-label,
.legend-title {
  width: 75%;

  margin-bottom: 10px;
  text-transform: capitalize;

  color: var(--slate700);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-weight: 600;
}

.input-group {
  display: flex;

  border: 1.8px solid var(--slate300);
  border-radius: 5px;
  transition: border-color 0.3s ease;
}

.input-group-for-left {
  justify-content: left;
}

.input-group-for-right {
  justify-content: right;
  width: 100%;
}

.input-group:focus-within,
.clickable-radio:focus-within {
  border: 1.8px solid var(--lime);
}

.mortgage-input {
  height: 2.75rem;
  width: 100%;
  border: none;
  border-radius: 5px;
  outline: none;
  font-size: 1.2rem;
}

#mortgage-amount {
  padding-left: 45px;
}

#mortgage-term,
#mortgage-rate {
  padding-left: 10px;
}

.icon-inside-input {
  height: 2.75rem;

  position: absolute;
  text-align: center;

  display: flex;
  justify-content: center;
  align-items: center;

  background-color: var(--slate100);
  color: var(--slate500);
  font-weight: bolder;
}

.icon-left {
  border-radius: 5px 0 0 5px;
  width: 35px;
}

.icon-right {
  border-radius: 0 5px 5px 0;
  width: 65px;
}

#mortgage-amount::placeholder,
#mortgage-term::placeholder,
#mortgage-rate::placeholder {
  color: var(--slate500);
  font-size: 1rem;
}

/* same height for all inputs */
.clickable-radio {
  height: 2.75rem; /* */
  width: 100%;
  font-size: 1.2rem;

  padding: 5px;
  border: 1.8px solid var(--slate300);
  border-radius: 5px;
  transition: border-color 0.3s ease;
  font-weight: 600;
}

.mortgage-term-and-rate-container {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

/* Radio field */
fieldset {
  border: none;
  padding: 0;
  margin: 0 0 20px 0;
  display: block;
  width: 100%;
}

.radio-selection-container {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  gap: 20px;
}

/* Radio Button */
input[type="radio"] {
  height: 1rem;
  width: 1rem;
  margin-right: 0.5rem;
}

.custom-radio {
  appearance: none;
  -webkit-appearance: none; /* Safari support */
  border: 0.2rem solid #fff;
  background-color: #e8e8e8;
  border-radius: 50%;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;

  margin-left: 10px;
}

.custom-radio:focus-visible {
  outline-offset: 0;
}

#radio-selection-one,
#radio-selection-two {
  box-shadow: 0 0 0 1px #999;
}

#radio-selection-one:hover,
#radio-selection-two:hover {
  border-width: 0;
}

#radio-selection-one:checked,
#radio-selection-two:checked {
  box-shadow: 0 0 0 1px var(--lime);
  background-color: var(--lime);
  border-width: 0.2rem;
}

#radio-selection-one,
#radio-selection-two,
.cursor {
  cursor: pointer;
}

/*
=======
Button
=======
*/
.button-container {
  display: flex;
  justify-content: center;
}

.calculate-repayments-button {
  border: none;
  padding: 15px;
  cursor: pointer;
  background-color: var(--lime);
  text-align: center;
  border-radius: 35px;
  font-size: 1.1rem;
  font-weight: 600;
  width: 100%;

  display: flex;
  justify-content: center;
}

.icon-inside-button {
  margin-right: 10px;
}

/*
=======
Mortgage results - right
=======
*/
.mortgage-results {
  background: var(--slate900);
  flex: 1;
  border-radius: 0 15px 15px 85px;

  position: relative;
}

.ilustration {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;

  flex-direction: column;
  padding: 20px;
}

.ilustration img {
  margin-bottom: 20px;
}

.image-heading {
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.image-paragraph {
  color: var(--white);
  text-align: center;
}

/*
=======
Overlay
=======
*/

.overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--slate900);
  overflow: hidden;
  width: 0;
  height: 100%;
  transition: 0.5s ease;

  border-radius: 0 15px 15px 85px;
}

.overlay.active {
  width: 100%;
}

.results-box {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;

  color: white;
  font-size: 20px;
  margin: 30px;
}

.title-flex {
  display: flex;
  justify-content: left;
  width: 100%;
}

.results-box h3 {
  margin-bottom: 25px;
  color: var(--slate100);
}

.text {
  color: var(--slate300);
  font-size: 16px;
  margin-bottom: 25px;
}

.text-boxes {
  color: var(--slate300);
  font-size: 16px;
  margin-bottom: 10px;
}

.monthly-repayment-result {
  color: var(--lime);
  font-size: 3.1rem;
  font-weight: bold;
}

.total-repay-term {
  font-size: 2rem;
  font-weight: bold;
}

.show-results {
  height: 250px;
  width: 355px;

  border-top: 4px solid var(--lime);
  border-radius: 5px;

  background-color: #0e2431;
  padding: 20px;
}

.main-result {
  margin-bottom: 15px;
}

.divisor-container {
  display: flex;
  justify-content: center;
  align-items: center;

  margin-bottom: 25px;
}

.separator {
  height: 1px;
  background-color: var(--slate700);
  width: 95%;
}

/*
=======
Keyframes
=======
*/
/* keyframe for error animation */
@keyframes slide-in-left {
  0% {
    transform: translateX(-1000px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.error-message {
  color: var(--red);
  font-size: 14px;
}

/* Media Queries */
@media only screen and (max-width: 768px) {
  .mortgage-box {
    flex-direction: column;
    height: 100%;
    width: 100%;
    border-radius: 0;
  }

  .mortgage-calculator {
    padding: 35px;
    border-radius: 0;
  }

  .heading {
    flex-direction: column;
  }

  .mortgage-heading-title {
    margin-bottom: 10px;
  }
  .clear-all-button {
    text-align: left;
    width: 20%;
  }

  .mortgage-term-and-rate-container {
    flex-direction: column;
    gap: 0;
  }

  .mortgage-form {
    height: 100%;
  }
  .mortgage-results {
    border-radius: 0;
  }

  .ilustration {
    margin-bottom: 100px;
  }
}

@media only screen and (max-width: 600px) {
  .mortgage-box {
    flex-direction: column;
    height: 100%;
    width: 100%;
    border-radius: 0;
  }

  .mortgage-calculator {
    padding: 35px;
    border-radius: 0;
  }

  .heading {
    flex-direction: column;
  }

  .mortgage-heading-title {
    margin-bottom: 10px;
  }

  .clear-all-button {
    text-align: left;
    width: 20%;
  }

  .mortgage-term-and-rate-container {
    flex-direction: column;
    gap: 0;
  }

  .mortgage-form {
    height: 100%;
  }

  .mortgage-results {
    border-radius: 0;
  }

  .ilustration {
    margin-bottom: 100px;
  }
}
