/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #333;
  padding-bottom: 20px;
}

/* Header */
header {
  background: #fff;
  padding: 10px 20px;
  border-bottom: 2px solid #ddd;
  position: relative;
}
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 1.8rem;
  font-weight: bold;
  color: #2575fc;
}
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
}
.hamburger .bar {
  width: 25px;
  height: 3px;
  background-color: #2575fc;
  margin: 3px 0;
  transition: 0.4s;
}
/* Navigation */
.nav-menu {
  margin-top: 10px;
}
.nav-menu ul {
  list-style: none;
  display: flex;
  gap: 20px;
}
.nav-menu ul li a {
  text-decoration: none;
  color: #6a11cb;
  font-weight: bold;
  transition: color 0.3s, transform 0.3s;
}
.nav-menu ul li a:hover {
  color: #2575fc;
  transform: scale(1.05);
}
/* Responsive Navigation */
@media (max-width: 600px) {
  .hamburger {
    display: flex;
  }
  .nav-menu ul {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 50px;
    right: 20px;
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    z-index: 1000;
  }
  .nav-menu ul.active {
    display: flex;
  }
}
.calc-heading {
  text-align: center;
  margin-top: 10px;
  padding: 10px;
  background: #f7f7f7;
  border-radius: 6px;
}
.calc-heading h2 {
  color: #2575fc;
  margin-bottom: 5px;
}
.calc-heading p {
  color: #555;
}

/* Main Content */
main {
  max-width: 900px;
  margin: 20px auto;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
th, td {
  padding: 10px;
  border: 1px solid #ddd;
  text-align: left;
}
input[type="number"] {
  width: 80px;
  padding: 5px;
  margin: 5px;
  transition: background 0.3s, border 0.3s;
}
input[type="number"]:hover, input[type="number"]:focus {
  background: #f0f0f0;
}
/* Error styling for inputs */
.error-field {
  border: 2px solid #e74c3c;
  animation: shake 0.3s;
}
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

/* Button Styling */
#calculateBtn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 10px auto;
  padding: 15px;
  font-size: 1.2rem;
  background: linear-gradient(45deg, #2575fc, #6a11cb);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
}
#calculateBtn:hover {
  transform: scale(1.05);
}

/* Error Message */
.error-message {
  text-align: center;
  color: #fff;
  background: #e74c3c;
  padding: 8px;
  margin-bottom: 10px;
  border-radius: 4px;
  display: none;
  animation: fadeIn 0.5s;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: rgba(0,0,0,0.6);
  animation: modalFade 0.5s;
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-content {
  background: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  position: relative;
  animation: contentFade 0.5s;
}
@keyframes contentFade {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #2575fc;
  transition: transform 0.3s;
}
.close:hover {
  transform: scale(1.2);
}
.modal-heading {
  animation: colorCycle 4s infinite;
}
@keyframes colorCycle {
  0% { color: #e74c3c; }
  25% { color: #f1c40f; }
  50% { color: #2ecc71; }
  75% { color: #3498db; }
  100% { color: #e74c3c; }
}
.modal-table-heading {
  animation: colorCycle 4s infinite;
}
#resultTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}
#resultTable th, #resultTable td {
  padding: 10px;
  border: 1px solid #ddd;
  text-align: center;
}
#overallResult {
  font-size: 1.4rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
  color: #2575fc;
}
#calcMethod {
  margin-top: 10px;
  list-style: disc inside;
  color: #555;
}

/* Modal responsiveness */
@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
}

/* Footer */
footer {
  background: #fff;
  text-align: center;
  padding: 10px;
  margin-top: 20px;
  border-top: 1px solid #ddd;
  transition: background 0.3s;
}
footer p:hover {
  background: #f0f0f0;
}
