/* Peaceful background */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #dbeafe, #e0f7fa);
  transition: background 0.5s;
}

/* Calculator box */
.calculator {
  width: 340px;
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  transition: all 0.3s;
}

/* Light Mode */
.calculator.light {
  background: #f5f5f5; /* soft light grey background */
  color: #222;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.calculator.light #display {
  background: #ffffff; /* pure white display */
  color: #000;
  border: 1px solid #ddd;
}

.calculator.light button {
  background: #e0e0e0;  /* light grey buttons */
  color: #111;
  border: 1px solid #ccc;
}

.calculator.light button:hover {
  background: #d1d1d1; /* darker grey hover */
}

.calculator.light button:active {
  background: #bbb; /* pressed effect */
}




/* Dark Mode */
.calculator.dark {
  background: #1c1c1c;
  color: #eee;
}

.calculator.dark #display {
  background: #111;
  color: #0ff;
}

.calculator.dark button {
  background: #2a2a2a;
  color: #eee;
}

.calculator.dark button:hover {
  background: #444;
  color: #0ff;
}

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

h2 { margin: 0; font-size: 20px; }

/* Display */
#display {
  width: 100%;
  height: 55px;
  margin-bottom: 15px;
  border: none;
  border-radius: 12px;
  font-size: 22px;
  text-align: right;
  padding: 10px;
  outline: none;
}

/* Buttons */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}

button {
  padding: 15px;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease-in-out;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 55px;
  height: 26px;
}

.switch input { display: none; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "🌞";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  font-size: 16px;
  transition: .4s;
}

input:checked + .slider {
  background-color: #333;
}

input:checked + .slider:before {
  content: "🌙";
  transform: translateX(26px);
}

/* History hidden by default */
#history {
  display: none;
  margin-top: 15px;
  max-height: 150px;
  overflow-y: auto;
  border-top: 1px solid rgba(0,0,0,0.1);
  padding-top: 8px;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
}

#history.show {
  display: block;
}

#history h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

#history ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
}

/* Scrollbar Styling */
#history::-webkit-scrollbar {
  width: 8px;
}

#history::-webkit-scrollbar-track {
  background: transparent;
}

#history::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4facfe, #00f2fe);
  border-radius: 10px;
}

#history::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #43e97b, #38f9d7);
}

/* History button */
.history-btn {
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border: none;
  transition: color 0.3s;
}

.history-btn:hover {
  color: #0077ff;
}
