:root {
  --bg-color: #f0f4f8b1;
  --text-color: #333;
  --glass-color: rgba(255, 255, 255, 0.2);
  --btn-color: #f0f4f8b1;
  --btn-hover: #f0f4f8b1;
}

body.dark {
  --bg-color: #1f1f1f;
  --text-color: #f5f5f59d;
  --glass-color: rgba(0, 0, 0, 0.2);
  --btn-color: #333;
  --btn-hover: #444;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
}

#bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items:flex-end;
  padding: 10px 2rem;
  font-size: 1.5rem;
  background: transparent;
  position: relative;
  z-index: 10;
}

.logo span {
  color: #ff3cac;
}

.btn:hover {
  background: #ed4fff; 
  color: #000;
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(208, 79, 255, 0.5);
}

.btn:active {
  transform: scale(0.95);
  background-color: #ed4fff;
  box-shadow: 0 0 10px #ed4fff;
}

.operator {
  background-color: #29b6f6;
  color: #fff;
}
.operator:hover {
  background-color: #0288d1;
  box-shadow: 0 0 10px rgba(2, 136, 209, 0.6);
}

.sci-fn {
  background-color: #ba68c8;
  color: #fff;
}
.sci-fn:hover {
  background-color: #9c27b0;
  box-shadow: 0 0 10px rgba(156, 39, 176, 0.6);
}

.equal {
  background-color: #ff4081;
  color: #fff;
}
.equal:hover {
  background-color: #f50057;
  box-shadow: 0 0 15px rgba(255, 64, 129, 0.7);
}

.btn.animate-click {
  animation: clickFlash 0.2s ease;
}

@keyframes clickFlash {
  0% { transform: scale(1); background-color: var(--btn-color); }
  50% { transform: scale(0.9); background-color: #ffeb3b; }
  100% { transform: scale(1); background-color: var(--btn-color); }
}

.theme-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  background-color: var(--btn-color);
  color: var(--text-color);
  margin-left: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.theme-btn:hover {
  background-color: var(--btn-hover);
}

.calculator-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  z-index: 10;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  padding: 1rem;
}

.calculator:hover {
  transform: scale(1.02);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
}

.calculator-container-btn:hover {
  background-color: var(--btn-hover);
}

.calculator {
  background: var(--glass-color);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  animation: popIn 0.8s ease-in-out;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

input#display {
  width: 100%;
  padding: 0.6rem;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: none;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.btn {
  padding: 1rem;
  font-size: 1rem;
  background: var(--btn-color);
  color: var(--text-color);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.history {
  margin-top: 1rem;
  background: var(--btn-color);
  padding: 0.5rem;
  border-radius: 8px;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  z-index: 10;
  position: relative;
}

.fade-in {
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 768px) {
  .calculator {
    padding: 1.5rem;
    max-width: 90%;
  }

  .navbar {
    flex-direction: column;
    align-items: center;
    font-size: 1.2rem;
  }

  .theme-btn {
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .btn {
    padding: 0.8rem;
    font-size: 0.9rem;
  }

  .calculator {
    padding: 1rem;
  }
}
/* Tablet responsiveness */
@media (max-width: 768px) {
  .calculator {
    padding: 1.5rem;
    max-width: 90%;
  }

  .navbar {
    flex-direction: column;
    align-items: center;
    font-size: 1.2rem;
    gap: 0.5rem;
  }

  .theme-btn {
    margin-top: 0.5rem;
  }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .btn {
    padding: 0.8rem;
    font-size: 0.9rem;
  }

  .calculator {
    padding: 1rem;
  }

  input#display {
    font-size: 1rem;
  }
}
