/* violationcheck.css ──────────────────────────────────────────────
   FINAL bleed-proof version for Chrome/scroll artifacts
   - border-collapse: separate + sticky on th + top offset + thick bottom border
*/

#validationOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#validationModal {
  background: white;
  border-radius: 10px;
  width: 90vw;
  max-width: 1150px;
  height: 86vh;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  overflow: hidden;
}

#closeValidation {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 60px;
  line-height: 1;
  cursor: pointer;
  color: #C5215D;
  transition: color 0.2s;
  z-index: 10;
}

#closeValidation:hover {
  color: #9d1a4a;
}

#validationPages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}

#validationButtons {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 14px 24px;
  border-top: 1px solid #e0e0e0;
  background: #f8f9fc;
  flex-shrink: 0;
}

#validationButtons button {
  padding: 10px 28px;
  min-width: 170px;
  background: #321f74;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

#validationButtons button:hover {
  background: #C5215D;
}


/* ─────────────────────────────────────────────── */
/* TABLES – Bleed-proof sticky setup                */
/* ─────────────────────────────────────────────── */

#violationsTable,
#keysTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.4;
}

#violationsTable th,
#violationsTable td,
#keysTable th,
#keysTable td {
  border: 1px solid #321f74;
  padding: 10px 12px;
  text-align: center;
  vertical-align: top;
  background: white;
}

#violationsTable thead th,
#keysTable thead th {
  position: sticky;
  top: -20px;
  z-index: 10;
  background: #C5215D;
  font-weight: 600;
  border-bottom: 1px solid #321f74;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  will-change: transform;
  color: white;
}

/* Column widths */
#violationsTable th:nth-child(1),
#violationsTable td:nth-child(1) { width: 18%; max-width: 200px; word-break: break-word; overflow-wrap: break-word; hyphens: auto; white-space: normal; }

#violationsTable th:nth-child(2),
#violationsTable td:nth-child(2) { width: 36%; max-width: 420px; word-break: break-word; overflow-wrap: break-word; hyphens: auto; white-space: normal; }

#violationsTable th:nth-child(3),
#violationsTable td:nth-child(3) { width: 18%; max-width: 220px; word-break: break-word; overflow-wrap: break-word; hyphens: auto; white-space: normal; }

#violationsTable th:nth-child(4),
#violationsTable td:nth-child(4) { width: 28%; word-break: break-word; overflow-wrap: break-word; white-space: normal; }

#keysTable th:nth-child(1),
#keysTable td:nth-child(1) { width: 70%; max-width: 380px; word-break: break-word; overflow-wrap: break-word; hyphens: auto; white-space: normal; }

#keysTable th:nth-child(2),
#keysTable td:nth-child(2) { width: 30%; max-width: 720px; word-break: break-word; overflow-wrap: break-word; hyphens: auto; white-space: normal; }

#violationsTable td,
#keysTable td {
  max-height: 160px;
  overflow: hidden;
}

#violationsTable tr:hover td,
#keysTable tr:hover td {
  background-color: #f8f9fa;
}

/* ─────────────────────────────────────────────── */
/* ROW STATES                                       */
/* ─────────────────────────────────────────────── */

/* Row being actively edited — subtle dark tint */
#violationsTable tbody tr.row-editing td {
  background: #ebebeb !important;
}

/* Approved / confirmed row — soft green */
#violationsTable tbody tr.row-approved td {
  background: #e8f7e8 !important;
}

#violationsTable tbody tr.row-approved:hover td {
  background: #d6f0d6 !important;
}

/* CONFIRMED label shown under violation error text */
.confirmed-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #1e7e1e;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────── */
/* APPROVE CHECKBOX ROW                             */
/* ─────────────────────────────────────────────── */

.approve-row {
  margin-bottom: 6px;
  display: none;        /* hidden by default; JS adds .approve-row--visible to show */
  justify-content: center;
}

.approve-row--visible {
  display: flex;
}

.approve-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #321f74;
  cursor: default;
  user-select: none;
}

.approve-check {
  width: 16px;
  height: 16px;
  accent-color: #1e7e1e;
  cursor: pointer;
}

.approve-check:disabled {
  cursor: default;
  opacity: 0.7;
}

/* ─────────────────────────────────────────────── */
/* COMMENTS CELL LAYOUT                             */
/* ─────────────────────────────────────────────── */

#violationsTable tbody td:nth-child(1) {
  text-align: center;
  vertical-align: middle;
}

#violationsTable tbody td:nth-child(2) {
  text-align: center;
  line-height: 1.6;
  padding: 12px 8px;
  vertical-align: middle;
}

#violationsTable tbody td:nth-child(3) {
  text-align: center;
  vertical-align: middle;
}

#violationsTable td.comments-cell {
  display: table-cell; /* keep as table cell */
  vertical-align: middle;
  text-align: center;
}

.error-cell {
  text-align: center;
  vertical-align: middle;
}

#violationsTable td textarea {
  width: 100%;
  min-height: 60px;
  max-height: 150px;
  resize: vertical;
  padding: 6px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  display: block;
  margin: 4px 0;
}

.btn-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
}

#violationsTable td button {
  padding: 6px 12px;
  background: #321f74;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

#violationsTable td button:hover {
  background: #C5215D;
}

#violationsTable td button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ─────────────────────────────────────────────── */
/* MOBILE                                           */
/* ─────────────────────────────────────────────── */

@media (max-width: 820px) {
  #validationModal { width: 96vw; height: auto; max-height: 90vh; }
  #validationPages { padding: 16px; }
  #violationsTable, #keysTable { font-size: 13px; }
  #violationsTable td, #keysTable td, #violationsTable th, #keysTable th { padding: 8px 10px; }
  #violationsTable th:nth-child(1), #violationsTable td:nth-child(1) { width: 22%; max-width: 140px; }
  #violationsTable th:nth-child(2), #violationsTable td:nth-child(2) { width: 34%; }
  #violationsTable th:nth-child(3), #violationsTable td:nth-child(3) { width: 18%; }
  #keysTable th:nth-child(1), #keysTable td:nth-child(1) { width: 40%; }
  #keysTable th:nth-child(2), #keysTable td:nth-child(2) { width: 60%; }
}

/* ─────────────────────────────────────────────── */
/* VALIDATION BUTTON (main toolbar)                 */
/* ─────────────────────────────────────────────── */

.validation-btn {
  padding: 8px 16px;
  background: #321f74;
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
  text-align: center;
  line-height: 1.2;
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  display: block;
}

.validation-btn:hover {
  background: #c5215d;
}

.validation-btn .main-text {
  font-size: 16px;
  font-weight: 600;
}

.validation-btn .small-text {
  font-size: 10px;
  opacity: 0.85;
}

/* ─────────────────────────────────────────────── */
/* "SHOW APPROVED JOB VIOLATIONS" BUTTON            */
/* ─────────────────────────────────────────────── */

.show-approved-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 28px;
  background: #321f74;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.show-approved-btn:hover {
  background: #C5215D;
}