/*
 * NOVA Filters widget — base styles
 */

.nova-filters-form {
    --nova-filters-cols: 12;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

/* The FOUC prevention is now handled globally at the Elementor widget wrapper level
   (see add_js_detection_script() + widget-reveal.js). The data-nova-state attribute
   may still be set on the form for backwards compat, but it no longer drives visibility. */

.nova-filters-fields {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.nova-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    grid-column: span 12;
    min-width: 0;
    position: relative;
}

.nova-filter-field--w-3  { grid-column: span 3; }
.nova-filter-field--w-4  { grid-column: span 4; }
.nova-filter-field--w-6  { grid-column: span 6; }
.nova-filter-field--w-8  { grid-column: span 8; }
.nova-filter-field--w-9  { grid-column: span 9; }
.nova-filter-field--w-12 { grid-column: span 12; }

@media (max-width: 1024px) {
    .nova-filter-field--w-3,
    .nova-filter-field--w-4 { grid-column: span 6; }
    .nova-filter-field--w-8,
    .nova-filter-field--w-9 { grid-column: span 12; }
}

@media (max-width: 600px) {
    .nova-filter-field { grid-column: span 12; }
}

.nova-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    line-height: 1.2;
}

.nova-filter-required {
    color: #d92121;
    font-weight: 700;
}

.nova-filter-input,
.nova-filter-select,
.nova-filter-textarea {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #d6d6d6;
    border-radius: 8px;
    background-color: #ffffff;
    color: inherit;
    font: inherit;
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.nova-filter-textarea {
    resize: vertical;
    min-height: 80px;
}

/* .nova-filter-select {
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                      linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 36px;
} */

.nova-filter-input:focus,
.nova-filter-select:focus,
.nova-filter-textarea:focus {
    outline: none;
    border-color: #01ABC4;
    box-shadow: 0 0 0 3px rgba(6, 102, 221, 0.18);
}

.nova-filter-input--range {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    height: 24px;
}

/* ----- Range (noUiSlider) — trigger like NiceSelect ----- */
.nova-filter-field--range {
    position: relative;
}

.nova-filter-field--range:has(.nova-filter-range.open) {
    z-index: 60;
}

.nova-filter-range {
    position: relative;
    width: 100%;
}

.nova-filter-range-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 36px 10px 14px;
    margin: 0;
    border: 1px solid #d6d6d6;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: none;
    font: inherit;
    font-size: inherit;
    font-weight: 500;
    line-height: 1.4;
    color: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.nova-filter-range-trigger:hover,
.nova-filter-range.open .nova-filter-range-trigger,
.nova-filter-range-trigger:focus {
    outline: none;
    border-color: #01ABC4;
    box-shadow: 0 0 0 3px rgba(6, 102, 221, 0.18);
}

.nova-filter-range-trigger::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -6px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    pointer-events: none;
    transition: transform 0.15s ease;
}

.nova-filter-range.open .nova-filter-range-trigger::after {
    transform: rotate(-135deg);
    margin-top: -2px;
}

.nova-filter-range-display {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 1.3em;
}

.nova-filter-range-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1000;
    padding: 16px 18px 18px;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    min-width: 260px;
}

.nova-filter-range-panel[hidden] {
    display: none !important;
}

.nova-filter-range-track {
    height: 6px;
    margin: 4px 4px 2px;
}

.nova-filter-range-track .noUi-target {
    background: #e8eaf3;
    border: none;
    border-radius: 999px;
    box-shadow: none;
}

.nova-filter-range-track .noUi-connect {
    background: #01ABC4;
}

.nova-filter-range-track .noUi-handle {
    width: 20px;
    height: 20px;
    right: -10px;
    top: -7px;
    border-radius: 50%;
    border: 2px solid #01ABC4;
    background: #fff;
    box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
    cursor: grab;
}

.nova-filter-range-track .noUi-handle::before,
.nova-filter-range-track .noUi-handle::after {
    display: none;
}

.nova-filter-range-track .noUi-handle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 102, 221, 0.2);
}

.nova-filter-radio-group,
.nova-filter-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.nova-filter-radio,
.nova-filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
}

.nova-filter-radio input,
.nova-filter-checkbox input {
    margin: 0;
    cursor: pointer;
}

.nova-filter-help {
    display: block;
    font-size: 0.85em;
    color: #6b6b6b;
    line-height: 1.4;
}

/* ----- Actions ----- */
.nova-filters-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nova-filters-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: 8px;
    background-color: #01ABC4;
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
}

.nova-filters-submit:hover,
.nova-filters-submit:focus {
    background-color: #0552b3;
    outline: none;
}

.nova-filters-submit:active {
    transform: translateY(1px);
}

.nova-filters-submit--full { flex: 1 1 100%; }
.nova-filters-submit--half { flex: 1 1 50%; }
.nova-filters-submit--auto { flex: 0 0 auto; }

.nova-filters-submit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nova-filters-submit-icon i,
.nova-filters-submit-icon svg {
    font-size: 1em;
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Icon-only submit (square button) */
.nova-filters-submit.nova-filters-submit--icon-only {
    gap: 0;
    padding: 12px;
    aspect-ratio: 1 / 1;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
}

.nova-filters-submit.nova-filters-submit--icon-only .nova-filters-submit-icon {
    font-size: 1.2em;
}

.nova-filters-reset {
    appearance: none;
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #6b6b6b;
    font: inherit;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.nova-filters-reset:hover,
.nova-filters-reset:focus {
    color: #d92121;
    outline: none;
}

/* ----- NiceSelect2 — structure partagée Nova Cards (.nova-cards-meta-filter--nice) ----- */
.nova-filter-field--select .nova-cards-meta-filter,
.nova-filter-field--multiselect .nova-cards-meta-filter {
    width: 100%;
}

.nova-filter-field--select .nova-cards-meta-filter__body,
.nova-filter-field--multiselect .nova-cards-meta-filter__body {
    width: 100%;
}

.nova-filter-field--select .nova-cards-meta-filter__control,
.nova-filter-field--multiselect .nova-cards-meta-filter__control {
    width: 100%;
}

/* Styles pill / liste déroulante : voir nova-cards-style.css */

/* ----- Flatpickr integration ----- */
.nova-filter-field .flatpickr-input,
.nova-filter-field input.flatpickr-input.form-control.input {
    background-color: #ffffff;
}

.flatpickr-calendar {
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid #e6e6e6;
    font-family: inherit;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #01ABC4;
    border-color: #01ABC4;
}

.flatpickr-day.today {
    border-color: #01ABC4;
    color: #01ABC4;
}

.flatpickr-day.today:hover {
    background: rgba(6, 102, 221, 0.12);
    color: #01ABC4;
}

.flatpickr-months .flatpickr-month,
.flatpickr-weekdays {
    color: #222222;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-weight: 600;
}

/* When using flatpickr's static:true the calendar is positioned absolutely relative
   to the field wrapper. Ensure it floats above siblings and has enough z-index. */
.nova-filter-field .flatpickr-calendar.static {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
}

.nova-filter-field .flatpickr-calendar.static.open {
    z-index: 1000;
}

/* Native radio / checkbox baseline so accent-color works visibly */
.nova-filter-radio input[type="radio"],
.nova-filter-checkbox input[type="checkbox"] {
    accent-color: #01ABC4;
    flex-shrink: 0;
}
