.cvform-file-upload {
    width: 100%;
    max-width: 100%;
    position: relative;
    box-sizing: border-box;
}

.cvform-dropzone {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
    min-height: 120px;
    padding: 30px 20px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    background-color: #fff;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.cvform-dropzone:hover,
.cvform-dropzone.drag-over,
.cvform-dropzone.dragover {
    border-color: #666;
    background-color: #f9f9f9;
}

/* Highlight dropzone when form-validator reports an error on the file input */
.cvform-dropzone:has(.cvform-file-input.error) {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.cvform-dropzone-text {
    color: #555;
    font-size: 16px;
    line-height: 1.4;
    pointer-events: none;
}

.cvform-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Position form-validator error messages absolutely below the dropzone,
   matching its width. Multi-line wrapping for long error text. */
.cvform-file-upload .form-error,
#step_2 .cvform-file-upload .form-error {
    position: absolute !important;
    display: block !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    margin-top: 5px !important;
    margin-left: 0 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    box-sizing: border-box !important;
    pointer-events: none;
    text-align: left;
}

.cvform-file-list {
    margin-top: 5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.cvform-file-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Grid row: icon pinned left, remove pinned right, name fills the middle.
   grid-template-columns with minmax(0,1fr) is a HARD constraint — the name
   column CANNOT exceed the available space, unlike flex which may still
   yield to content-intrinsic sizing in some browsers. */
.cvform-file-item {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto 30px;
    align-items: center;
    gap: 0 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.cvform-file-item.has-error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.cvform-file-item.is-uploading {
    grid-template-rows: auto auto;
    row-gap: 4px;
}

.cvform-progress {
    grid-column: 2 / 4;
    grid-row: 2;
    position: relative;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.cvform-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: #fd621c;
    border-radius: 3px;
    transition: width 0.15s linear;
}

.cvform-progress-pct {
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 11px;
    color: #888;
}

.cvform-file-error {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #dc3545;
    background-color: #fff5f5;
    border: 1px solid #dc3545;
    border-radius: 4px;
}

.cvform-file-error.is-visible {
    display: block;
}

.cvform-file-icon {
    grid-column: 1;
    width: 16px;
    justify-self: center;
}

.cvform-file-icon::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ff6b00;
}

.cvform-file-name {
    grid-column: 2;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hidden by default. When shown it occupies column 3 and the 1fr name
   column automatically shrinks by the same amount. */
.cvform-file-size {
    text-align: right;
    white-space: nowrap;
    color: #888;
    font-size: 12px;
}

.cvform-file-size.is-visible {
    display: block;
    grid-column: 3;
}

.cvform-file-remove,
.cvform-remove-file {
    grid-column: 4;
    justify-self: end;
    width: 30px;
    text-align: right;
    background: none;
    border: none;
    color: #c00;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.cvform-file-remove:hover,
.cvform-remove-file:hover {
    color: #900;
}

.cvform-file-hint {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}
