/* ✅ Full Layout Container (Scoped to Corrosion Calculator Tab) */
#remainingLifeTab {
  width: 100%;
  max-width: 100%;
  background-color: #fdfdfd;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
  font-family: inherit;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* All children respect border-box */
#remainingLifeTab *, 
#remainingLifeTab *::before, 
#remainingLifeTab *::after {
  box-sizing: inherit;
}

/* ✅ Headings */
#remainingLifeTab h3 {
  text-align: center;
  color: #2a2a2a;
  margin-bottom: 15px;
  font-size: 21px;
  font-weight: 600;
  word-break: break-word;
}

#remainingLifeTab h4 {
  color: #444;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #ccc;
  font-size: 17px;
  font-weight: 500;
}

/* ✅ Grid Input Layout (4 Columns) */
#remainingLifeTab .form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

#remainingLifeTab .form-grid-4 label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: #333;
  word-break: break-word;
}

#remainingLifeTab .form-grid-4 input {
  width: 100%;
  padding: 7px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 14.5px;
  background-color: #fff;
  transition: border-color 0.3s ease;
}

#remainingLifeTab .form-grid-4 input:focus {
  border-color: #007acc;
  outline: none;
}

/* ✅ Button Styling */
#remainingLifeTab .btn {
  background-color: #007acc;
  color: white;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  width: auto; /* Make button width auto */
  min-width: 150px; /* Set a minimum width */
  transition: background-color 0.3s ease, transform 0.1s ease;
}

#remainingLifeTab .btn:hover {
  background-color: #005fa3;
  transform: scale(1.01);
}

/* ✅ Action Buttons Section - Align Buttons in a Single Row */
#remainingLifeTab .action-buttons {
  display: inline-flex;  /* Inline flex ensures no wrapping */
  gap: 20px;
  align-items: center;
  justify-content: flex-start;
}

#remainingLifeTab .bulk-upload {
  display: inline-flex; /* Ensures file input and button align in one row */
  gap: 10px;
  align-items: center;
}

/* ✅ Output Section */
#remainingLifeTab .analysis-output {
  background-color: #f6fcf8;
  border: 1px solid #d4e9dd;
  padding: 20px;
  margin-top: 20px;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

/* ✅ Output Rows (Cleanly Aligned) */
#remainingLifeTab .output-row {
  display: grid;
  grid-template-columns: 250px auto;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  font-size: 15px;
  border-bottom: 1px solid #e4e4e4;
}

#remainingLifeTab .output-row:last-child {
  border-bottom: none;
}

#remainingLifeTab .output-row span:first-child {
  font-weight: 500;
  color: #333;
}

#remainingLifeTab .output-row span:last-child {
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ✅ Responsive Layout */
@media (max-width: 1024px) {
  #remainingLifeTab .form-grid-4 {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on medium screens */
  }
}

@media (max-width: 600px) {
  #remainingLifeTab .form-grid-4 {
    grid-template-columns: 1fr; /* Single column on mobile */
  }

  #remainingLifeTab .btn {
    font-size: 14px; /* Smaller buttons on mobile */
  }

  #remainingLifeTab .output-row {
    grid-template-columns: 1fr;
    padding: 6px 0;
  }

  #remainingLifeTab .output-row span:first-child,
  #remainingLifeTab .output-row span:last-child {
    white-space: normal;
  }
}

/* Chart Container */
.chart-container {
  max-width: 600px;       
  margin: 25px auto 0;    
  padding: 12px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e0e0e0;
}

#thicknessTrendChart {
  width: 100% !important;
  height: 280px !important;
  display: block;
  background-color: #fff;
  border-radius: 6px;
}

/* Modal Background */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  font-family: Arial, sans-serif;
}

/* Modal Content Box */
.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px 25px;
  border-radius: 8px;
  max-width: 95vw;
  max-height: 80vh;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  position: relative;
  overflow-y: auto;
  overflow-x: auto;
}

/* Close Button */
.modal-content .close {
  position: absolute;
  top: 12px;
  right: 20px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
}
.modal-content .close:hover {
  color: #000;
}

/* Table Styling */
.table-preview {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 14px;
  text-align: left;
  color: #333;
}

.table-preview th,
.table-preview td {
  padding: 10px 12px;
  border-bottom: 1px solid #ddd;
  white-space: nowrap;
}

.table-preview th {
  background-color: #007acc;
  color: white;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-preview tbody tr:hover {
  background-color: #f1faff;
}

/* Highlight errors in table */
.table-preview td.error {
  color: #d93025;
  font-weight: bold;
}

/* Custom button size */
.small-btn {
  padding: 5px 12px;
  font-size: 12px;
  width: auto;
}

/* Flexbox layout for buttons */
.action-buttons {
  display: inline-flex;
  gap: 20px;
  align-items: center;
  justify-content: flex-start;
}

.bulk-upload {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.preview-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.analysis-output {
  margin-top: 25px;
}

.output-row {
  margin-bottom: 10px;
}

.table-preview {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.table-preview th, .table-preview td {
  padding: 8px;
  text-align: left;
  border: 1px solid #ddd;
}

.chart-container {
  margin-top: 25px;
}

h4 {
  font-weight: bold;
}
