/* <!-- styles.css --> */
/* Layout */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background: #f4f4f4;
}
.section {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: white;
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);

}
.two-col {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  align-items: stretch;
  min-height: 100%;
}
.input-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}
.notes-container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 20px;
  width: 100%;
}
.notes-container textarea {
  flex: 1;
}
.notes-container .submit-btn {
  margin-top: 0;
  width: auto;
  align-self: flex-start;
}
.input-row {
  width: 100%;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #000;
  padding: 10px 0px;
}
.input-row input,
.input-row select {
  width: 100%;
  max-width: 250px;
  padding: 0;
  margin-top: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  text-align: right;
}
.input-row input:focus,
.input-row select:focus {
  outline: none;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  width: 100%;
}
.section-header h2 {
  margin-top: 0;
  padding-top: 0;
}

@media (max-width: 800px) {
  .two-col {
    flex-direction: column;
  }
  .two-col img {
    max-width: 100% !important;
    width: 100%;
  }
}


/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background: white;
}
th {
  background: #002512;
  color: white;
  font-weight: 400;
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  /* text-transform: uppercase; */
  letter-spacing: 0.5px;
}
th:first-child {
  border-top-left-radius: 8px;
}
th:last-child {
  border-top-right-radius: 8px;
}
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  background: white;
}
/* Make Name columns smaller */
#employeeTable th:first-child,
#employeeTable td:first-child,
#plantTable th:first-child,
#plantTable td:first-child,
#subTable th:first-child,
#subTable td:first-child {
  width: 200px;
  min-width: 120px;
  max-width: 200px;
}

@media (max-width: 600px) {
  #employeeTable th:first-child,
  #employeeTable td:first-child,
  #plantTable th:first-child,
  #plantTable td:first-child,
  #subTable th:first-child,
  #subTable td:first-child {
    width: 90px;
    min-width: 60px;
    max-width: 110px;
  }
}
/* Plant table name column - smaller */
/* #plantTable th:nth-child(2),
#plantTable td:nth-child(2) {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
} */

/* Make Time In and Time Out columns smaller */
#employeeTable th:nth-child(2),
#employeeTable th:nth-child(3),
#employeeTable td:nth-child(2),
#employeeTable td:nth-child(3),
#subTable th:nth-child(2),
#subTable th:nth-child(3),
#subTable td:nth-child(2),
#subTable td:nth-child(3) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}
#employeeTable td:nth-child(2) input,
#employeeTable td:nth-child(3) input,
#subTable td:nth-child(2) input,
#subTable td:nth-child(3) input {
  width: 100%;
  min-width: 0;
}

/* Center checkbox and delete button columns */
/* #plantTable th:first-child,
#plantTable td:first-child, */
#employeeTable th:last-child,
#employeeTable td:last-child,
#subTable th:last-child,
#subTable td:last-child,
#plantTable th:last-child,
#plantTable td:last-child {
  text-align: center;
}
/* Make delete columns smaller */
#employeeTable th:last-child,
#employeeTable td:last-child,
#subTable th:last-child,
#subTable td:last-child,
#plantTable th:last-child,
#plantTable td:last-child {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}
tr:last-child td:first-child {
  border-bottom-left-radius: 8px;
}
tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}
tr:hover td {
  background: #f8f9ff;
  transition: background-color 0.2s ease;
}
tr:last-child td {
  border-bottom: none;
}
/* Table inputs */
/* Remove all styling from text inputs */
table input[type="text"] {
  all: unset;
  width: 100%;
}
table input[type="text"]:focus {
  all: unset;
  width: 100%;
}
/* Remove styling from time inputs and selects */
table select {
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
}
table select:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
/* Remove all styling from time inputs */
table input[type="time"] {
  all: unset;
  width: 100%;
}
table input[type="time"]:focus {
  all: unset;
  width: 100%;
}
table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #667eea;
  display: block;
  margin: 0 auto;
}
/* Delete button in tables */
table .delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: inline-block;
}
table .delete-btn:hover {
  background: #c82333;
  transform: scale(1.05);
}


