:root {
  --text-control: #5fdacc;
  --text-arithmetic: #e76c6c;
  --transition-speed: 0.3s;
}

html[data-theme='light'] {
  --bg-body: #f7f7f7;
  --bg-primary: #ffffff;
  --calculator-bg: #f9f9f9;
  --button-bg: #f7f7f7;
  --toggle-bg: #ffffff;
  --display-bg: #ffffff;
  --text: #282b33;
  --icon-current: #d8d8d8;
  --icon-secondary: #060b0b;
}

html[data-theme='dark'] {
  --bg-body: #1e2128;
  --bg-primary: #22252d;
  --calculator-bg: #2a2d3a;
  --button-bg: #282b35;
  --toggle-bg: #2a2d37;
  --display-bg: #22252d;
  --text: #ffffff;
  --icon-current: #ffffff;
  --icon-secondary: #90939b;
}

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

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f3f3f3;
  font-family: Arial, sans-serif;
  background-color: var(--bg-body);
  transition: background-color var(--transition-speed) ease;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  align-self: flex-end;
  justify-content: space-around;
  gap: 1rem;
  width: 90px;
  height: 40px;
  background-color: var(--toggle-bg);
  border-radius: 1rem;
  padding: 0 10px;
  position: relative;
  cursor: pointer;
  transition: background-color var(--transition-speed) ease;
}

.icon svg {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed) ease;
}

.sun {
  color: var(--icon-secondary);
}

.moon {
  color: var(--icon-current);
}

.calculator {
  width: 320px;
  background-color: var(--bg-primary);
  border-radius: 2rem;
  padding-top: 30px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  transition:
    background-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.display {
  padding: 1rem 0;
  margin: 0 1.5rem;
  text-align: right;
  color: var(--text);

  background-color: var(--display-bg);
  border-radius: 10px;
  margin-bottom: 20px;
  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
}

.previous-op {
  font-size: 1.2rem;
  opacity: 0.7;
  min-height: 24px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.current-op {
  font-size: 2.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  text-overflow: clip;
  height: min-content;
}

.keypad {
  display: grid;
  padding: 2rem 1rem;
  background-color: var(--calculator-bg);
  grid-template-columns: repeat(4, 1fr);
  border-radius: 2rem;
  gap: 10px;
  transition: background-color var(--transition-speed) ease;
}

.button {
  padding: 15px;
  font-size: 1.5rem;
  border: none;
  border-radius: 10px;
  background-color: var(--button-bg);
  color: var(--text);
  cursor: pointer;
  transition:
    background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    opacity var(--transition-speed) ease;
}

.button.arithmetic.control {
  color: var(--text-control);
}

.del {
  font-size: 2rem;
}

.button:hover {
  opacity: 0.8;
}

.button.control {
  color: var(--text-control);
}

.button.arithmetic {
  color: var(--text-arithmetic);
}

@media screen and (min-width: 768px) {
  .theme-toggle {
    position: absolute;
    right: 3rem;
    top: 2rem;
  }

  .calculator-container {
    margin-top: 2rem;
  }
}
