/*
 * Interaction details shared by every form control.
 *
 * Filament's searchable / non-native selects (period filter, client, currency, language...)
 * are Choices.js widgets. Their closed box and their options are plain <div>s, so the browser
 * shows the default arrow instead of a pointer. Native <select>s already have one.
 */

/* Closed select box: the whole control opens the list. */
.choices[data-type*="select-one"] .choices__inner,
.choices[data-type*="select-one"] .choices__list--single,
.choices[data-type*="select-one"] .choices__list--single .choices__item,
.choices[data-type*="select-multiple"] .choices__inner,
.choices .choices__button,
.choices .choices__item--selectable {
    cursor: pointer;
}

/* Options in the open list. */
.choices__list--dropdown .choices__item--selectable,
.choices__list[aria-expanded] .choices__item--selectable {
    cursor: pointer;
}

/* The search box inside an open list is a text field, not a button. */
.choices__input--cloned,
.choices__list--dropdown .choices__input {
    cursor: text;
}

/* A disabled select must not look clickable. */
.choices.is-disabled .choices__inner,
.choices.is-disabled .choices__item,
.choices.is-disabled .choices__list--single {
    cursor: not-allowed;
}

/* Native selects and the other click targets of a form. */
select:not(:disabled),
input[type="checkbox"]:not(:disabled),
input[type="radio"]:not(:disabled),
input[type="date"]:not(:disabled)::-webkit-calendar-picker-indicator,
label[for]:has(input[type="checkbox"]),
label[for]:has(input[type="radio"]) {
    cursor: pointer;
}

/* Round (avatar) uploads, e.g. a business logo: a small circle, not one as wide as the whole form. */
.fi-fo-file-upload .filepond--root[data-style-panel-layout~='circle'] {
    width: 9rem;
    max-width: 100%;
}

/* "Back to dashboard" on the Register business page: a real button (outlined, with its arrow), arrow turned round in right-to-left. */
.nf-back-btn { white-space: nowrap; }
[dir='rtl'] .nf-back-btn .fi-btn-icon { transform: scaleX(-1); }

/* Employee permissions: one card per screen, as many side by side as fit. */
.nf-perm-cards > .grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)) !important; gap: 1rem; align-items: start; }
.nf-perm-cards > .grid > * { grid-column: auto !important; }

/*
 * Forms on a wide screen show at least three fields per row: a form grid Filament lays out in two columns from a laptop up
 * becomes three. (Single-column groups stay as they are, and so do modals, which are narrow.)
 */
@media (min-width: 1024px) {
    .fi-page .fi-fo-component-ctn[style*="--cols-lg: repeat(2,"],
    .fi-page .fi-fo-grid[style*="--cols-lg: repeat(2,"],
    .fi-page .fi-section-content .grid[style*="--cols-lg: repeat(2,"] { --cols-lg: repeat(3, minmax(0, 1fr)) !important; }

    .fi-modal-window .fi-fo-component-ctn[style*="--cols-lg: repeat(2,"],
    .fi-modal-window .fi-fo-grid[style*="--cols-lg: repeat(2,"],
    .fi-modal-window .fi-section-content .grid[style*="--cols-lg: repeat(2,"] { --cols-lg: repeat(2, minmax(0, 1fr)) !important; }

    /* Except where a card asks for two (class nf-two-per-row): the Income / Expense cards of revenues and expenses. */
    .fi-page .nf-two-per-row .fi-fo-component-ctn[style*="--cols-lg: repeat(2,"],
    .fi-page .nf-two-per-row .fi-fo-grid[style*="--cols-lg: repeat(2,"],
    .fi-page .nf-two-per-row.fi-section .fi-section-content .grid[style*="--cols-lg: repeat(2,"],
    .fi-page .nf-two-per-row .fi-section-content .grid[style*="--cols-lg: repeat(2,"] { --cols-lg: repeat(2, minmax(0, 1fr)) !important; }
}

/*
 * Every dropdown list looks like the language menu of the top bar (nero-sidebar.css, .nf-lang-panel): a rounded panel with a soft shadow,
 * one column of rounded rows, the row under the pointer tinted, the chosen one in the theme colour with a tick, a thin scrollbar.
 * - Filament's selects (all non-native, AppServiceProvider): Choices.js lists (.choices__list--dropdown).
 * - Hand-written <select>s: turned into the same list by public/js/nero-select.js (.nf-sel-*).
 */
