@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");

:root {
  --md-sys-color-primary: rgb(156 212 159);
  --md-sys-color-surface-tint: rgb(156 212 159);
  --md-sys-color-on-primary: rgb(0 57 19);
  --md-sys-color-primary-container: rgb(29 81 40);
  --md-sys-color-on-primary-container: rgb(184 241 185);
  --md-sys-color-secondary: rgb(184 204 181);
  --md-sys-color-on-secondary: rgb(36 52 37);
  --md-sys-color-secondary-container: rgb(58 75 58);
  --md-sys-color-on-secondary-container: rgb(212 232 209);
  --md-sys-color-tertiary: rgb(161 206 214);
  --md-sys-color-on-tertiary: rgb(0 54 61);
  --md-sys-color-tertiary-container: rgb(31 77 84);
  --md-sys-color-on-tertiary-container: rgb(189 234 243);
  --md-sys-color-error: rgb(255 180 171);
  --md-sys-color-on-error: rgb(105 0 5);
  --md-sys-color-error-container: rgb(147 0 10);
  --md-sys-color-on-error-container: rgb(255 218 214);
  --md-sys-color-background: rgb(16 21 16);
  --md-sys-color-on-background: rgb(224 228 219);
  --md-sys-color-surface: rgb(16 21 16);
  --md-sys-color-on-surface: rgb(224 228 219);
  --md-sys-color-surface-variant: rgb(66 73 64);
  --md-sys-color-on-surface-variant: rgb(193 201 190);
  --md-sys-color-outline: rgb(139 147 137);
  --md-sys-color-outline-variant: rgb(66 73 64);
  --md-sys-color-shadow: rgb(0 0 0);
  --md-sys-color-scrim: rgb(0 0 0);
  --md-sys-color-inverse-surface: rgb(224 228 219);
  --md-sys-color-inverse-on-surface: rgb(45 50 44);
  --md-sys-color-inverse-primary: rgb(54 105 62);
  --md-sys-color-primary-fixed: rgb(184 241 185);
  --md-sys-color-on-primary-fixed: rgb(0 33 8);
  --md-sys-color-primary-fixed-dim: rgb(156 212 159);
  --md-sys-color-on-primary-fixed-variant: rgb(29 81 40);
  --md-sys-color-secondary-fixed: rgb(212 232 209);
  --md-sys-color-on-secondary-fixed: rgb(15 31 17);
  --md-sys-color-secondary-fixed-dim: rgb(184 204 181);
  --md-sys-color-on-secondary-fixed-variant: rgb(58 75 58);
  --md-sys-color-tertiary-fixed: rgb(189 234 243);
  --md-sys-color-on-tertiary-fixed: rgb(0 31 36);
  --md-sys-color-tertiary-fixed-dim: rgb(161 206 214);
  --md-sys-color-on-tertiary-fixed-variant: rgb(31 77 84);
  --md-sys-color-surface-dim: rgb(16 21 16);
  --md-sys-color-surface-bright: rgb(54 58 53);
  --md-sys-color-surface-container-lowest: rgb(11 15 11);
  --md-sys-color-surface-container-low: rgb(24 29 24);
  --md-sys-color-surface-container: rgb(28 33 28);
  --md-sys-color-surface-container-high: rgb(39 43 38);
  --md-sys-color-surface-container-highest: rgb(49 54 48);
  --font-primary: "Roboto", sans-serif;
  --font-secondary: "JetBrains Mono", monospace;
}

