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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #394453;
  padding: 20px;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 2rem;
 display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 10px;
 
}
 
.subtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 40px;
  font-size: 0.95rem;
}

/* Navbar */
.navbar {
  display: flex;
  flex-direction: column; /* Stack heading and button */
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  position: relative;
}

/* Instructions Button */
.instructions {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: flex-end; /* Button aligned to left */
  margin-bottom: 150px;
   
}

.instructions button {
  background-color: #2c3e50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.3s ease;
  max-width: 100%; /* Prevent overflow */
  white-space: normal; /* Wrap text if needed */
  word-wrap: break-word;
 
}

.instructions button:hover {
  background-color: #040f19;
}

/* Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #ffffff;
  margin: 5% auto;
  padding: 25px 30px;
  border: none;
  width: 90%;
  max-width: 700px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  animation: slideIn 0.3s ease;
  box-sizing: border-box;
 
}

/* .close {
  color: #444;
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: #e53935;
} */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Headings */
h2 {
  color: #34495e;
  margin-top: 35px;
  margin-bottom: 20px;
  font-size: 1.2rem;
  padding: 12px 20px;
  background-color: #ecf0f1;
  border-radius: 6px;
  border-left: 4px solid #3498db;
}

/* Input rows */
.input-row {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

label {
  color: #555;
  font-weight: 500;
  min-width: 200px;
}

input[type="number"] {
  padding: 10px 15px;
  border: 2px solid #dfe6e9;
  border-radius: 6px;
  font-size: 14px;
  width: 250px;
  transition: border-color 0.3s;
}

input[type="number"]:focus {
  outline: none;
  border-color: #3498db;
}

/* Buttons */
button {
  padding: 10px 20px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s;
}

button:hover {
  background-color: #2980b9;
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.button-secondary {
  background-color: #1f2e3e;
}

.button-secondary:hover {
  background-color: #1f2e3e;
}

.button-tertiary {
  background-color: #1f2e3e;
}

.button-tertiary:hover {
  background-color: #1f2e3e;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  border: 1px solid #dfe6e9;
  padding: 12px;
  text-align: center;
}

th {
  background-color: #34495e;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

tbody tr:hover {
  background-color: #e8f4f8;
}

td input {
  width: 100%;
  padding: 6px;
  border: 1px solid #dfe6e9;
  border-radius: 4px;
  text-align: center;
}

/* Containers for results */
#lineTableContainer,
#resultnondiagonal,
#resultdiagonal,
#ybusContainer {
  margin-top: 20px;
}

.section {
  margin-bottom: 30px;
  padding: 25px;
  background-color: #fafbfc;
  border-radius: 8px;
  border: 1px solid #264772;
}
footer {
  text-align: center;
  padding: 10px;
  margin-top: 30px;
  margin-left: -40px;
  margin-right: -40px;
  margin-bottom: -42px;
  background-color: #466581;
  color: white;
  border-radius: 0 0 12px 12px;
  font-size: 16px;
}
#busTableContainer,
#lineTableContainer,
#ybusContainer,
#loadFlowResults {
  width: 100%;
  overflow-x: auto;      /* enables horizontal scrolling */
  overflow-y: hidden;
}

#busTableContainer table,
#lineTableContainer table,
#ybusContainer table,
#loadFlowResults table {
  min-width: 800px;      /* ensures table scrolls instead of squishing */
  width: max-content;    /* fits content naturally */
  display: block;        /* required for overflow scrolling */
}
/* Responsive */
@media (max-width: 768px) {
  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  label {
    min-width: auto;
  }

  input[type="number"] {
    width: 100%;
  }

  .button-group {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .instructions {
    justify-content: center; /* Center button on mobile */
  }
}
