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

body {
  font-family: sans-serif;
  background-image: linear-gradient(to bottom right, #ffffff, #c3eaff);
}

body.dark {
  background-image: linear-gradient(to bottom right, #0c191e, #16262d);
}

a {
  text-decoration: none;
  color: #fff;
}

.custom-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  background-image: linear-gradient(to bottom right, #ffffff, #c3eaff);
  color: #333;
  padding: 15px 20px 5px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  z-index: 9999;
  text-align: center;
  transform: translateX(-50%) scale(1);
  transition: 0.3s ease-in-out;
}

.hidden {
  transform: translateX(-50%) scale(0);
  opacity: 0;
}
#alert-buttons {
  opacity: 1;
  transform: translateY(0px) scale(1);
}
#alert-buttons.hidden {
  opacity: 0;
  transform: translateY(-20px) scale(0);
  position: absolute;
  display: flex;
}

body.dark .custom-alert {
  background-image: linear-gradient(to bottom right, #0c191e, #16262d);
  color: #fff;
}

.container {
  height: 100vh;
  /* width: 100vh; */
  display: grid;
  place-items: center;
}

.calculator {
  position: relative;
  height: auto;
  width: auto;
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 0 30px #1d2f38;
}

.theme-toggler {
  position: absolute;
  top: 25px;
  right: 35px;
  color: #fff;
  cursor: pointer;
  z-index: 1;
}

.theme-toggler.active {
  color: #4c4c4c;
}

.theme-toggler::before {
  content: "";
  position: absolute;
  height: 15px;
  width: 15px;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: #1d2f38;
  z-index: -1;
}

.theme-toggler.active::before {
  background-color: #c3eaff;
}

.display-screen {
  position: relative;
}

#display {
  margin: 0 10px;
  height: 150px;
  width: auto;
  max-width: 270px;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;

  font-size: 30px;
  margin-bottom: 20px;
  gap: 5px;

  word-break: break-all;
  word-wrap: break-word;
  overflow: hidden;
}

#display .operation {
  opacity: 0.6;
  font-size: 14px;
  transform: translateY(0);
  transition: 0.4s ease-in-out;
}
#display.operation-move-up .operation {
  animation: operation-move-up 0.5s ease-in-out forwards;
}

