/*
26062026 Harvin - Shared attachment picker styles.
Only changes the browser UI; Django still receives the original file input name.
*/

/*26062026 Harvin - Hide the original bootstrap file row after JS creates the drag/drop picker.*/
.ehs-attachment-picker .custom-file {
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  line-height: 0;
  overflow: hidden;
}

.ehs-attachment-picker .custom-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ehs-attachment-picker .custom-file-label {
  display: none;
}

.ehs-attachment-picker label,
.ehs-attachment-section-label {
  display: block;
  margin-bottom: 1px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  cursor: default;
}

.ehs-attachment-section-label {
  margin-top: 0;
}

.ehs-attachment-section,
.ehs-attachment-evidence {
  margin-top: 18px;
  width: 100%;
}

.ehs-attachment-section .ehs-attachment-section-label {
  margin-bottom: 10px;
}

.ehs-attachment-section__table,
.ehs-attachment-evidence__table {
  box-sizing: border-box;
  width: 100%;
  margin-left: 0;
  margin-bottom: 0;
  border: 1px solid #ced4da;
  border-collapse: collapse;
}

/*26062026 Harvin - History detail pages place signatories directly after submitted attachments.*/
.ehs-history-attachments .ehs-attachment-section:last-child {
  margin-bottom: 24px;
}

/*26062026 Harvin - Attachment update page keeps existing attachment tables and new upload boxes evenly stacked.*/
.ehs-attachment-update .ehs-attachment-section,
.ehs-attachment-update .ehs-attachment-picker {
  margin-top: 18px;
  margin-bottom: 0;
}

.ehs-attachment-update .ehs-attachment-section .ehs-attachment-section-label {
  margin-bottom: 8px;
}

.ehs-attachment-update .ehs-attachment-picker label {
  margin-bottom: -12px;
}

.ehs-attachment-update .ehs-attachment-picker__dropzone {
  margin-top: 0;
}

.ehs-attachment-update .col-md-12 > br:only-child {
  display: none;
}

/*26062026 Harvin - Reject comment page keeps the Attachment label close to its drop box.*/
.ehs-reject-attachment .ehs-attachment-picker label {
  margin-bottom: -12px;
}

/*26062026 Harvin - Actionee upload confirmation page keeps the Attachment label close to its drop box.*/
.ehs-multiplefiles-attachment .ehs-attachment-picker label {
  margin-bottom: -12px;
}

/*26062026 Harvin - Existing company attachment forms wrap the file field in attachmentpadding.*/
.attachmentpadding.ehs-attachment-picker,
.attachmentpadding .ehs-attachment-picker {
  width: calc(100% + 28px);
  max-width: calc(100% + 28px);
}

.attachmentpadding.ehs-attachment-picker {
  flex: 0 0 calc(100% + 15px);
}

.attachmentpadding.ehs-attachment-picker .ehs-attachment-picker__dropzone,
.attachmentpadding .ehs-attachment-picker__dropzone {
  margin-top: -12px;
}

/*26062026 Harvin - Main drag/drop area used by Attachment and ComAttachment fields.*/
.ehs-attachment-picker__dropzone {
  box-sizing: border-box;
  width: 100%;
  min-height: 98px;
  padding: 16px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: #f3f8fc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ehs-attachment-picker__dropzone.is-dragover {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.ehs-attachment-picker__empty {
  text-align: center;
  color: #506274;
}

.ehs-attachment-picker__browse {
  color: #0069d9;
  text-decoration: underline;
}

.ehs-attachment-picker__save-hint {
  margin-top: 3px;
  color: #506274;
  font-size: 14px;
}

.ehs-attachment-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 22px;
  align-items: flex-start;
}

/*26062026 Harvin - File card preview shows image thumbnails when possible, extension tiles otherwise.*/
.ehs-attachment-picker__file {
  position: relative;
  width: 122px;
  text-align: center;
}

.ehs-attachment-picker__thumb {
  width: 112px;
  height: 78px;
  margin: 0 auto;
  border: 1px solid #d1d7de;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ehs-attachment-picker__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ehs-attachment-picker__type {
  width: 100%;
  height: 100%;
  background: #198754;
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.ehs-attachment-picker__name {
  display: block;
  margin-top: 8px;
  color: #0056b3;
  text-decoration: underline;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.ehs-attachment-picker__remove {
  position: absolute;
  top: -10px;
  right: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #ff3b4f;
  border-radius: 50%;
  background: #ffffff;
  color: #ff3b4f;
  line-height: 20px;
  cursor: pointer;
}

.ehs-attachment-picker__remove:hover,
.ehs-attachment-picker__remove:focus {
  background: #ff3b4f;
  color: #ffffff;
  outline: none;
}

.ehs-attachment-picker__notice {
  margin-top: 8px;
  color: #856404;
  min-height: 20px;
}

.ehs-attachment-picker__notice:empty {
  margin-top: 0;
  min-height: 0;
}

/*26062026 Harvin - Action confirmation page shows upload/evidence full-width first, signature/actions below on the right.*/
.ehs-upload-confirmation__row {
  display: block;
  margin-right: 1px;
}

.ehs-upload-confirmation__upload {
  width: 100%;
}

.ehs-upload-confirmation__side {
  width: 42%;
  min-width: 320px;
  margin-left: auto;
  margin-top: 18px;
}

.ehs-upload-confirmation__signature,
.ehs-upload-confirmation__actions {
  margin-right: 0;
}

.ehs-upload-confirmation__upload .ehs-attachment-picker {
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .ehs-upload-confirmation__upload,
  .ehs-upload-confirmation__side {
    width: 100%;
    min-width: 0;
  }

  .ehs-upload-confirmation__side {
    margin-top: 16px;
  }
}
