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

body {
  font-family: "Segoe UI", sans-serif;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: background 0.5s ease;
}

.theme-toggle {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 100;
}

.toggle-btn {
  position: relative;
  width: 72px;
  height: 36px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #e6dfff, #f2e7f6);
}

.toggle-ball {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2c2f2d;
  transition: transform 0.35s ease;
}


.calculator-heading {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 70px;
  text-align: center;
  letter-spacing: 1px;
  transition: color 0.4s ease;
  cursor: pointer;
}

body.dark .calculator-heading {
  color: #e6e7e8;
  text-shadow: 0 0 12px rgba(230,230,230,0.5);
}

body.light .calculator-heading {
  color: #5e4977;
  text-shadow: 0 0 12px rgba(94,73,119,0.5);
}

.calculator-heading:hover {
  text-shadow: 0 0 20px rgba(255,255,255,0.6);
  transform: scale(1.03);
  transition: all 0.4s ease;
}



.calculator {
  width: 330px;
  padding: 22px;
  border-radius: 26px;
  transition: all 0.4s ease;
}

.display-screen input {
  width: 100%;
  height: 72px;
  border-radius: 18px;
  border: none;
  font-size: 2rem;
  padding: 14px 18px;
  text-align: right;
  outline: none;
}

.buttons-section {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.btn {
  height: 62px;
  border-radius: 20px;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* ///////////////   Dark Theme    /////////////// */
body.dark {
  background: radial-gradient(circle at top, #1c1f24, #0e1013);
}

body.dark .toggle-btn{
  background: #2c2f2d;
}

body.dark .calculator {
  background: #171a1f;
  box-shadow: 0 25px 60px rgba(0,0,0,0.7);
}

body.dark .display-screen input {
  background: #0f1216;
  color: #f1f2f3;
  box-shadow: inset 0 4px 14px rgba(0,0,0,0.8);
}

body.dark .btn {
  background: #23272e;
  color: #e7e9ec;
  box-shadow: 0 6px 16px rgba(0,0,0,0.6);
}

body.dark .btn:hover {
  transform: translateY(-2px);
  background: #2d333c;
}

body.dark .control {
  background: #343a44;
}

body.dark .operator {
  background: linear-gradient(145deg, #7b6f78, #665c64);
  color: #fff;
}

body.dark .operator:last-child {
  background: linear-gradient(145deg, #9b8ba2, #7f7386);
}

body.dark .toggle-ball {
  background: #d9dadae3;
}

/* ///////////////   Light Theme    /////////////// */
body.light {
  background: linear-gradient(135deg, #ebd0df, #ebe6ff);
}

body.light .toggle-btn{
  background: rgba(120, 90, 160, 0.41);
}

body.light .toggle-ball{
  background: #ebd0df;
}

body.light .calculator {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(18px);
  box-shadow:
    0 25px 60px rgba(120, 90, 160, 0.41),
    inset 0 1px 0 rgba(255,255,255,0.8);
}

body.light .display-screen input {
  background: linear-gradient(145deg, #e8cee1, #d7d0ec);
  color: #3b2f4a;
  box-shadow: inset 0 6px 14px rgba(0,0,0,0.15);
}

body.light .btn {
  background: linear-gradient(145deg, #e7c7f8, #e8def5);
  color: #3a2f47;
  box-shadow: 0 8px 18px rgba(120,90,160,0.35);
}

body.light .btn:hover {
  transform: translateY(-3px) scale(1.03);
  background: linear-gradient(145deg, #ecd9f5, #d1c8dc);;
}

body.light .control {
  background: linear-gradient(145deg, #f7c6da, #f0bcd4);
  color: #4a1f36;
}

body.light .operator {
  background: linear-gradient(145deg, #bba6f5, #9f8ae6);
  color: #fff;
}

body.light .operator:last-child {
  background: linear-gradient(145deg, #7f6ae1, #6b57c8);
}

body.light .toggle-ball {
  transform: translateX(34px);
  background: #f4f5f6;
}



/* ///////////    Responsive   //////////// */

@media screen and (max-width: 500px) {

  body {
    padding: 15px;
  }

  .calculator-heading {
    margin-top: 40px;
    font-size: 1.3rem;
    margin-bottom: 40px;
  }

  .calculator {
    width: 80%;
    padding: 16px;
    border-radius: 20px;
  }

  .display-screen input {
    height: 50px;
    font-size: 1.5rem;
    padding: 12px 14px;
  }

  .buttons-section {
    gap: 8px;
  }

  .btn {
    height: 40px;
    font-size: 1rem;
    border-radius: 16px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
    z-index: 100;
  }

  .toggle-btn {
    width: 40px;
    height: 20px;
  }

  .toggle-ball {
    width: 18px;
    height: 18px;
    top: 1px;
    left: 2px;
  }

  body.light .toggle-ball {
    transform: translateX(19px);
  }

  body.dark .toggle-ball {
    transform: translateX(0);
  }

}