@keyframes operation-move-up {
  0% {
    transform: translateY(30px) scale(0.2);
    opacity: 0;
  }
  50% {
    transform: translateY(-10px) scale(1.1);
    opacity: 0.6;
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

#display .result {
  font-size: 30px;
}

.copy-and-open-archives-controls {
  position: absolute;
  top: -7px;
  left: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.confirm-btn,
.cancel-btn,
.open-archives-btn,
.copy-btn,
.clear-archives-btn,
.close-archives-btn {
  /* background-color: #aee3ff; */
  background-image: linear-gradient(to bottom right, #c3eaff, #fff);
  color: #333;
  border: none;
  border-radius: 5px;
  padding: 5px;
  font-size: 10px;
  cursor: pointer;
  transition: 0.3s ease;
}

.confirm-btn:hover,
.cancel-btn:hover,
.open-archives-btn:hover,
.copy-btn:hover,
.clear-archives-btn:hover,
.close-archives-btn:hover {
  opacity: 0.7;
}

.confirm-btn:active,
.cancel-btn:active,
.open-archives-btn:active,
.copy-btn:active,
.clear-archives-btn:active,
.close-archives-btn:active {
  transform: scale(0.9);
}

body.dark .confirm-btn,
body.dark .cancel-btn,
body.dark .open-archives-btn,
body.dark .copy-btn,
body.dark .clear-archives-btn,
body.dark .close-archives-btn {
  /* background-color: #1d2f38; */
  background-image: linear-gradient(to bottom right, #16262d, #0c191e);
  color: white;
}

.archives {
  background-image: linear-gradient(to bottom right, #c3eaff, #fff);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.2);
  color: #fff;
  width: 284px;
  height: 520px;
  position: absolute;
  top: 50%;
  left: -5px;
  z-index: 1;
  transform-origin: top center;
  transform: scale(0.01);
  opacity: 0;
  transition: all 0.5s ease;
}

body.dark .archives {
  background-image: linear-gradient(to bottom right, #16262d, #0c191e);
}

.archives.visible {
  transform-origin: center center;
  transform: scale(1.04);
  opacity: 1;
}

.archives .archives-container {
  padding-top: 30px;
  position: relative;
  text-align: center;
}

.archives .archives-container .archives-list {
  max-height: 450px;
  overflow: hidden;
  overflow-y: auto;
}

/* light */
::-webkit-scrollbar {
  width: 5px;
}
.archives .archives-container .archives-list::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #fff, #c3eaff);
  border: 2px solid #86c8e2;
  border-radius: 10px;
}
.archives .archives-container .archives-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #c3eaff, #fff);
}
.archives .archives-container .archives-list::-webkit-scrollbar-track {
  background: #fff;
  border-radius: 10px;
}
.archives .archives-container .archives-list::-webkit-scrollbar-track-piece {
  background: #86c8e2;
  border-radius: 10px;
  margin: 3px;
}

/* dark */
body.dark
  .archives
  .archives-container
  .archives-list::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #1d2f38, #15272e);
  border: 2px solid #0c191e;
}
body.dark
  .archives
  .archives-container
  .archives-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #15272e, #1d2f38);
}
body.dark
  .archives
  .archives-container
  .archives-list::-webkit-scrollbar-track {
  background: #1d2f38;
}
body.dark
  .archives
  .archives-container
  .archives-list::-webkit-scrollbar-track-piece {
  background: #0c191e;
  border-radius: 10px;
  margin: 3px;
}

.archives .archives-container .archives-list .archives-item {
  display: flex;
  flex-direction: column;
}

.archives .archives-container .archives-list .archives-item .labels {
  background-image: linear-gradient(to bottom right, #fff, #c3eaff);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  top: 29px;
  left: 0;
  width: 97%;
  padding: 5px;
  border-radius: 10px;
}

body.dark .archives .archives-container .archives-list .archives-item .labels {
  background-image: linear-gradient(to bottom right, #1d2f38, #0c191e);
}

.archives
  .archives-container
  .archives-list
  .archives-item
  .labels
  .operation-label,
.archives
  .archives-container
  .archives-list
  .archives-item
  .labels
  .result-label {
  font-weight: bold;
  font-size: 14px;
  color: #486e81;
  border-radius: 3px;
  padding: 2px;
}

body.dark
  .archives
  .archives-container
  .archives-list
  .archives-item
  .labels
  .operation-label,
body.dark
  .archives
  .archives-container
  .archives-list
  .archives-item
  .labels
  .result-label {
  color: #8aa7b5;
}

.archives .archives-container .archives-list .archives-item .items {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  width: 96%;
}

.archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .operations-item,
.archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .results-item {
  padding-top: 30px;
  color: #414141;
  display: flex;
  flex-direction: column-reverse;
}

body.dark
  .archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .operations-item,
body.dark
  .archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .results-item {
  padding-top: 30px;
  color: #e0e0e0;
  display: flex;
  flex-direction: column-reverse;
}

.archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .operations-item
  .operation,
.archives
  .archives-container
  .archives-list
  .archives-item
  .items
  .results-item
  .result {
  padding-top: 10px;
}

.archives .archives-container .archives-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 95%;
  display: flex;
  justify-content: space-between;
}

.archives .archives-container .archives-controls .clear-archives-btn,
.archives .archives-container .archives-controls .close-archives-btn {
  padding: 5px 10px;
}

.button {
  height: 60px;
  width: 60px;
  border: 0;
  border-radius: 30px;
  margin: 5px;
  font-size: 20px;
  cursor: pointer;
  transition: all 200ms ease;
}

.button:hover {
  transform: scale(1.1);
}

.button#equal {
  height: 130px;
}

/************************ light theme ************************/

.calculator {
  background-image: linear-gradient(to bottom right, #c3eaff, #ffffff);
}

.calculator #display {
  color: #0a1e23;
}

.calculator .button#clear {
  background-color: #ffd5d8;
  color: #fc4552;
}

.calculator .button.btn-number {
  background-color: #c3eaff;
  color: #000;
}

.calculator .button.btn-operator {
  background-color: #ffd0fd;
  color: #f967f3;
}

.calculator .button.btn-equal {
  background-color: #adf9e7;
  color: #000;
}

/************************ dark theme ************************/

.calculator.dark {
  background-image: linear-gradient(to bottom right, #16262d, #0c191e);
  box-shadow: 0 0 20px #444;
}

.calculator.dark #display {
  color: #f8fafd;
}

.calculator.dark .button#clear {
  background-color: #2d191e;
  color: #bd3740;
}

.calculator.dark .button.btn-number {
  background-color: #16262d;
  color: #f8fafb;
}

.calculator.dark .button.btn-operator {
  background-color: #2e1f39;
  color: #aa00a4;
}

.calculator.dark .button.btn-equal {
  background-color: #223323;
  color: #fff;
}

.button.active-key {
  transform: scale(0.9);
}

.button:active {
  transform: scale(1);
}

@media (max-width: 1114px) {
  .theme-toggler {
    cursor: auto;
    /* -webkit-tap-highlight-color: transparent; */
  }

  .confirm-btn,
  .cancel-btn,
  .open-archives-btn,
  .copy-btn,
  .clear-archives-btn,
  .close-archives-btn {
    cursor: auto;
  }

  .button {
    cursor: auto;
  }

  .button:hover {
    transform: scale(1);
  }

  .button:active {
    transform: scale(0.9);
  }
}
