:root {
  --primary-green-400: hsl(172, 67%, 45%);
  --active-green: hsl(173, 61%, 77%);
  --green-900: hsl(183, 100%, 15%);
  --grey-500: hsl(186, 14%, 43%);
  --grey-400: hsl(184, 14%, 56%);
  --grey-200: hsl(185, 41%, 84%);
  --grey-50: hsl(189, 47%, 97%);
}

/* ===== RESET ===== */

html {
  min-height: 100%;
}

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

body,
h1,
h2,
p,
blockquote {
  margin-block-end: 0;
  margin: 0;
  word-spacing: -4px;
}

img,
picture {
  max-width: 100%;
  display: block;
}

footer {
  position: fixed;
  z-index: -1;
  left: 0;
  bottom: 0;
  width: 100%;
  color: var(--green-900);
  text-align: center;
  margin-bottom: 5px;
}

.attribution {
  font-size: 11px;
  text-align: center;
}
.attribution a {
  color: hsl(228, 45%, 44%);
}

/* ===== BASE STYLES / MOBILE ===== */

main {
  margin-top: 4rem;
}

body {
  font-family:
    Space Mono,
    monospace;
  margin: auto;
  text-align: center;
  background-color: var(--grey-200);
  color: white;
}

h1 {
  font-size: 1.7rem;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: 7px;
  color: var(--green-900);
  margin-bottom: 3rem;
}

.app-container {
  max-width: 375px;
  margin: auto;
  display: flex;
  flex-direction: column;
  text-align: left;
  color: var(--grey-500);
  background-color: white;
  padding: 1rem 2rem;
  border-radius: 15px 15px 0 0;
  margin-bottom: 1.5rem;
}

.input-box {
  margin-bottom: 1rem;
}

.output-box {
  background-color: var(--green-900);
  color: white;
  padding: 1.5rem;
  border-radius: 15px;
  margin-bottom: 1rem;
}

select {
  font-family: Space Mono;
  color: var(--green-900);
  border: solid var(--grey-500) 1px;
  border-radius: 5px;
}

select:focus {
  outline: none;
  border: 1px solid var(--primary-green-400);
}

.bill-wrapper,
.tip-wrapper,
.people-wrapper {
  margin-bottom: 1.8rem;
  font-size: 0.9rem;
}

.select-currency-wrapper {
  display: flex;
  justify-content: right;
  gap: 5px;
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
}

.tip-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

button:hover {
  cursor: pointer;
  background-color: var(--primary-green-400);
}

.tip-btns button:hover,
.tip-btns button:focus-visible {
  background-color: var(--primary-green-400);
  color: var(--green-900);
}

.tip-btns button {
  font-family: Space Mono;
  font-size: 1.3rem;
  font-weight: 600;
  padding: 0.3rem 1rem;
  border: none;
  color: var(--grey-50);
  background-color: var(--green-900);
  border-radius: 5px;
}

input {
  display: block;
  text-align: right;
  background-color: var(--grey-50);
  border: none;
  font-family: Space Mono;
  font-weight: 600;
  color: var(--green-900);
  width: 100%;
  box-sizing: border-box;
  font-size: 1.3rem;
  padding: 0.3rem 1rem;
  border-radius: 5px;
}

.bill-input {
  /* background-image: url("./images/icon-krone.svg"); */
  background-repeat: no-repeat;
  /* background-size: 17px; */
  /* background-position-y: 12px; */
  background-position-x: 15px;
}

.nok-bg {
  background-image: url("./images/icon-krone.svg");
  background-position-y: 12px;
  background-size: 17px;
}

.eur-bg {
  background-image: url("./images/icon-euro.svg");
  background-position-y: 12px;
  background-size: 17px;
}

.usd-bg {
  background-image: url("./images/icon-dollar.svg");
  background-position-y: 9px;
  background-size: 15px;
}

.gbp-bg {
  background-image: url("./images/icon-pound.svg");
  background-position-y: 12px;
  background-size: 17px;
}

.bill-input::-webkit-outer-spin-button,
.bill-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bill-input[type="number"] {
  -moz-appearance: textfield;
}

.people-input {
  background-image: url("./images/icon-person.svg");
  background-repeat: no-repeat;
  background-size: 12px;
  background-position-y: 12px;
  background-position-x: 15px;
}

input:focus {
  outline: 2px solid var(--primary-green-400);
}

input::placeholder {
  color: var(--grey-500);
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0.4;
}

.visually-hidden {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
}

.currency-label {
  font-weight: 600;
}

.bill-label,
.tip-label,
.people-label {
  display: inline-block;
  margin-bottom: 0.7rem;
  font-weight: 600;
}

.label-wrapper {
  margin-bottom: -4px;
  padding: 0;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.people-error,
.bill-error {
  font-size: 0.7rem;
  font-weight: 600;
  color: #fe7d38;
  transform: translateY(4px);
}

.custom-error {
  grid-column: 2;
  justify-self: start;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  height: 1rem;
  color: #fe7d38;
  margin-top: -0.6rem;
}

.amount {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--grey-50);
}

.person {
  font-size: 0.8rem;
  color: var(--grey-400);
}

.amount-number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-green-400);
}

.amount-result {
  display: flex;
  flex-direction: row;
  gap: 3px;
  align-items: center;
}

.icon-before {
  flex-direction: row-reverse;
  gap: 0px;
}

.tip-amount-wrapper,
.total-amount-wrapper {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.reset-btn {
  width: 100%;
  font-family: Space Mono;
  font-size: 1.2rem;
  font-weight: 600;
  padding: 0.3rem 1rem;
  border: none;
  color: var(--green-900);
  background-color: hsl(183, 79%, 24%);
  border-radius: 5px;
}

.hidden {
  display: none;
}

.active-state {
  background-color: var(--active-green) !important;
  color: var(--green-900) !important;
}

input:not(:placeholder-shown):invalid {
  outline: 2px solid #fe7d38;
}

.error-state,
.error-state:focus {
  outline: 2px solid #fe7d38;
}

/* ===== DESKTOP ===== */

@media (min-width: 1024px) {
  .app-container {
    max-width: 950px;
    display: flex;
    flex-direction: row;
    gap: 2rem;
    padding: 2rem;
    border-radius: 15px 15px 15px 15px;
  }

  .input-box {
    flex: 1 1 0;
  }

  .output-box {
    flex: 1 1 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .result-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .amount {
    font-size: 1.4rem;
  }

  .person {
    font-size: 1rem;
  }

  .amount-number {
    font-size: 2.5rem;
  }

  /* .reset-btn {
    position: relative;
    bottom: 0;
  } */
}