.light {
  --md-sys-color-primary: rgb(54 105 62);
  --md-sys-color-surface-tint: rgb(54 105 62);
  --md-sys-color-on-primary: rgb(255 255 255);
  --md-sys-color-primary-container: rgb(184 241 185);
  --md-sys-color-on-primary-container: rgb(0 33 8);
  --md-sys-color-secondary: rgb(81 99 81);
  --md-sys-color-on-secondary: rgb(255 255 255);
  --md-sys-color-secondary-container: rgb(212 232 209);
  --md-sys-color-on-secondary-container: rgb(15 31 17);
  --md-sys-color-tertiary: rgb(57 101 108);
  --md-sys-color-on-tertiary: rgb(255 255 255);
  --md-sys-color-tertiary-container: rgb(189 234 243);
  --md-sys-color-on-tertiary-container: rgb(0 31 36);
  --md-sys-color-error: rgb(186 26 26);
  --md-sys-color-on-error: rgb(255 255 255);
  --md-sys-color-error-container: rgb(255 218 214);
  --md-sys-color-on-error-container: rgb(65 0 2);
  --md-sys-color-background: rgb(247 251 242);
  --md-sys-color-on-background: rgb(24 29 24);
  --md-sys-color-surface: rgb(247 251 242);
  --md-sys-color-on-surface: rgb(24 29 24);
  --md-sys-color-surface-variant: rgb(221 229 217);
  --md-sys-color-on-surface-variant: rgb(66 73 64);
  --md-sys-color-outline: rgb(114 121 112);
  --md-sys-color-outline-variant: rgb(193 201 190);
  --md-sys-color-shadow: rgb(0 0 0);
  --md-sys-color-scrim: rgb(0 0 0);
  --md-sys-color-inverse-surface: rgb(45 50 44);
  --md-sys-color-inverse-on-surface: rgb(238 242 233);
  --md-sys-color-inverse-primary: rgb(156 212 159);
  --md-sys-color-primary-fixed: rgb(184 241 185);
  --md-sys-color-on-primary-fixed: rgb(0 33 8);
  --md-sys-color-primary-fixed-dim: rgb(156 212 159);
  --md-sys-color-on-primary-fixed-variant: rgb(29 81 40);
  --md-sys-color-secondary-fixed: rgb(212 232 209);
  --md-sys-color-on-secondary-fixed: rgb(15 31 17);
  --md-sys-color-secondary-fixed-dim: rgb(184 204 181);
  --md-sys-color-on-secondary-fixed-variant: rgb(58 75 58);
  --md-sys-color-tertiary-fixed: rgb(189 234 243);
  --md-sys-color-on-tertiary-fixed: rgb(0 31 36);
  --md-sys-color-tertiary-fixed-dim: rgb(161 206 214);
  --md-sys-color-on-tertiary-fixed-variant: rgb(31 77 84);
  --md-sys-color-surface-dim: rgb(215 219 211);
  --md-sys-color-surface-bright: rgb(247 251 242);
  --md-sys-color-surface-container-lowest: rgb(255 255 255);
  --md-sys-color-surface-container-low: rgb(241 245 236);
  --md-sys-color-surface-container: rgb(235 239 231);
  --md-sys-color-surface-container-high: rgb(229 233 225);
  --md-sys-color-surface-container-highest: rgb(224 228 219);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color: var(--md-sys-color-on-background);
  background-color: var(--md-sys-color-background);
  font-family: var(--font-primary);
}
body {
  font-size: clamp(1rem, calc(2vw + 1rem), 2rem);
}
.page.active {
  display: flex;
}
.page {
  display: none;
}
#calculator-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  height: 100dvh;
}
#conversion {
  height: 94dvh;
  width: 100%;
  position: absolute;
  bottom: 0;
  background-color: var(--md-sys-color-surface-container-low);
  z-index: 4;
  flex-direction: column;
}
.wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}
#display,
#resultDisplay {
  padding: 0.6rem;
  font-family: var(--font-secondary);
  overflow: scroll;
  height: 20vh;
  text-align: right;
  overflow-wrap: break-word;
  word-break: break-word;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background-color: var(--md-sys-color-surface-container);
  border-radius: 16px;
  margin: 0.2rem;
}

#resultDisplay {
  font-size: 1.6rem;
  height: 63px;
  color: #a6a6a6;
}
#display {
  font-size: clamp(3.8rem, calc(4vw + 2rem), 6rem);
}
#calculator button:hover,
#calculator-toolbar button:hover {
  border-radius: 25px;
  transform: scale(0.95);
}

#calculator {
  padding: 0.4rem;
  overflow: hidden;
  align-items: center;
  justify-content: flex-end;
  display: flex;
  margin: 8px;
  z-index: 3;
  flex-direction: column;
  width: 100vw;
  height: 100%;
  position: relative;
}

#calculator .re {
  display: flex;
  width: 100%;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  margin: 2px;
}

#calculator button {
  padding: 0.5rem;
  margin: 2px;
  border: none;
  font-size: clamp(1.2rem, calc(2vw + 1rem), 2rem);
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  text-align: center;
  border-radius: 53px;
  font-weight: 500;
  transition: all 0.2s ease-out;
  height: 90%;
  width: 20%;
  position: relative;
  z-index: 3;
  overflow: hidden;
}

#calculator .operator {
  color: var(--md-sys-color-on-primary-container);
  background-color: var(--md-sys-color-primary-container);
  font-size: 2.1rem;
  font-weight: 400;
}

#calculator .equal {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

#calculator .clear {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

#calculator .operator2 {
  width: 20%;
  height: 10px;
  font-size: 1.4rem;
}

#calculator #delete {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.1rem;
}

span.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 300ms linear;
  background-color: rgba(255, 255, 255, 0.4); /* Default for dark theme */
  pointer-events: none;
}

html.light span.ripple {
  background-color: rgba(0, 0, 0, 0.3); /* Ripple color for light theme */
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

#calculator-toolbar {
  display: flex;
  align-items: center;
  width: 90%;
  justify-content: space-between;
  padding: 7px;
  margin: 0 auto;
}

