/* 🌸 Base styles */
* {
  box-sizing: border-box;
  font-family: 'Comic Sans MS', cursive, sans-serif;
}

body {
  margin: 0;
  background: #fff0f6;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.calculator {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  width: 90%;
max-width: 320px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

/* 🌸 Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: #ff85a2;
}

.hamburger {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  background-color: #ffe0eb;
  transition: background-color 0.3s ease;
}

.hamburger:hover {
  background-color: #ffcfe0;
}

/* 🌸 Side Menu */
.side-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: 250px;
  height: 100%;
  background-color: #fff0f6;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  padding: 20px;
  box-shadow: 4px 0 12px rgba(0,0,0,0.1);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.3s ease;
  transform: translateX(-100%);
}

.side-menu.show {
  transform: translateX(0);
}

.side-menu h3 {
  margin-top: 0;
  color: #d66ba0;
  font-size: 1.2rem;
}

.side-menu button {
  padding: 10px;
  border: none;
  background-color: #ffd6e7;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.side-menu button:hover:not(:disabled) {
  background-color: #ffcfe0;
}

.side-menu button:disabled {
  background-color: #f3d1e3;
  color: #888;
  cursor: not-allowed;
}

#closeMenu {
  background-color: #ffb3c6;
  margin-top: auto;
}

/* 🌸 Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #f8a1c4;
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* 🌸 Display */
.display {
  background: #fff8fc;
  border-radius: 12px;
  padding: 10px;
  text-align: right;
  margin-bottom: 10px;
}

#expression {
  font-size: 1.2rem;
  color: #999;
}

#result {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  overflow-x: auto;
  white-space: nowrap;
  text-align: right;
  padding: 5px;
  max-width: 100%;
  word-wrap: break-word;
}

#funFact {
  font-size: 0.9rem;
  color: #d66ba0;
  margin-top: 5px;
  display: none;
  transition: opacity 0.3s ease;
}

#history {
  white-space: pre-line;
  text-align: left;
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: #555;
}

/* 🌸 Placeholder style */
.placeholder {
  color: #d9a7c7;
  font-style: italic;
}

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

.btn {
  font-size: 1.2rem;
  padding: 15px;
  background: #ffe0eb;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.btn:hover {
  background: #ffcfe0;
  transform: scale(1.05);
}
.scientific-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.scientific-buttons button {
  background-color: var(--btn-bg);
  border: none;
  padding: 10px;
  font-size: 1rem;
  border-radius: 10px;
  box-shadow: var(--btn-shadow);
  color: var(--btn-text);
  transition: all 0.3s ease;
}

.scientific-buttons button:hover {
  background-color: var(--btn-hover-bg);
  transform: scale(1.05);
}

.hidden {
  display: none;
}

.operator {
  background: #ffd3f3;
}

.equal {
  background: #bde0fe;
  font-weight: bold;
}

.clear {
  background: #ffaaaa;
  grid-column: span 4;
}
/* ===== THEMES ===== */
body.light-theme {
  background-color: #fff;
  color: #333;
}

body.blue-theme {
  background: linear-gradient(135deg, #e0f7fa, #b3e5fc);
  color: #004d66;
}

/* Update calculator box & buttons per theme */
body.blue-theme .calculator {
  background-color: #ffffffaa;
  box-shadow: 0 0 15px #81d4fa;
}

body.blue-theme .buttons button {
  background-color: #e1f5fe;
  color: #0277bd;
}

body.blue-theme .buttons button:hover {
  background-color: #b3e5fc;
}

/* Dropdown styling inside hamburger */
.theme-label {
  display: block;
  margin: 1rem 0;
  font-weight: bold;
}

#themeSelector {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  font-size: 1rem;
}
/* Hidden by default — toggle will change this */
.scientific-buttons {
  display: none; /* start hidden */
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

/* When toggled on, show in grid layout */
.scientific-buttons.show {
  display: grid;
}

/* Button styles */
.scientific-buttons button {
  background-color: #ffe6f0; /* soft pink */
  border: none;
  border-radius: 15px;
  padding: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

/* Hover effect */
.scientific-buttons button:hover {
  background-color: #ffc9da;
  transform: scale(1.05);
}

/* History scroll styling */
#history {
  max-height: 80px;
  overflow-y: auto;
  padding-right: 5px;
}

#history::-webkit-scrollbar {
  width: 4px;
}

#history::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}
button.delete-history {
  background-color: #ffb3c6; /* light pink */
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: bold;
  color: #7a0033; /* darker text for contrast */
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

button.delete-history:hover {
  background-color: #ff8fab; /* brighter pink */
  transform: scale(1.05);
}

button.delete-history:active {
  background-color: #ff758f; /* deeper pink for click */
}
/* Base styling for sound button */
#soundToggle {
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

/* OFF state */
.sound-off {
  background-color: #f7dce5; /* soft pink */
  color: #b07a8d;
}

/* ON state */
.sound-on {
  background-color: #ffd8e4; /* brighter pink */
  color: #a84e7a;
  box-shadow: 0 2px 6px rgba(168, 78, 122, 0.3);
}

/* Hover effect */
#soundToggle:hover {
  transform: scale(1.05);
}

/* Disabled "coming soon" state */
.sound-disabled {
  background-color: #f7dce5;
  color: #b07a8d;
  cursor: not-allowed;
  opacity: 0.7;
}
@media (max-width: 400px) {
  .top-bar {
    font-size: 1.2rem;
  }
  .btn {
    font-size: 1rem;
    padding: 12px;
  }
  #result {
    font-size: 1.6rem;
  }
}
.btn-row {
  display: flex;
  gap: 10px;
}

.btn.clear,
.btn.backspace {
  flex: 1;
}

.btn.backspace {
  background-color: #ffcccc;
  color: #333;
}

.btn.backspace:hover {
  background-color: #ff9999;
}
/* Modal background */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.4);
}

/* Modal box */
.modal-content {
  background: #ffe6ef;
  margin: 10% auto;
  padding: 20px;
  border-radius: 15px;
  width: 80%;
  max-width: 400px;
  text-align: center;
  font-family: 'Comic Sans MS', cursive;
  box-shadow: 0px 4px 12px rgba(0,0,0,0.2);
}

/* Close button */
.closeAbout {
  float: right;
  font-size: 24px;
  cursor: pointer;
  color: #ff4c87;
}
.closeAbout:hover {
  color: #ff1c5a;
}

/* Menu button style (matches your theme) */
.menu-button {
  background: #ffb6c1;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
}
.menu-button:hover {
  background: #ff99aa;
}
a {
  color: #ff4c87;
  text-decoration: none;
  font-weight: bold;
}
a:hover {
  text-decoration: underline;
  color: #ff1c5a;
}
/* Make side menu scrollable on small screens */
.side-menu {
  display: flex;
  flex-direction: column;
  max-height: 90vh; /* Prevent overflow past screen height */
  overflow-y: auto;
  padding-bottom: 10px; /* Space for last button */
  box-sizing: border-box;
}

/* Ensure all menu buttons fit and are readable */
.side-menu button {
  flex-shrink: 0;
  width: 100%;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/* Adjust for very small screens */
@media (max-height: 500px) {
  .side-menu {
    max-height: 85vh;
  }
  .side-menu button {
    font-size: 14px;
    padding: 6px;
  }
}
