/*
 * Attachment picker (app\widgets\FileUpload).
 * One drop zone plus a list of the files already chosen. Follows the NCC palette in ncc-theme.css.
 */

.ncc-upload {
  margin-bottom: 1rem;
}

.ncc-upload__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.ncc-upload__label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ncc-text);
}

.ncc-upload__required {
  color: var(--ncc-red);
  margin-left: 0.1rem;
}

.ncc-upload__hint {
  font-size: 0.75rem;
  color: var(--ncc-muted);
}

.ncc-upload__zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 1.25rem 1rem;
  text-align: center;
  background: var(--ncc-surface);
  border: 1.5px dashed var(--ncc-line-strong);
  border-radius: var(--ncc-radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.ncc-upload__zone:hover {
  border-color: var(--ncc-muted);
  background: #f3f4f6;
}

.ncc-upload__zone:focus-visible {
  outline: none;
  border-color: var(--ncc-red);
  box-shadow: 0 0 0 3px var(--ncc-red-tint);
}

.ncc-upload__zone.is-dragging {
  border-color: var(--ncc-red);
  background: var(--ncc-red-tint);
}

.ncc-upload__zone.is-invalid {
  border-color: var(--ncc-red);
  background: var(--ncc-red-tint);
}

.ncc-upload__icon {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ncc-red);
  margin-bottom: 0.35rem;
}

.ncc-upload__cta {
  font-size: 0.875rem;
  color: var(--ncc-text-secondary);
}

.ncc-upload__cta-action {
  font-weight: 600;
  color: var(--ncc-red);
}

.ncc-upload__meta {
  font-size: 0.75rem;
  color: var(--ncc-muted);
}

/* The native input stays in the page for form submission but is not drawn. */
.ncc-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

.ncc-upload__list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ncc-upload__file {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  background: var(--ncc-card);
  border: 1px solid var(--ncc-line);
  border-radius: var(--ncc-radius-sm);
}

.ncc-upload__thumb {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ncc-radius-sm);
  background: var(--ncc-surface);
  color: var(--ncc-text-secondary);
  font-size: 0.95rem;
  overflow: hidden;
}

.ncc-upload__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ncc-upload__details {
  flex: 1 1 auto;
  min-width: 0;
}

.ncc-upload__name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ncc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ncc-upload__size {
  display: block;
  font-size: 0.7rem;
  color: var(--ncc-muted);
}

a.ncc-upload__name {
  text-decoration: none;
}

a.ncc-upload__name:hover {
  color: var(--ncc-red);
  text-decoration: underline;
}

.ncc-upload__remove {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--ncc-radius-sm);
  background: transparent;
  color: var(--ncc-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ncc-upload__remove:hover,
.ncc-upload__remove:focus-visible {
  color: var(--ncc-red);
  background: var(--ncc-red-tint);
  outline: none;
}

.ncc-upload__error {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--ncc-red-dark);
}

/* Attachments already stored against the record (edit screens). */
.ncc-upload__existing {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ncc-upload__existing .ncc-upload__file {
  background: var(--ncc-surface);
}

/* Fallback for browsers without DataTransfer: draw the native control and drop the list. */
.ncc-upload--native .ncc-upload__input {
  position: static;
  width: auto;
  height: auto;
  margin: 0.5rem 0 0;
  padding: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  pointer-events: auto;
}