#calculator-toolbar button {
  flex: 1;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  text-align: center;
  border: none;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 49px;
  width: 25%;
  margin: 2px;
  padding: 0.7rem;
  font-size: 1.5rem;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}
.arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}
.arrow.rotate {
  transform: rotate(180deg);
}
#calculator-toolbar > .arrow-btn {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

#other {
  align-items: center;
  width: 100%;
  overflow-y: scroll;
  overflow-x: hidden;
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0;
  border-radius: 24px;
  z-index: 7;
  opacity: 0;
}

.row1,
.row2 {
  display: flex;
  justify-content: space-around;
  background-color: var(--md-sys-color-surface-container);
  height: 100%;
  padding: 8px;
  width: 100%;
}

#other .op {
  position: relative;
  text-align: center;
  font-size: 19px;
}

#settings {
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  width: 95vw;
  height: 79vh;
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 16px;
  display: none;
  flex-direction: column;
  opacity: 0;
  z-index: 5;
}

.setting {
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  background-color: transparent;
  border-radius: 40px;
  padding: 0.2rem;
  margin: 0.2rem;
  overflow: hidden;
  width: 40px;
  position: relative;
  transition: 0.2s all ease;
}

.setting:focus,
.setting:active {
  transform: scale(1.05);
}

h2 {
  font-size: 2.3rem;
  font-weight: 400;
  margin: 0.5rem;
  margin-bottom: 1.2rem;
  padding: 1rem;
}

.list {
  border-radius: 16px;
  padding: 7px;
  margin: 7px;
}

.cont {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-radius: 18px;
  transition: 0.3s all ease;
  margin: 7px;
}
.cont:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.he {
  font-size: 1.05rem;
  line-height: 1.6rem;
  font-weight: 500;
}

.su {
  font-size: 0.89rem;
  font-weight: 500;
  width: 220px;
}

.header {
  display: flex;
  width: 100%;
  z-index: 10;
  justify-content: space-between;
}
.switch {
  display: flex;
  padding-right: 10px;
  justify-content: flex-end;
  position: relative;
  z-index: 8;
  overflow: hidden;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border: none;
  border-radius: 40px;
  padding: 6px;
  margin: 5px;
  transition: all 0.3s ease;
  display: flex;
  align-content: center;
  justify-content: center;
}
.switch:active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

/* conversion page css */

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
#convert-value {
  padding: 12px;
  border-radius: 40px;
  margin: 12px;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  border: none;
  text-align: center;
  font-weight: 500;
  outline: none;
}
#sect {
  display: flex;
  padding: 8px;
}

#input {
  padding: 9px;
  height: 50px;
  font-size: 1.4rem;
  font-weight: 500;
  border-radius: 40px;
  margin: 12px;
  padding-left: 20px;
  margin-top: 40px;
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: none;
  outline: none;
}

#convertButton {
  border: none;
  width: 100%;
  padding: 12px;
  margin: 12px;
}
::placeholder {
  color: var(--md-sys-color-on-secondary-container);
  opacity: 0.4;
}

#result {
  display: flex;
  flex-direction: column;
  margin: 10px;
  margin-top: 30px;
  padding: 16px;
  line-height: 1.7;
  margin-left: 20px;
  font-size: 1.6rem;
  font-family: var(--font-secondary);
  background-color: var(--md-sys-color-surface-container-high);
  border-radius: 20px;
}

/* History */

#historyContainer {
  display: none;
  z-index: 10;
  opacity: 0;
  flex-direction: column;
  position: absolute;
  top: 45px;
  min-height: 30vh;
  max-height: 50vh;
  overflow: scroll;
  background-color: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  width: 100%;
}

#history-list {
  list-style-type: none;
  padding: 1rem;
}
#history-list li {
  font-size: 1.3rem;
  padding: 1rem;
  transition: all 0.3s ease;
  margin: 12px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: 30px;
}
#history-list li:hover {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.clear {
  margin: 16px;
  position: sticky;
  bottom: 0;
}

/* responsive code */

@media screen and (min-width: 1024px) {
  #calculator-container {
    height: 100%;
    width: 50%;
    max-width: 600px;
    margin: 0 auto;
  }
  #settings,
  #historyContainer,
  #conversion {
    height: 90%;
    width: 100%;
    max-width: 500px;
  }
  #historyContainer {
    right: 1px;
  }
  #calculator {
    width: 100%;
    height: 100%;
  }
  #other,
  .row1,
  .row2 {
    width: 90%;
    max-width: 500px;
    max-height: 15vh;
  }
  #resultDisplay {
    font-size: 2rem;
  }
}
