/* ==========================================================================
   Field hover / focus / open: a subtle light-gray shadow, no coloured or darker border.

   The light-green 3px ring and green / dark borders around inputs and dropdown fields on hover,
   focus and while a dropdown is open came from several layers at once (input-controls.css's
   global rule, app.css page and dark-theme blocks, business-profile.css under #bpWorkspace, the
   newer page layers, and app.css's 3px :focus-visible outline), several with !important and one
   ID-scoped. Rather than edit each, this file loads last on every page (base.html and the auth
   pages) and wins once: the never-matching #wz-field-focus inside each :is() lifts these
   selectors to ID specificity.

   Interactive state = :hover, :focus, :focus-visible, or an open dropdown (.active / .open /
   aria-expanded="true"). The border stays light gray in every state; the soft shadow is what
   shows the field is hovered / focused.
   ========================================================================== */

:root {
    --wz-field-border: #e2e8f0;
    --wz-field-shadow: 0 0 0 3px rgba(15, 23, 42, .06);
}

html[data-theme="dark"] {
    --wz-field-border: rgba(255, 255, 255, .14);
    --wz-field-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
}

/* Text fields, selects and dropdown-style triggers */
html body :is(#wz-field-focus,
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="hidden"]),
    select, textarea, .form-control, .form-select,
    [class*="dropdown-trigger"], .time-picker-trigger, .bc-select-trigger
):not(:disabled):not([readonly]):not(.is-invalid):not([aria-invalid="true"]):is(:hover, :focus, :focus-visible, .active, .open, [aria-expanded="true"]),
html body :is(#wz-field-focus, .open, .active, .show) > :is([class*="dropdown-trigger"], .time-picker-trigger) {
    border-color: var(--wz-field-border) !important;
    box-shadow: var(--wz-field-shadow) !important;
    outline: none !important;
}

/* Fields drawn with an inset box-shadow instead of a border: keep that 1px line under the shadow. */
html body :is(#wz-field-focus, .wzl .search-input, .wzl .dropdown-trigger, .cx .search-input, .cx .ci-tag-select,
    .cx .ci-notes-input, .fb-search-input, .fb-select, .fu-search-input, .cs-field .form-select,
    .cs-field .form-control, .rr-page .dropdown-trigger
):not(:disabled):not([readonly]):not(.is-invalid):not([aria-invalid="true"]):is(:hover, :focus, :focus-visible, .active, .open, [aria-expanded="true"]) {
    box-shadow: inset 0 0 0 1px var(--wz-field-border), var(--wz-field-shadow) !important;
}

/* Wrapper boxes that act as a single field (tag box, editors, chip inputs, …). Their inner
   inputs are borderless, so they only lose the glow above; the wrapper carries the shadow. */
html body :is(#wz-field-focus, .cit-box, .composer-container, .editor-wrapper, .adc-tag-wrapper,
    .variant-chip-input, .dof-percent-field, .related-reason-wrap, .apt-table-search
):is(:hover, :focus-within) {
    border-color: var(--wz-field-border) !important;
    box-shadow: var(--wz-field-shadow) !important;
    outline: none !important;
}

html body :is(#wz-field-focus, .cit-box, .composer-container, .editor-wrapper, .adc-tag-wrapper,
    .variant-chip-input, .dof-percent-field, .related-reason-wrap, .apt-table-search
) :is(input, textarea):not(:disabled):not([readonly]):not(.is-invalid):not([aria-invalid="true"]):is(:hover, :focus, :focus-visible) {
    box-shadow: none !important;
}

html body :is(#wz-field-focus, .chat-container .search-wrapper):is(:hover, :focus-within) {
    box-shadow: inset 0 0 0 1px var(--wz-field-border), var(--wz-field-shadow) !important;
    outline: none !important;
}

html body :is(#wz-field-focus, .chat-container .search-wrapper) :is(input):not(:disabled):not([readonly]):not(.is-invalid):not([aria-invalid="true"]):is(:hover, :focus, :focus-visible) {
    box-shadow: none !important;
}

/* KPI tiles (Customers, Campaigns, Live Agent, Orders, Appointment, Follow-ups, Wallet, …):
   no outline when clicked. Several old rules drew a 2px green outline on :focus / :focus-visible
   around the whole tile. Keyboard focus shows as a soft gray background instead. */