/* Inputs */
input, textarea {
  width: 95%;
  padding: 8px;
  margin-top: 5px;
  border-radius: 5px;
  border: 1px solid #ccc;
}
.add-btn, .submit-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 5px;
  cursor: pointer;
  /* margin-top: 10px; */
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.add-btn:hover, .submit-btn:hover {
  background: #0056b3;
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.submit-btn {
  background: #002512;
  padding: 12px 24px;
  font-size: 16px;
  width: 40%;
  /* margin-top: 20px; */
}
.submit-btn:hover {
  background: #002512;
}

/* Responsive table improvements */
@media (max-width: 768px) {
  .section-header h2 {
    font-size: 18px;
  }
  .add-btn {
    font-size: 12px;
    padding: 8px 12px;
  }
  table {
    font-size: 11px;
  }
  th {
    font-size: 10px;
    padding: 8px 6px;
    letter-spacing: 0.3px;
  }
  td {
    padding: 6px 4px;
    font-size: 11px;
  }
  table input[type="text"] {
    all: unset;
    width: 100%;
  }
  table select {
    font-size: 10px;
    padding: 0;
  }
  table input[type="time"] {
    all: unset;
    width: 100%;
  }
  table .delete-btn {
    font-size: 9px;
    padding: 3px 6px;
  }

  #employeeTable th:first-child,
  #employeeTable td:first-child,
  #plantTable th:first-child,
  #plantTable td:first-child,
  #subTable th:first-child,
  #subTable td:first-child {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
  }

  /* Make Time In and Time Out columns smaller on mobile */
  #employeeTable th:nth-child(2),
  #employeeTable th:nth-child(3),
  #employeeTable td:nth-child(2),
  #employeeTable td:nth-child(3),
  #subTable th:nth-child(2),
  #subTable th:nth-child(3),
  #subTable td:nth-child(2),
  #subTable td:nth-child(3) {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
  }

  /* Make delete columns smaller */
  #employeeTable th:last-child,
  #employeeTable td:last-child,
  #subTable th:last-child,
  #subTable td:last-child,
  #plantTable th:last-child,
  #plantTable td:last-child {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
  }
}

@media (max-width: 480px) {
  .section-header h2 {
    font-size: 16px;
  }
  .add-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
  table {
    font-size: 10px;
  }
  th {
    font-size: 9px;
    padding: 6px 4px;
  }
  td {
    padding: 5px 3px;
    font-size: 10px;
  }
  table input[type="text"] {
    all: unset;
    width: 100%;
  }
  table select {
    font-size: 9px;
    padding: 0;
  }
  table input[type="time"] {
    all: unset;
    width: 100%;
  }
  table .delete-btn {
    font-size: 8px;
    padding: 2px 2px;
  }

  #employeeTable th:first-child,
  #employeeTable td:first-child,
  #plantTable th:first-child,
  #plantTable td:first-child,
  #subTable th:first-child,
  #subTable td:first-child {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
  }

  /* Make Time In and Time Out columns even smaller on small mobile */
  #employeeTable th:nth-child(2),
  #employeeTable th:nth-child(3),
  #employeeTable td:nth-child(2),
  #employeeTable td:nth-child(3),
  #subTable th:nth-child(2),
  #subTable th:nth-child(3),
  #subTable td:nth-child(2),
  #subTable td:nth-child(3) {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }
  /* Make delete columns smaller */
  #employeeTable th:last-child,
  #employeeTable td:last-child,
  #subTable th:last-child,
  #subTable td:last-child,
  #plantTable th:last-child,
  #plantTable td:last-child {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }
}

/* Work Description Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

.modal-body {
  display: flex;
  padding: 20px;
  /* width: 100%; */
  flex: 1;
  /* overflow-y: auto; */
}

.modal-body textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  resize: vertical;
  min-height: 100px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid #e0e0e0;
}

.modal-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  background: #007bff;
  color: white;
}

.modal-btn:hover {
  background: #0056b3;
}

.modal-btn-cancel {
  background: #6c757d;
}

.modal-btn-cancel:hover {
  background: #545b62;
}

/* Work description cell styling */
.work-desc-cell {
  cursor: pointer;
  padding: 8px;
  min-height: 20px;
  position: relative;
}

.work-desc-cell:hover {
  background-color: #f0f0f0;
}

/* Time cell styling */
.time-cell {
  cursor: pointer;
  padding: 8px;
  min-height: 20px;
  position: relative;
}

.time-cell:hover {
  background-color: #f0f0f0;
}

/* Subcontractor name cell styling */
.sub-name-cell {
  cursor: pointer;
  padding: 8px;
  min-height: 20px;
  position: relative;
}

.sub-name-cell:hover {
  background-color: #f0f0f0;
}

.sub-name-display {
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-name-display.empty {
  color: #999;
  font-style: italic;
}

.work-desc-display {
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-desc-display.empty {
  color: #999;
  font-style: italic;
}

.work-desc-input {
  display: none;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #002512;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 20px;
  font-size: 16px;
  color: #002512;
  font-weight: 500;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 300px;
  font-size: 14px;
  font-weight: 500;
}

.toast.success {
  background-color: #28a745;
}

.toast.error {
  background-color: #dc3545;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

@media (max-width: 768px) {
  .toast {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
    transform: translateY(-20px);
  }
  
  .toast.show {
    transform: translateY(0);
  }
}