@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;800&display=swap');

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

body {
  font-family: "Nunito", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #0d0d0d; /* full black background */
}

.calculator {
  width: 340px;
  background: #1a1a1a; /* dark gray/black */
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

.display {
  width: 100%;
  margin-bottom: 15px;
}

.display input {
  width: 100%;
  font-size: 2rem;
  padding: 15px;
  border-radius: 12px;
  border: none;
  outline: none;
  text-align: right;
  background: #000; /* deep black */
  color: #00ff9d;   /* neon green for numbers */
}

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

.btn {
  font-size: 1.2rem;
  padding: 18px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
  background: #262626; /* dark buttons */
  color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn i {
  pointer-events: none;
  font-size: 1.1rem;
}

.btn:hover {
  box-shadow: 0 0 5px #60a3a3;
  transform: scale(1.08);
  background: rgba(63, 62, 62, 0.5 );
}

.operator {
  background: #444;
  color: #ffb400; 
}

.equals {
  background: #00875a;
  color: white;
  grid-column: span 1;
}

.action {
  background: #b3003c;
  color: white;
}

.sci-panel {
  margin-bottom: 15px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.hidden {
  display: none !important;
}

.sci-btn {
  background: #262626;
  color: #5ec8ff;
  font-size: 1rem;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

.sci-btn:hover {
  box-shadow: 0 0 5px #60a3a3;
  transform: scale(1.08);
  background: rgba(63, 62, 62, 0.5 );
}

.history {
  margin-top: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  padding: 10px;
  width: 300px;
  font-size: 0.9rem;
  color: #099c6b;
  position: relative;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.history h3 {
  color: #00ff9d;
  margin: 0;
}

.history-content {
  max-height: 70px; /* Reduced to keep the tab small, ~3 lines with padding */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px; /* Prevent content cutoff by scrollbar */
}

.history-item {
  margin-bottom: 5px; /* Optional: Add spacing between history items */
}

#clear-history-btn {
  padding: 5px 10px;
  font-size: 0.8rem;
  background: #b3003c; /* Match action button color */
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

#clear-history-btn:hover {
  transform: scale(1.08);
  background: rgba(71, 68, 69, 0.7); /* Slightly darker on hover */
}

/* Media Query for Small Screens (max-width: 600px) */
@media(max-width: 600px) {  
  .calculator {
    width: 100%;
    max-width: 320px;
    padding: 15px;
    border-radius: 15px;
  }
  
  .display input {
    font-size: 1.7rem;
    padding: 12px;
  }
  
  .buttons {
    gap: 8px;
  }
  
  .btn {
    font-size: 1.1rem;
    padding: 15px;
    border-radius: 10px;
  }
  
  .btn i {
    font-size: 1rem;
  }
  
  .sci-panel {
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .sci-btn {
    font-size: 0.9rem;
    padding: 10px;
    border-radius: 8px;
  }
  
  .history {
    width: 100%;
    max-width: 290px;
    margin-top: 15px;
    font-size: 0.85rem;
  }
  
  .history-content {
    max-height: 60px;
  }
  
  #clear-history-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}