/*
 * Application single job page
 */

.job-application-action {
    margin: 2rem 0;
}

.job-application-action .hrworks-button {
    padding-left: 2rem;
    padding-right: 2rem;
    font-size: 1rem;
}

/*
 * Application form
 */

.hrworks-application-page {
    width: 100%;
    max-width: 52rem;
    margin: 2rem auto;
}

.hrworks-application-page h1,
.hrworks-application-page h2 {
    margin-top: 0;
}

.job-application-success {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    margin: 30px 0;
    border: 1px solid #c6e7cf;
    background: #f1faf3;
}

.job-application-success .dashicons {
    flex: 0 0 auto;
    font-size: 28px;
    width: 28px;
    height: 28px;
}

.job-application-success h3 {
    margin: 0 0 8px;
}

.job-application-success p {
    margin: 0;
}

.job-application-error {
    margin-bottom: 30px;
    padding: 15px 20px;
    border: 1px solid #d63638;
    border-radius: 5px;
    background: #fff5f5;
    color: #d63638;
}

.job-application-form,
.hrworks-application-page .job-application-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.job-application-form-row {
    position: relative;
}

.job-application-form label {
    display: block;
    margin-bottom: 0.35rem;
    color: #111827;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: normal;
}

.hrworks-form-permission-to-store-application label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: normal;
}

.hrworks-form-permission-to-store-application input[type="checkbox"] {
    flex: 0 0 auto;
    margin-top: 4px;
}

.hrworks-form-permission-to-store-application label > span {
    flex: 1;
}

.job-application-form input:not([type="hidden"], [type="checkbox"], [type="radio"]),
.job-application-form textarea,
.job-application-form select {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: var(--wd-form-brd-radius);
    background: #ffffff;
    color: #111827;
    font: inherit;
    text-align: left;
}

.job-application-form textarea {
    min-height: 8rem;
    resize: vertical;
}

.job-application-form input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.hrworks-upload-control {
    display: block;
}

.hrworks-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: var(--wd-form-brd-radius);
    background: #f9fafb;
    color: #111827;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hrworks-upload-button:hover,
.hrworks-upload-control:focus-within .hrworks-upload-button {
    border-color: #2563eb;
    background: #eff6ff;
}

.hrworks-upload-button .dashicons {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 1.1rem;
}

.hrworks-upload-hint {
    display: block;
    margin-top: 0.4rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.upload-file-list {
    display: grid;
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
}

.upload-file-list li {
    display: flex;
    gap: 0.6rem;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--wd-form-brd-radius);
    background: #ffffff;
}

.upload-file-list .file-icon {
    color: #6b7280;
}

.upload-file-list .file-name {
    min-width: 0;
    overflow: hidden;
    color: #111827;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-list .file-size {
    color: #6b7280;
    font-size: 0.85rem;
    white-space: nowrap;
}

.upload-file-list .remove-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: unset;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #6b7280;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.upload-file-list .remove-file:hover,
.upload-file-list .remove-file:focus-visible {
    background: #fee2e2;
    color: #b91c1c;
}

.job-application-form input:focus,
.job-application-form textarea:focus,
.job-application-form select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.job-application-form .hrworks-button {
    justify-self: start;
}

.job-application-success {
    padding: 1rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--wd-form-brd-radius);
    background: #f0fdf4;
    color: #166534;
}

@media (min-width: 700px) {
    .hrworks-application-page .job-application-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .job-application-form .job-application-form-row:nth-last-child(-n + 2),
    .job-application-form .job-application-form-row:has(textarea) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .hrworks-application-page {
        margin: 1.25rem auto;
    }

    .job-application-form,
    .hrworks-application-page .job-application-form {
    .job-application-form .hrworks-form-files,
        padding: 1rem;
    }
}
