/* --- Body & Calculator Container --- */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #1b1b1b; /* darker background for contrast */
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.calculator {
  background: rgba(40, 40, 40, 0.95);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.7);
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(8px);
}

/* --- Display Area --- */
#display-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

#history, #display {
  width: 100%;
  box-sizing: border-box;
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  margin: 0;
  font-weight: bold;
  color: #0f0;
  background: rgba(0,0,0,0.8);
  text-align: right;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.7);
  font-size: 18px;
  overflow-x: auto;
}

#history {
  font-size: 13px;
  color: #aaa;
  background: rgba(20,20,20,0.85);
  text-align: left; /* placeholder alignment */
}

/* --- Button Grid --- */
.row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
/* --- General Buttons --- */
button {
  height: 45px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  background: linear-gradient(to bottom, #5a5a5a, #444); /* subtle gradient */
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 5px rgba(0,0,0,0.3);
}

button:hover {
  background: linear-gradient(to bottom, #777, #555);
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

/* --- Equals Button --- */
.equals {
  background: linear-gradient(to bottom, #0a84ff, #006edc);
  color: #fff;
  box-shadow: 0 4px 8px rgba(0,110,220,0.5);
}
.equals:hover {
  background: linear-gradient(to bottom, #3399ff, #005bb5);
  transform: translateY(-1px);
}

/* --- Clear, Delete, Memory Buttons --- */
#clear, #del, #mc, #mr {
  background: linear-gradient(to bottom, #e74c3c, #c0392b);
}
#clear:hover, #del:hover, #mc:hover, #mr:hover {
  background: linear-gradient(to bottom, #ff5c5c, #d62c1a);
  transform: translateY(-1px);
}

/* --- History Navigation & Special Functions --- */
#history-up, #history-down, #deg-rad, #rand, #abs {
  background: linear-gradient(to bottom, #7f8c8d, #606060);
}
#history-up:hover, #history-down:hover, #deg-rad:hover, #rand:hover, #abs:hover {
  background: linear-gradient(to bottom, #95a5a6, #707070);
}

/* --- Active / Toggle Buttons --- */
button.active {
  background: linear-gradient(to bottom, #0a84ff, #3399ff);
  color: #fff;
  box-shadow: 0 0 10px rgba(0,132,255,0.7);
}
/* --- Number Buttons 0–9 and decimal --- */
button[data-value="0"],
button[data-value="1"],
button[data-value="2"],
button[data-value="3"],
button[data-value="4"],
button[data-value="5"],
button[data-value="6"],
button[data-value="7"],
button[data-value="8"],
button[data-value="9"],
button[data-value="."] {
  background: linear-gradient(to bottom, #6c5ce7, #341f97); /* soft purple-blue gradient */
  color: #fff;
  font-weight: bold;
  box-shadow: 0 3px 6px rgba(52, 31, 151, 0.4);
}

button[data-value="0"]:hover,
button[data-value="1"]:hover,
button[data-value="2"]:hover,
button[data-value="3"]:hover,
button[data-value="4"]:hover,
button[data-value="5"]:hover,
button[data-value="6"]:hover,
button[data-value="7"]:hover,
button[data-value="8"]:hover,
button[data-value="9"]:hover,
button[data-value="."]:hover {
  background: linear-gradient(to bottom, #817afc, #4b32c3);
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(52, 31, 151, 0.5);
}

#deg-rad {
  background-color: #ff9500;
  color: #fff;
  font-weight: bold;
  transition: background 0.2s;
}

#deg-rad.DEG {
  background-color: #ff9500; /* bright orange for DEG */
}

#deg-rad.RAD {
  background-color: #0a84ff; /* blue for RAD */
}
/* --- Square & Other Operator Buttons --- */
#square, #pow, #tenpow, #inv, #percent, #fact, #nPr, #nCr {
  background: linear-gradient(to bottom, #34495e, #2c3e50);
}
#square:hover, #pow:hover, #tenpow:hover, #inv:hover, #percent:hover, #fact:hover, #nPr:hover, #nCr:hover {
  background: linear-gradient(to bottom, #4b6584, #34495e);
  transform: translateY(-1px);
}

/* --- History Display Placeholder Styling --- */
#history.placeholder {
  color: #888;          /* dimmed gray */
  font-style: italic;    /* italic for hint effect */
}

/* When actual history is shown, remove placeholder styling */
#history:not(.placeholder) {
  color: #aaa;
  font-style: normal;
}