:root {
  --accent-color: #1e3c72;
  --accent-color-dark: #2a5298;
  --bg-light: #f0f4f8;
  --bg-dark: #121212;
  --card-light: #ffffff;
  --card-dark: #1f1f1f;
  --text-light: #111827;
  --text-dark: #f0f0f0;
  --footer-light: #e5e7eb;
  --footer-dark: #1a1a1a;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-light);
  color: var(--text-light);
  transition: all 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 15px 0 15px;
}

body.dark {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

.dark-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 30px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1000;
}
.dark-toggle div {
  height: 4px;
  background-color: var(--text-light);
  border-radius: 2px;
  transition: all 0.3s;
}
body.dark .dark-toggle div {
  background-color: var(--text-dark);
}

.boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  margin-bottom: 40px;
}

.card {
  background-color: var(--card-light);
  padding: 25px 20px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  flex: 1 1 300px;
  min-width: 280px;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.dark .card {
  background-color: var(--card-dark);
}

h2 {
  margin-bottom: 15px;
  font-size: 1.8rem;
  text-align: center;
}
label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  text-align: left;
  width: 100%;
}
input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 10px;
  border: 1px solid #ccc;
  outline: none;
  font-size: 15px;
  transition: 0.3s;
  box-sizing: border-box;
}
input:focus {
  border-color: var(--accent-color);
}

button {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--accent-color),
    var(--accent-color-dark)
  );
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}
button:hover {
  opacity: 0.9;
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.calc-buttons button {
  width: 60px;
  height: 60px;
  font-size: 18px;
  border-radius: 10px;
}
#calcDisplay {
  width: 240px;
  height: 40px;
  margin-bottom: 10px;
  text-align: right;
  font-size: 18px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
  outline: none;
  background-color: var(--bg-light);
}
body.dark #calcDisplay {
  background-color: var(--card-dark);
  color: var(--text-dark);
  border: 1px solid #555;
}

.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal {
  background-color: var(--card-light);
  padding: 25px;
  border-radius: 15px;
  max-width: 300px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
body.dark .modal {
  background-color: var(--card-dark);
  color: var(--text-dark);
}
.modal h2 {
  margin-bottom: 15px;
  color: grey;
  font-size: 1.3rem;
}
.modal button {
  width: auto;
  padding: 10px 20px;
}

footer {
  width: 100%;
  background-color: var(--footer-light);
  color: var(--text-light);
  padding: 15px 0;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}
body.dark footer {
  background-color: var(--footer-dark);
  color: var(--text-dark);
}
footer a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 600px) {
  .boxes {
    flex-direction: column;
    gap: 15px;
  }
  .calc-buttons {
    grid-template-columns: repeat(4, 50px);
  }
  #calcDisplay {
    width: 200px;
  }
}
