/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #2b2b52, #4f46e5, #9333ea, #ec4899);
  background-size: 400% 400%;
  animation: gradientBG 10s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: white;
}

/* Animation for background */
@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.calculator {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 35px 30px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 1s ease-out;
}

.calculator h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 28px;
  background: linear-gradient(90deg, #ff6ec4, #7873f5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Inputs and Select */
input,
select,
button {
  width: 100%;
  padding: 12px 15px;
  margin: 10px 0;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  transition: all 0.3s ease;
}

input,
select {
  background-color: rgba(255, 255, 255, 0.1);
  color: black;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

input::placeholder {
  color: #ddd;
}

/* Button */
button {
  background: linear-gradient(to right, #4f46e5, #9333ea);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

button:hover {
  background: #ec4899;
  transform: scale(1.05);
}

/* Result Box */
#result {
  background-color: rgba(0, 0, 0, 0.2);
  padding: 15px;
  margin-top: 15px;
  border-radius: 10px;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Animation */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Dark Mode Styles */
body.dark {
  background: linear-gradient(135deg, #1e1e1e, #2b2b2b);
  color: #eee;
}

body.dark .calculator {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-color: #444;
}

body.dark input,
body.dark select,
body.dark button {
  background-color: rgba(255, 255, 255, 0.1);
  color: #eee;
  border-color: #555;
}

body.dark #result {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.theme-toggle {
  position: absolute;
  top: 10px;
  right: 20px;
  color: white;
  font-size: 14px;
}
:root {
  --bg-light: #f3f4f6;
  --bg-dark: #1e1e1e;
  --text-light: #333;
  --text-dark: #e0e0e0;
  --primary: #4f46e5;
  --accent: #9333ea;
  --border: #e5e7eb;
}

body {
  font-family: "Segoe UI", sans-serif;
  background-color: var(--bg-light);
  color: var(--text-light);
  display: flex;
  justify-content: center;
  align-items: start;
  padding: 40px 20px;
  min-height: 100vh;
  transition: all 0.3s ease;
}

body.dark-mode {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.calculator-container {
  background: white;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  transition: background 0.3s;
}

body.dark-mode .calculator-container {
  background: #2c2c2c;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--primary);
}

#display {
  width: 100%;
  padding: 15px;
  font-size: 1.4em;
  text-align: right;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  background: #f9f9f9;
  transition: background 0.3s, color 0.3s;
}

body.dark-mode #display {
  background: #1a1a1a;
  color: #e0e0e0;
  border-color: #444;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.buttons button {
  padding: 15px 10px;
  font-size: 1.1em;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
}

.buttons button:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.buttons button:active {
  transform: scale(0.95);
}

.theme-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.theme-toggle button {
  background: transparent;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: var(--primary);
}

.history {
  margin-top: 30px;
}

.history h2 {
  font-size: 1.1em;
  margin-bottom: 10px;
}

#historyList {
  list-style: none;
  padding-left: 0;
  max-height: 120px;
  overflow-y: auto;
}

#historyList li {
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: 6px;
  margin-bottom: 5px;
  font-size: 0.95em;
}

body.dark-mode #historyList li {
  background: #3a3a3a;
  color: #e0e0e0;
}
