/* Reusable file upload dropzone + status row (QRSS; scoped tokens from qrss-variables.css). Values in px per style-standards. */

/* Use <label> for=… with class qld__btn, not <button> — buttons cannot contain file inputs, and
   Chromium/Edge still paint the I-beam/arrow for the file input on top, ignoring cursor: pointer. */
.qrss__file-upload__btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  position: relative;
  vertical-align: top;
}

/* Invisible file input: full-size hit target, but no pointer events so events hit the <label> underneath;
   the label’s activation opens the file dialog, and the label shows a proper pointer cursor. */
.qrss__file-upload__btn input[type="file"] {
  bottom: 0;
  height: 100% !important;
  left: 0;
  margin: 0;
  min-height: 100%;
  min-width: 100%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  width: 100% !important;
  z-index: 2;
}

.qrss__file-upload__btn-text {
  pointer-events: none;
  position: relative;
  z-index: 0;
}

.qrss__file-upload__details {
  margin-left: 16px;
  min-width: 0;
}

.qrss__file-upload__dropzone {
  border: 2px dashed var(--QLD-color-light__border--alt);
  border-radius: 4px;
  margin: 12px 0;
  padding: 24px;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.qrss__file-upload__dropzone--drag-active {
  background-color: var(--QLD-color-light__background, #e6f6ff);
  border-color: var(--QLD-color-light__action--primary, #005eb8);
  box-shadow: 0 0 0 1px var(--QLD-color-light__action--primary, #005eb8) inset;
}

/* Document-type dropdown + "Select files" button on a single line, dropdown to
   the left of the button with a 20px gap. Wraps to stacked layout on narrow
   viewports. Shared by the health / additional-document upload dropzones. */
.qrss__file-upload__controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 24px;
}

.qrss__file-upload__controls .qld__select {
  margin-bottom: 0;
  width: auto;
}

.qrss__file-upload__controls .qld__select-control {
  width: auto;
}

/* The shared button carries a stacked top margin; remove it when it sits inline
   with the dropdown so the two controls align on the same row. */
.qrss__file-upload__controls .qrss__file-upload__btn {
  margin-top: 0;
}

.qrss__file-upload__file-name {
  color: var(--qrss-pagination-blue);
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qrss__file-upload__file-size {
  color: var(--qrss-medium-grey);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.qrss__file-upload__heading {
  color: var(--qrss-form-panel-heading) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 20px !important;
  margin: 0 !important;
  max-width: none !important;
}

.qrss__file-upload__help {
  color: var(--qrss-medium-grey) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  margin: 16px auto 0 !important;
  max-width: none !important;
}

.qrss__file-upload__icon {
  flex-shrink: 0;
}

.qrss__file-upload__icon--doc {
  color: var(--qrss-pagination-blue);
}

.qrss__file-upload__meta {
  color: var(--qrss-medium-grey);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.qrss__file-upload__meta-line {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

@media (min-width: 768px) {
  .qrss__file-upload__meta-line {
    flex-wrap: wrap;
  }
}

.qrss__file-upload__remove {
  margin-left: auto;
}

.qrss__file-upload__remove-doc-btn {
  align-items: center;
  color: var(--qrss-pagination-blue);
  display: inline-flex;
  gap: 4px;
  text-decoration: underline;
}

.qrss__file-upload__remove-link {
  color: var(--qrss-pagination-blue);
  margin-left: auto;
  text-decoration: underline;
}

.qrss__file-upload__row {
  align-items: center;
  background-color: var(--qrss-light-grey-alt);
  border: 2px solid var(--qrss-accordion-border);
  border-radius: 4px;
  display: flex;
  gap: 16px;
  margin: 8px 0;
  padding: 24px;
}

.qrss__file-upload__row--error {
  background-color: var(--qrss-error-surface, #fff6f6);
  border: 2px solid var(--qrss-error, #e22339);
}

.qrss__file-upload__row--success {
  background-color: var(--qrss-success-surface, #F7FBF8);
  border: 2px solid var(--qrss-green-success, #339d37);
}

.qrss__file-upload__row--error .qrss__file-upload__file-name {
  color: var(--qrss-error, #e22339);
}

.qrss__file-upload__icon--error {
  color: var(--qrss-error, #e22339);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  justify-content: center;
  line-height: 0;
}

.qrss__file-upload__row--error .qrss__file-upload__icon--error > svg {
  height: 34px;
  margin-left: -4px;
  width: 33px;
}

.qrss__file-upload__row--error .qrss__file-upload__status-text {
  color: var(--qrss-error, #e22339);
}

.qrss__file-upload__row--error .qld__icon {
  color: var(--qrss-error, #e22339);
}

.qrss__file-upload__list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}

.qrss__file-upload__row .qrss__file-upload__details {
  margin-left: 0;
}

.qrss__file-upload__row--error .qrss__file-upload__details--error {
  margin-left: -4px;
}

.qrss__file-upload__status-text {
  color: var(--qrss-medium-grey);
  font-size: 14px;
  line-height: 20px;
}

/* Below lg: icon on its own row (mobile + tablet); details + remove share the next row. */
@media (max-width: 991.98px) {
  .qrss__file-upload__row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .qrss__file-upload__row > .qrss__file-upload__icon {
    display: flex;
    flex-basis: 100%;
    justify-content: center;
    width: 100%;
  }

  .qrss__file-upload__row--error .qrss__file-upload__details--error {
    margin-left: 0;
  }
}

/* Mobile only: remove below filename/status so text can use full width. */
@media (max-width: 767.98px) {
  .qrss__file-upload__meta-line svg {
    flex-shrink: 0;
    min-height: 20px;
    min-width: 20px;
  }

  .qrss__file-upload__row > .qrss__file-upload__details {
    flex-basis: 100%;
    min-width: 0;
  }

  .qrss__file-upload__row > .qrss__file-upload__remove {
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 8px;
  }
}
