/* CSS for form components */

/* Form Field Container - Clean and simple */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 50%;
}

/* Full width form field for single column items */
.form-field.full-width {
    width: 100%;
}

/* Label styling */
.form-field label {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 16px;
    color: var(--color-black);
    margin: 0;
    padding: 0;
}

/* Labels spécifiques pour les champs deadline avec font-weight plus léger */
.form-field input[name*="deadline_from"]+label,
.form-field input[name*="deadline_to"]+label,
.form-field:has(input[name*="deadline_from"]) label,
.form-field:has(input[name*="deadline_to"]) label {
    font-weight: 400;
}

/* Input and Select styling - Same style as buttons and dates */
.form-field input,
.form-field select {
    background-color: var(--color-white);
    color: var(--color-black);
    border: 1px solid var(--color-grey-light);
    border-radius: 999px;
    /* même arrondi que bouton */
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-family: var(--font-main);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Hover states */
.form-field__input:hover,
.form-field:hover {
    border-color: var(--color-grey-dark);
}

/* Date Input Styles - Target the actual HTML structure */
input[type="date"] {
    background-color: var(--color-white);
    color: var(--color-black);
    border: 1px solid var(--color-grey-light);
    border-radius: 999px;
    /* même arrondi que bouton */
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-family: var(--font-main);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* Focus */
.form-field input[type="date"]:focus {
    border-color: var(--color-purple-blue);
    box-shadow: 0 0 0 3px rgba(134, 152, 255, 0.25);
    /* glow subtil */
}

/* Disabled state */
.form-field input[type="date"]:disabled {
    background-color: var(--color-grey-light);
    color: var(--color-grey-dark);
    cursor: not-allowed;
}

/* For consistent calendar icon styling in browsers */
.form-field input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.4);
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 17px;
    height: 17px;
}

.form-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Firefox support */
.form-field input[type="date"]::-moz-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.4);
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 17px;
    height: 17px;
}

.form-field input[type="date"]::-moz-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Date input placeholder styling */
.form-field input[type="date"]::-webkit-datetime-edit {
    color: #B3B3B3;
    font-family: var(--font-main);
    font-weight: 400;
}

.form-field input[type="date"]:not([value=""])::-webkit-datetime-edit {
    color: var(--color-black);
}

/* Firefox date edit styling */
.form-field input[type="date"]::-moz-datetime-edit {
    color: var(--color-black);
    font-family: var(--font-main);
    font-weight: 400;
    border: none;
    background: transparent;
    padding: 0;
}




/* Placeholder styling */
.form-field__select::placeholder {
    color: #B3B3B3;
    font-family: var(--font-main);
    font-weight: 400;
}

/* Form layout */
.form-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 5px;
    align-items: flex-start;
    padding: 0px 20px;
}

.end-short-list {
    margin-bottom: 5px;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Special form row for actions */
.form-row:has(a[data-action*="switchMoreFilters"]) {
    justify-content: space-between;
    align-items: center;
}

.form-row:has(a[data-action*="switchMoreFilters"])>div {
    display: flex;
    gap: 10px;
}



/* Funding choices styling */
.funding-field {
    width: 100%;
}

.funding-choices {
    gap: 12px;
    width: 100%;
    padding-left: 15px;
    margin-bottom: 5px;
}

/* Bootstrap-like form-check styling */
.funding-choices .form-check {
    display: inline-block;
    margin-right: 20px;
    white-space: nowrap;
}

.funding-choices .form-check:last-child {
    margin-right: 0;
}

.funding-choices .form-check input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.funding-choices .form-check label {
    font-family: var(--font-main);
    font-weight: 400;
    font-size: 14px;
    color: var(--color-black);
    margin: 0;
    padding: 0 0 0 8px;
    cursor: pointer;
    white-space: nowrap;
}

.search-end-container {
    padding: 0 20px 5px;
}

.form-sumbit-button {
    text-align: right;
}

/* Style spécifique quand .select__inner est dans .form-field */
.form-field .select__inner {
    border: none;
    /* Supprime la bordure noire */
    min-width: auto;
}

/* Style pour l'input de recherche de Choices.js dans .form-field */
.form-field .choices__input--cloned {
    min-width: auto !important;
    width: 100% !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-field {
        width: 100%;
    }

    .form-field__input {
        width: 100%;
        max-width: 255px;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .form-buttons {
        justify-content: center;
    }

    /* Funding choices responsive - switch to vertical layout on mobile */
    .funding-choices .form-check {
        display: block;
        margin-right: 0;
        margin-bottom: 12px;
        width: 100%;
    }

    .funding-choices .form-check:last-child {
        margin-bottom: 0;
    }
}

/* Checkbox field styling */
.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-field input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-field label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
}

/* Show closed checkbox interaction with deadline_from field */
/* When show_closed is checked, disable deadline_from field */
.form-row:has(input[name*="show_closed"]:checked) input[name*="deadline_from"] {
    background-color: var(--color-grey-light) !important;
    color: var(--color-grey-dark) !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    pointer-events: none !important;
}

/* Ensure the disabled state is properly applied */
.form-row:has(input[name*="show_closed"]:checked) input[name*="deadline_from"]:disabled {
    background-color: var(--color-grey-light) !important;
    color: var(--color-grey-dark) !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    pointer-events: none !important;
}