html.fi .choices__list--dropdown,
html.fi .choices__list[aria-expanded],
.nf-sel-panel {
    border-radius: 0.875rem !important;
    border: 1px solid rgba(var(--gray-950), 0.06) !important;
    background: #fff !important;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.06) !important;
    overflow: hidden;
    margin-top: 0.35rem !important;
}

html.fi .choices__list--dropdown .choices__list,
html.fi .choices__list[aria-expanded] .choices__list,
.nf-sel-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.35rem !important;
    max-height: min(17rem, 60vh) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--gray-500), 0.28) transparent;
}

html.fi .choices__list--dropdown .choices__list::-webkit-scrollbar,
.nf-sel-list::-webkit-scrollbar { width: 4px; }
html.fi .choices__list--dropdown .choices__list::-webkit-scrollbar-thumb,
.nf-sel-list::-webkit-scrollbar-thumb { background: rgba(var(--gray-500), 0.28); border-radius: 999px; }

html.fi .choices__list--dropdown .choices__item,
html.fi .choices__list[aria-expanded] .choices__item,
.nf-sel-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem !important;
    padding-inline-start: 2rem !important; /* room for the tick */
    border-radius: 0.55rem;
    font-size: 0.875rem;
    line-height: 1.3;
    color: rgb(var(--gray-700));
    background: transparent;
    text-align: start;
    width: 100%;
}

/* The row under the pointer / keyboard. */
html.fi .choices__list--dropdown .choices__item--selectable.is-highlighted,
html.fi .choices__list[aria-expanded] .choices__item--selectable.is-highlighted,
.nf-sel-item:hover,
.nf-sel-item:focus-visible {
    background: rgba(var(--gray-950), 0.04) !important;
    color: rgb(var(--gray-950));
    outline: none;
}

/* The chosen one: tinted in the theme colour, with a tick at the start. */
html.fi .choices__list--dropdown .choices__item[aria-selected="true"]:not(.is-highlighted),
html.fi .choices__list--dropdown .choices__item.is-selected,
.nf-sel-item.is-selected {
    background: rgba(var(--primary-500), 0.1) !important;
    color: rgb(var(--primary-700)) !important;
    font-weight: 600;
}