html body :is(#wz-field-focus, .stat-card, .apt-stat-card, .fu-stat-card):is(:focus, :focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

html body :is(#wz-field-focus, .stat-card, .apt-stat-card, .fu-stat-card):focus-visible {
    background: rgba(15, 23, 42, .035) !important;
}

html[data-theme="dark"] body :is(#wz-field-focus, .stat-card, .apt-stat-card, .fu-stat-card):focus-visible {
    background: rgba(255, 255, 255, .04) !important;
}

/* ---- Tabs: one soft segmented control everywhere (no green underline) ----
   Filters/Sorting/Columns popovers, editor section navs (Products, Services,
   Settings, Business profile), Attendance, Customer bookings. Chat's filled
   filter buttons are a different control and are left alone. */
html body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs),
html body:not(.page-chat) :is(#wz-tabs, .filter-tabs) {
    display: inline-flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px !important;
    width: auto !important;
    max-width: 100%;
    padding: 2px !important;
    border: 0 !important;
    border-radius: 8px;
    background: rgba(15, 23, 42, .05) !important;
    box-shadow: none !important;
    list-style: none;
}

html body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab, .att-tab, .ci-history-tab, .bp-step-item, .step-item),
html body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.85rem !important;
    margin: 0 !important;
    padding: 0 .8rem !important;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #64748b !important;
    font-size: .78rem !important;
    font-weight: 500 !important;
    text-align: center;
    white-space: nowrap;
    transform: none !important;
    transition: background-color .15s ease, color .15s ease;
}

html body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab, .att-tab, .ci-history-tab, .bp-step-item, .step-item):hover,
html body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab:hover {
    color: #0f172a !important;
}

html body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab.is-active, .att-tab.is-active, .ci-history-tab[aria-selected="true"], .bp-step-item.bp-active, .step-item.active),
html body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab.is-active {
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08) !important;
    color: #0f172a !important;
}

html[data-theme="dark"] body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs),
html[data-theme="dark"] body:not(.page-chat) :is(#wz-tabs, .filter-tabs) {
    background: rgba(255, 255, 255, .06) !important;
}

html[data-theme="dark"] body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab, .att-tab, .ci-history-tab, .bp-step-item, .step-item),
html[data-theme="dark"] body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab {
    color: #94a3b8 !important;
}

html[data-theme="dark"] body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab, .att-tab, .ci-history-tab, .bp-step-item, .step-item):hover,
html[data-theme="dark"] body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab:hover {
    color: #e2e8f0 !important;
}

html[data-theme="dark"] body :is(#wz-tabs, .utt-tabs, .att-tabs, .ci-history-tabs, .bp-steps, .product-steps, .service-steps) > :is(.utt-tab.is-active, .att-tab.is-active, .ci-history-tab[aria-selected="true"], .bp-step-item.bp-active, .step-item.active),
html[data-theme="dark"] body:not(.page-chat) :is(#wz-tabs, .filter-tabs) > .filter-tab.is-active {
    background: rgba(255, 255, 255, .12) !important;
    box-shadow: none !important;
    color: #f1f5f9 !important;
}

/* Editor section navs: a compact segmented bar on desktop; inside the
   mobile "Menu" drawer they stay a 2-column grid with no tray. */
@media (min-width: 761px) {
    html body :is(#wz-tabs, .bp-steps, .product-steps, .service-steps) {
        display: inline-flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 2px !important;
        width: auto !important;
        max-width: 100%;
        padding: 2px !important;
        border: 0 !important;
        border-radius: 8px;
        background: rgba(15, 23, 42, .05) !important;
        box-shadow: none !important;
        overflow-x: auto;
    }

    html[data-theme="dark"] body :is(#wz-tabs, .bp-steps, .product-steps, .service-steps) {
        background: rgba(255, 255, 255, .06) !important;
    }
}

@media (max-width: 760px) {
    html body :is(#wz-tabs, .bp-steps, .product-steps, .service-steps) > :is(.bp-step-item, .step-item) {
        min-height: 44px !important;
        white-space: normal;
    }

    html body :is(#wz-tabs, .bp-steps, .product-steps, .service-steps) > :is(.bp-step-item.bp-active, .step-item.active) {
        background: rgba(15, 23, 42, .06) !important;
        box-shadow: none !important;
    }

    html[data-theme="dark"] body :is(#wz-tabs, .bp-steps, .product-steps, .service-steps) > :is(.bp-step-item.bp-active, .step-item.active) {
        background: rgba(255, 255, 255, .1) !important;
    }
}
