/* Base file input
   Markup:
     <div class="file-input">
       <input type="file" id="x" class="file-input__native">
       <label class="file-input__trigger btn btn-secondary" for="x">
         <i class="fas fa-folder-open"></i> Choose file
       </label>
       <span class="file-input__name" data-file-input-placeholder="No file chosen">No file chosen</span>
     </div>
   base_file_input.js keeps __name in sync. */

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.file-input__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-input__trigger {
  flex-shrink: 0;
  cursor: pointer;
}

.file-input__native:focus-visible + .file-input__trigger {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.file-input__name {
  min-width: 0;
  font-size: 13px;
  color: var(--muted-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-input.has-file .file-input__name {
  color: var(--text-color);
  font-weight: 500;
}

.file-input__clear {
  flex-shrink: 0;
}

.file-input:not(.has-file) .file-input__clear {
  display: none;
}

/* Full-width variant: trigger keeps its size, the name fills the rest. */
.file-input--block {
  display: flex;
  width: 100%;
}

.file-input--block .file-input__name {
  flex: 1;
}

/* Drop zone variant: the whole area is the target. */
.file-input--dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 22px 18px;
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  background: var(--input-bg);
  text-align: center;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.file-input--dropzone.is-dragover {
  border-color: var(--primary-blue);
  background: color-mix(in srgb, var(--primary-blue) 8%, transparent);
}

.file-input--dropzone .file-input__name {
  white-space: normal;
  text-align: center;
}
