/*
 * NOVA Filters widget — base styles
 */

.nova-filters-form {
    --nova-filters-cols: 12;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    transition: opacity 0.18s ease;
}

/* Hide form until JS has enhanced selects / date inputs, to prevent FOUC.
   The "loading" state is only set in PHP when an enhancement is actually going to run. */
.nova-filters-form[data-nova-state="loading"] {
    opacity: 0;
    visibility: hidden;
}

.nova-filters-form[data-nova-state="ready"] {
    opacity: 1;
    visibility: visible;
}

.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;
}

.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 integration ----- */
.nova-filter-field .nice-select {
    width: 100%;
    height: auto;
    padding: 10px 36px 10px 14px;
    border: 1px solid #d6d6d6;
    background-color: #ffffff;
    color: inherit;
    font: inherit;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select.nova-filter-select {
    display: none;
}
.nice-select .nice-select-dropdown {
    width: 100%;
}

.nova-filter-field .nice-select .list {
    width: 100%;
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    box-shadow: none;
    border: none;
}
.nova-filter-field .nice-select .option {
    padding: 10px 14px;
    line-height: 1.4;
    min-height: 0;
}

.nova-filter-field .nice-select .option.selected.focus,
.nova-filter-field .nice-select .option.focus,
.nova-filter-field .nice-select .option:hover {
    background-color: rgba(6, 102, 221, 0.08);
    color: #01ABC4;
}

.nova-filter-field .nice-select .option.selected {
    font-weight: 600;
}

/* When NiceSelect is mounted, hide the original <select> (NiceSelect handles this itself but we make it explicit). */
.nova-filter-field select.nova-filter-select + .nice-select {
    margin-top: 0;
}

/* ----- 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;
}

/* Range slider baseline */
.nova-filter-input--range {
    accent-color: #01ABC4;
    height: 4px;
}
