/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

h1 {
  font-size: 1.8rem !important;
  letter-spacing: 0.1em;
}

/* Enhanced Styling */
body {
  background: linear-gradient(to bottom, #e0e0e0, #c0c4c8);
  font-family: "Roboto", Arial, sans-serif;
  color: #333;
  margin: 0;
  padding: 0;
}

.container {
  margin: 20px auto;
  padding: 30px;
  max-width: 600px;
  background-color: #f5f5f5;
  border: 1px solid #bbb;
  border-radius: 12px;
  /* Enhanced box shadow for more depth and softness */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1);
}

#unit-category-div button {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: bold;
  border: none;
  background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s, background-position 0.4s;
  background-size: 200% 200%;
  background-position: left;
}

#unit-category-div button:hover {
  background-position: right;
  transform: scale(1.05);
}

#unit-category-div button.active {
  background-color: #0056b3;
  color: #fff;
  border: 2px solid #003f7f;
  transform: scale(1.05);
}

/* Conversion Section */
#conversion-div {
  display: grid;
    grid-template-rows: auto auto auto;
    gap: 20px;
    border-bottom: dotted 1px black;
    border-left: solid 1px black;
    padding-bottom: 12px;
    border-radius: 24px;
}

#unit-category-div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); */
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  width: 100%;
  position: relative;
  padding-top: 2rem;
}

#unit-category-div button {
  width: 100%;
  box-sizing: border-box;
}

#conversion-div-header {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #444;
  margin-bottom: 20px;
  margin-top: 0.5rem;
  /* Added subtle text shadow for better readability and depth */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.conversion-inputs {
  display: flex;
  align-items: center; /* vertically align swap btn */
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
}

#swap-btn {
  font-size: 1.4rem;
  background: #f8f9fa;
  border: 2px solid #ccc;
  border-radius: 50%;
  padding: 0.4rem;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

#swap-btn:hover {
  background-color: #e2e6ea;
  transform: rotate(180deg);
}

.conversion-actions {
  display: flex;
  justify-content: center;
}

.conversion-actions .btn {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: bold;
  background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s, background-position 0.4s;
  background-size: 200% 200%;
  background-position: left;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  /* Added box shadow for tactile elevated effect */
  box-shadow: 0 4px 8px rgba(255, 127, 0, 0.4);
  /* Added subtle text shadow for better contrast */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.conversion-actions .btn:hover {
  background-position: right;
  transform: scale(1.05);
}

label {
  font-weight: bold;
}

#from-unit-label,
#to-unit-label {
  font-size: 0.9rem;
  color: #555;
  font-style: italic;
}

select,
button.btn {
  padding: 0px 12px;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  height: 35px;
}

button.btn {
  background-color: #28a745;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

#from-value,
#to-value {
  padding: 0.5rem 1rem; /* Inner spacing */
  border: 1px solid #ccc; /* Subtle border */
  border-radius: 0.5rem; /* Rounded corners */
  font-size: 0.75rem; /* Easy to read */
  width: 100%; /* Responsive width */
  box-sizing: border-box; /* Includes padding in width */
  /* Added box shadow for subtle elevation */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

button.btn:hover {
  background-color: #1e7e34;
}

/* Footer */
footer {
  text-align: center;
  padding: 15px;
  font-size: 1rem;
  color: #555;
  background-color: #f1f1f1;
  border-top: 1px solid #ddd;
  position: fixed;
  bottom: 0;
  width: 100%;
  background-color: #fff;
  z-index: 1000;
}

main {
  padding-bottom: 60px; /* Add bottom padding to avoid content hidden behind footer */
}
#precision-input {
  -moz-appearance: textfield; /* Firefox default hides arrows, so override */
  appearance: auto;
}

#precision-input::-webkit-inner-spin-button,
#precision-input::-webkit-outer-spin-button::before::after {
  -webkit-appearance: inner-spin-button !important;
  display: block !important;
}

.conversion-label {
  grid-column: 1 / -1;
  text-align: center;
  font-weight: bold;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}