.folks-ats {
    --folks-ats-border: #ccc;
    --folks-ats-accent: #896947;
    --folks-ats-accent-text: #fff;
}

.folks-ats-table {
    border-collapse: collapse;
    width: 100%;
}

.folks-ats-table th,
.folks-ats-table td {
    border-bottom: 1px solid var(--folks-ats-border);
    padding: 0.6rem 0.4rem;
    text-align: left;
    vertical-align: top;
}

.folks-ats-table th {
    width: 50%;
}

.folks-ats-table select {
    display: block;
    font-size: 0.8em;
    font-weight: normal;
    margin-top: 0.25rem;
    width: 100%;
}

.folks-ats-job {
    cursor: pointer;
}

.folks-ats-job[hidden] {
    display: none;
}

/* Ville à gauche, bouton « Postuler » à la fin de la ligne */
.folks-ats-job__end {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.folks-ats-job__open {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-align: left;
}

.folks-ats-job__open:focus-visible,
.folks-ats-dialog__close:focus-visible,
.folks-ats-button:focus-visible,
.folks-ats-form__group input:focus-visible,
.folks-ats-form__group select:focus-visible,
.folks-ats-form__consent-text:focus-visible {
    outline: 2px solid var(--folks-ats-accent);
    outline-offset: 2px;
}

.folks-ats-form__group input:focus,
.folks-ats-form__group select:focus {
    border-color: var(--folks-ats-accent);
}

/* Modale de détail d'un poste (calquée sur l'ancien widget Folks) */
.folks-ats-dialog {
    background: transparent;
    border: 0;
    max-height: 100vh;
    max-width: 100vw;
    padding: 0.4rem;
    width: 100%;
}

.folks-ats-dialog::backdrop {
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    background: rgba(255, 255, 255, 0.9);
}

.folks-ats-dialog[open] .folks-ats-dialog__panel {
    animation: folks-ats-pop 0.22s ease-out;
}

.folks-ats-dialog[open]::backdrop {
    animation: folks-ats-fade 0.22s ease-out;
}

@keyframes folks-ats-pop {
    from {
        opacity: 0;
        transform: translateY(0.75rem) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes folks-ats-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .folks-ats-dialog[open] .folks-ats-dialog__panel,
    .folks-ats-dialog[open]::backdrop {
        animation: none;
    }
}

.folks-ats-dialog__panel {
    background: #fff;
    box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    max-height: 75vh;
    max-width: 80vw;
    padding: 0 1rem;
    width: 100%;
}

@media (max-width: 600px) {
    .folks-ats-dialog__panel {
        max-width: 100%;
    }
}

.folks-ats-dialog__header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: 1rem;
}

.folks-ats-dialog__title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.folks-ats-dialog__subtitle {
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0.25rem 0 0;
}

.folks-ats-dialog__close {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: 1.75rem;
    line-height: 1;
    opacity: 0.6;
    padding: 0 0.25rem;
}

.folks-ats-dialog__close:hover {
    opacity: 1;
}

.folks-ats-dialog__body {
    line-height: 1.65;
    overflow-y: auto;
    padding: 1rem 0.5rem 1rem 0;
}

/* Les réinitialisations CSS des thèmes retirent souvent les puces et les marges. */
.folks-ats-dialog__body p {
    margin: 0 0 1em;
}

.folks-ats-dialog__body ul {
    list-style: disc;
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.folks-ats-dialog__body ol {
    list-style: decimal;
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.folks-ats-dialog__body strong {
    font-weight: 700;
}

/* Bouton « Postuler » / « Soumettre » */
.folks-ats-button {
    background: var(--folks-ats-accent);
    border: 1px solid var(--folks-ats-accent);
    border-radius: 0.1rem;
    color: var(--folks-ats-accent-text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.4;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}

.folks-ats-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.folks-ats-dialog__actions {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
}

/* Formulaire de candidature */
.folks-ats-form {
    border-top: 1px solid var(--folks-ats-border);
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.folks-ats-form__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.folks-ats-form__row {
    display: grid;
    gap: 0 0.8rem;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 600px) {
    .folks-ats-form__row {
        grid-template-columns: 1fr;
    }
}

.folks-ats-form__group {
    margin-bottom: 0.8rem;
}

.folks-ats-form__group label {
    display: block;
    margin-bottom: 0.2rem;
}

.folks-ats-form__group input[type="text"],
.folks-ats-form__group input[type="email"],
.folks-ats-form__group input[type="tel"] {
    background: #fff;
    border: 1px solid var(--folks-ats-border);
    border-radius: 0.1rem;
    box-sizing: border-box;
    font: inherit;
    padding: 0.35rem 0.5rem;
    width: 100%;
}

.folks-ats-file {
    position: relative;
}

.folks-ats-file__input {
    display: block !important;
    height: 1px;
    left: 0;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    top: 0;
    width: 1px;
}

.folks-ats-file .file-upload-wrapper {
    display: none !important;
}

.folks-ats-file__button {
    align-items: center;
    background: #fff;
    border: 1px dashed var(--folks-ats-accent);
    border-radius: 0.4rem;
    box-sizing: border-box;
    color: var(--folks-ats-accent);
    cursor: pointer;
    display: flex;
    font-weight: 700;
    justify-content: center;
    margin: 0;
    padding: 0.7rem 1rem;
    transition: background 0.15s ease-out;
    width: 100%;
}

.folks-ats-file__button:hover {
    background: rgba(137, 105, 71, 0.08);
}

.folks-ats-file__input:focus-visible + .folks-ats-file__button {
    outline: 2px solid var(--folks-ats-accent);
    outline-offset: 2px;
}

.folks-ats-file.has-file .folks-ats-file__button {
    display: none;
}

.folks-ats-file__chosen {
    align-items: center;
    background: rgba(137, 105, 71, 0.08);
    border: 1px solid var(--folks-ats-border);
    border-radius: 0.4rem;
    box-sizing: border-box;
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
}

.folks-ats-file__chosen[hidden] {
    display: none;
}

.folks-ats-file__icon {
    fill: none;
    flex: none;
    height: 1.4rem;
    stroke: var(--folks-ats-accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 1.4rem;
}

.folks-ats-file__label {
    display: flex;
    font-weight: 600;
    min-width: 0;
}

.folks-ats-file__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folks-ats-file__ext {
    flex: none;
}

.folks-ats-file__size {
    flex: none;
    font-size: 0.8em;
    margin-left: auto;
    opacity: 0.7;
    white-space: nowrap;
}

.folks-ats-file__remove {
    background: none;
    border: 0;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    flex: none;
    font-size: 1.25rem;
    height: 1.75rem;
    line-height: 1;
    opacity: 0.7;
    padding: 0;
    width: 1.75rem;
}

.folks-ats-file__remove:hover,
.folks-ats-file__remove:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    opacity: 1;
}

.folks-ats-file__remove:focus-visible {
    outline: 2px solid var(--folks-ats-accent);
    outline-offset: 1px;
}

/* Champ piège anti-robot : hors écran, sans être « display: none » (certains robots l'ignoreraient alors). */
.folks-ats-form__trap {
    height: 0;
    left: -9999px;
    overflow: hidden;
    position: absolute;
    width: 0;
}

.folks-ats-form__status {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.folks-ats-form__status[hidden] {
    display: none;
}

.folks-ats-form__status--info {
    border: 1px solid var(--folks-ats-border);
}

.folks-ats-form__status--success {
    background: #e8f5e9;
    border: 1px solid #2e7d32;
    color: #1b5e20;
}

.folks-ats-form__status--error {
    background: #fdecea;
    border: 1px solid #c62828;
    color: #8e1b1b;
}

/* Une fois la candidature envoyée, on ne garde que le titre et le message de confirmation. */
.folks-ats-form.is-sent > :not(.folks-ats-form__title):not(.folks-ats-form__success) {
    display: none;
}

.folks-ats-form__success {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 0;
    text-align: center;
}

.folks-ats-form__success[hidden] {
    display: none;
}

.folks-ats-form__success-text {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.folks-ats-form__check {
    fill: none;
    height: 3.5rem;
    stroke: var(--folks-ats-accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    width: 3.5rem;
}

.folks-ats-form__check path {
    animation: folks-ats-draw 0.4s 0.2s ease-out forwards;
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
}

@keyframes folks-ats-draw {
    to {
        stroke-dashoffset: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .folks-ats-form__check path {
        animation: none;
        stroke-dashoffset: 0;
    }
}

.folks-ats-form__hint {
    font-size: 0.8em;
    margin-top: 0.1rem;
    opacity: 0.8;
}

/* Avis de protection des renseignements personnels (Loi 25) : long, donc défilant. */
.folks-ats-form__consent-text {
    border: 1px solid var(--folks-ats-border);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem 0 0.5rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.75rem;
}

.folks-ats-form__consent-text ul {
    list-style: disc;
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.folks-ats-form__consent-text a {
    text-decoration: underline;
}

.folks-ats-form__consent {
    align-items: center;
    display: flex;
    gap: 0.6rem;
    margin: 0 0 1rem;
}

.folks-ats-form__consent {
    cursor: pointer;
    position: relative;
}

.folks-ats-form__consent-input {
    height: 1.25rem;
    left: 0;
    margin: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 1.25rem;
}

.folks-ats-form__box {
    background: #fff;
    border: 2px solid var(--folks-ats-accent);
    border-radius: 0.2rem;
    box-sizing: border-box;
    display: inline-block;
    flex: none;
    height: 1.25rem;
    width: 1.25rem;
}

.folks-ats-form__consent-input:checked + .folks-ats-form__box {
    background: var(--folks-ats-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E") center / 85% no-repeat;
}

.folks-ats-form__consent-input:focus-visible + .folks-ats-form__box {
    outline: 2px solid var(--folks-ats-accent);
    outline-offset: 2px;
}

.folks-ats-form__group select {
    background: #fff;
    border: 1px solid var(--folks-ats-border);
    border-radius: 0.1rem;
    box-sizing: border-box;
    color: inherit;
    font: inherit;
    padding: 0.35rem 0.5rem;
    width: 100%;
}