html.fi .choices__list--dropdown .choices__item.is-selected::before,
.nf-sel-item.is-selected::before {
    content: '';
    position: absolute;
    inset-inline-start: 0.7rem;
    top: 50%;
    width: 0.8rem;
    height: 0.8rem;
    transform: translateY(-50%);
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M16.7 5.3a1 1 0 0 1 0 1.4l-8 8a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.4L8 12.6l7.3-7.3a1 1 0 0 1 1.4 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M16.7 5.3a1 1 0 0 1 0 1.4l-8 8a1 1 0 0 1-1.4 0l-4-4a1 1 0 1 1 1.4-1.4L8 12.6l7.3-7.3a1 1 0 0 1 1.4 0Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* "No results" / "Loading" lines and group headings stay quiet. */
html.fi .choices__list--dropdown .choices__item.has-no-results,
html.fi .choices__list--dropdown .choices__item.has-no-choices,
html.fi .choices__list--dropdown .choices__heading { color: rgb(var(--gray-500)); font-weight: 500; }
html.fi .choices__list--dropdown .choices__heading { padding: 0.5rem 0.7rem 0.25rem !important; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; border: 0; }

/* The search box at the top of a searchable list. */
html.fi .choices__list--dropdown .choices__input {
    margin: 0.35rem 0.35rem 0 !important;
    width: calc(100% - 0.7rem) !important;
    border-radius: 0.55rem !important;
    border: 1px solid rgba(var(--gray-950), 0.1) !important;
    background: rgba(var(--gray-950), 0.02) !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.8125rem;
}

/* Dark mode. */
html.fi.dark .choices__list--dropdown,
html.fi.dark .choices__list[aria-expanded],
html.dark .nf-sel-panel {
    background: rgb(var(--gray-900)) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6) !important;
}
html.fi.dark .choices__list--dropdown .choices__item,
html.dark .nf-sel-item { color: rgb(var(--gray-300)); }
html.fi.dark .choices__list--dropdown .choices__item--selectable.is-highlighted,
html.dark .nf-sel-item:hover { background: rgba(255, 255, 255, 0.06) !important; color: #fff; }
html.fi.dark .choices__list--dropdown .choices__item.is-selected,
html.dark .nf-sel-item.is-selected { background: rgba(var(--primary-400), 0.18) !important; color: rgb(var(--primary-300)) !important; }
html.fi.dark .choices__list--dropdown .choices__input { border-color: rgba(255, 255, 255, 0.1) !important; background: rgba(255, 255, 255, 0.04) !important; }

/* ---- hand-written <select>s (nero-select.js): the list is placed in <body>, under (or above) its select. ---- */
.nf-sel-panel { position: fixed; z-index: 60; min-width: 8rem; margin-top: 0 !important; font-family: inherit; }
.nf-sel-item { border: 0; cursor: pointer; font-family: inherit; }

/*
 * Revenue / expense Amount card: the first amount (currency, amount, exchange rate) sits in the same bordered,
 * rounded card as the "Add another amount" lines below it (LedgerForm::money).
 */
.nf-amount-card {
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
    padding: 1rem;
    background: #fff;
}

.dark .nf-amount-card {
    border-color: rgb(255 255 255 / 0.1);
    background: rgb(255 255 255 / 0.03);
}

/*
 * Date picker calendar: the month and the year (a dropdown too, public/js/nero-datepicker.js) as two soft pills in the theme
 * colour, side by side at the top of the calendar.
 */
.fi-fo-date-time-picker select[x-model="focusedMonth"],
.fi-fo-date-time-picker select.nf-dp-year {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 0;
    width: auto;
    min-width: 0;
    border: 1px solid rgb(var(--primary-200));
    border-radius: 0.6rem;
    padding: 0.35rem 1.9rem 0.35rem 0.7rem;
    background-color: rgb(var(--primary-50));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-opacity='.45' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 0.95rem;
    color: rgb(var(--primary-700));
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.fi-fo-date-time-picker select[x-model="focusedMonth"]:hover,
.fi-fo-date-time-picker select.nf-dp-year:hover {
    background-color: rgb(var(--primary-100));
    border-color: rgb(var(--primary-300));
}

.fi-fo-date-time-picker select[x-model="focusedMonth"]:focus,
.fi-fo-date-time-picker select.nf-dp-year:focus {
    outline: none;
    border-color: rgb(var(--primary-400));
    box-shadow: 0 0 0 3px rgba(var(--primary-500), 0.18);
}

/* The month on one side, the year on the other, with room between. */
.fi-fo-date-time-picker div:has(> select[x-model="focusedMonth"]) {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.fi-fo-date-time-picker select[x-model="focusedMonth"] option,
.fi-fo-date-time-picker select.nf-dp-year option {
    background: #fff;
    color: rgb(17 24 39);
    font-weight: 500;
}

[dir="rtl"] .fi-fo-date-time-picker select[x-model="focusedMonth"],
[dir="rtl"] .fi-fo-date-time-picker select.nf-dp-year {
    padding: 0.35rem 0.7rem 0.35rem 1.9rem;
    background-position: left 0.55rem center;
}

.dark .fi-fo-date-time-picker select[x-model="focusedMonth"],
.dark .fi-fo-date-time-picker select.nf-dp-year {
    border-color: rgba(var(--primary-500), 0.3);
    background-color: rgba(var(--primary-500), 0.14);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-opacity='.6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    color: rgb(var(--primary-300));
}

.dark .fi-fo-date-time-picker select[x-model="focusedMonth"]:hover,
.dark .fi-fo-date-time-picker select.nf-dp-year:hover {
    background-color: rgba(var(--primary-500), 0.22);
}

.dark .fi-fo-date-time-picker select[x-model="focusedMonth"] option,
.dark .fi-fo-date-time-picker select.nf-dp-year option {
    background: rgb(17 24 39);
    color: #fff;
}
