/* ── Multiselect optgroup labels ──────────────────────────────────────────── */

.ms-options li.optgroup > span {
    padding-left: 8px !important;
}

.ui-autocomplete {
    font-size: 14px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── [appcast_search_autocomplete] shortcode ────────────────────────────────── */

.appcast-ac-wrap {
    position: relative;
    width: 100%;
    z-index: 1000;
}

.appcast-ac-form {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.appcast-ac-field-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.appcast-ac-search-icon,
.appcast-ac-location-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY( -50% );
    color: #888;
    pointer-events: none;
    display: inline-flex;
}

.appcast-ac-wrap input.appcast-ac-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 44px 12px 48px !important;
    font-size: 16px;
    line-height: 1.4;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff !important;
    color: #222 !important;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.appcast-ac-input:focus {
    border-color: #666;
    box-shadow: 0 0 0 3px rgba( 0, 0, 0, 0.06 );
}

.appcast-ac-clear {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY( -50% );
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.appcast-ac-clear:hover {
    color: #333;
    background: #f0f0f0;
}

.appcast-ac-submit {
    flex: 0 0 auto;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    background: #1a1a1a;
    color: #fff;
    white-space: nowrap;
    transition: background 0.15s;
}

.appcast-ac-submit:hover {
    background: #000;
}

/* ── Dropdown ─────────────────────────────────────────────────────────────── */

.appcast-ac-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba( 0, 0, 0, 0.12 );
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 480px;
    overscroll-behavior: contain;
}

/* ── Item rows ────────────────────────────────────────────────────────────── */

.appcast-ac-item {
    position: relative;
    display: grid;
    grid-template-columns: 36px 1fr auto 20px;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 12px 18px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border-top: 1px solid #f3f3f3;
    transition: background 0.1s;
    text-align: left;
}

.appcast-ac-item * {
    text-align: inherit;
}

.appcast-ac-item:first-of-type {
    border-top: none;
}

.appcast-ac-item:hover,
.appcast-ac-item--active {
    background: #f3f7fc;
}

.appcast-ac-item--active::before {
    content: "";
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 0;
    width: 3px;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
}

.appcast-ac-item-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
    border-radius: 50%;
    color: #555;
}

.appcast-ac-item-icon svg {
    width: 18px;
    height: 18px;
}

.appcast-ac-item-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-self: start;
}

.appcast-ac-item-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appcast-ac-item-title mark {
    background: #fde68a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.appcast-ac-item-sub {
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appcast-ac-item-chips {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.appcast-ac-item-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    transform: translateX( -4px );
}

.appcast-ac-item-arrow svg {
    width: 18px;
    height: 18px;
}

.appcast-ac-item--active .appcast-ac-item-arrow {
    opacity: 1;
    transform: translateX( 0 );
}

/* ── Chips ────────────────────────────────────────────────────────────────── */

.appcast-ac-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
}

.appcast-ac-chip--job {
    background: #dcfce7;
    color: #15803d;
}

.appcast-ac-chip--location {
    background: #fee2e2;
    color: #b91c1c;
}

.appcast-ac-chip--page {
    background: #e5e7eb;
    color: #374151;
}

.appcast-ac-chip--extra {
    background: #fef3c7;
    color: #92400e;
}

.appcast-ac-chip--count {
    background: #fbbf24;
    color: #422006;
}

.appcast-ac-chip--recent {
    background: #e0e7ff;
    color: #3730a3;
}

/* ── Empty-state sections (RECENT / POPULAR) ─────────────────────────────── */

.appcast-ac-section {
    padding: 12px 16px;
    border-top: 1px solid #f3f3f3;
}

.appcast-ac-section:first-child {
    border-top: none;
}

.appcast-ac-section-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 10px;
}

.appcast-ac-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.appcast-ac-section-icon svg {
    width: 13px;
    height: 13px;
}

.appcast-ac-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.appcast-ac-chip-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #1f2937;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.3;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    cursor: pointer;
}

.appcast-ac-chip-link:hover,
.appcast-ac-chip-link.appcast-ac-chip-link--active {
    background: #f3f7fc;
    border-color: #93c5fd;
    color: #1e3a8a;
}

.appcast-ac-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.appcast-ac-chip-icon svg {
    width: 14px;
    height: 14px;
}

.appcast-ac-chip-label {
    white-space: nowrap;
}

.appcast-ac-chip-count {
    margin-left: 6px;
    padding-left: 8px;
    border-left: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Mobile (≤640px) — give the row more breathing room ──────────────────── */

@media ( max-width: 640px ) {
    .appcast-ac-form {
        gap: 6px;
    }

    .appcast-ac-wrap input.appcast-ac-input {
        padding: 10px 38px 10px 42px !important;
        font-size: 15px;
        border-radius: 6px;
    }

    .appcast-ac-search-icon {
        left: 12px;
    }

    .appcast-ac-clear {
        right: 8px;
    }

    .appcast-ac-submit {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 6px;
    }

    .appcast-ac-dropdown {
        max-height: 60vh;
    }

    /* Item rows: stack chips below the title so long section names don't squeeze it */
    .appcast-ac-item {
        grid-template-columns: 28px 1fr 16px;
        grid-template-areas:
            "icon text  arrow"
            ".    chips arrow";
        gap: 6px 10px;
        padding: 10px 12px 10px 14px;
    }

    .appcast-ac-item-icon {
        grid-area: icon;
        width: 28px;
        height: 28px;
    }

    .appcast-ac-item-icon svg {
        width: 15px;
        height: 15px;
    }

    .appcast-ac-item-text {
        grid-area: text;
    }

    .appcast-ac-item-title {
        font-size: 14px;
        white-space: normal; /* allow wrap on narrow viewports */
    }

    .appcast-ac-item-sub {
        font-size: 12px;
    }

    .appcast-ac-item-chips {
        grid-area: chips;
        justify-self: start;
        flex-wrap: wrap;
    }

    .appcast-ac-item-arrow {
        grid-area: arrow;
    }

    /* Cap chip width so something like "WINERIES & TASTING ROOM" truncates instead of pushing the layout */
    .appcast-ac-chip {
        max-width: 12em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Empty-state pills (recent / popular) also need smaller padding */
    .appcast-ac-section {
        padding: 10px 12px;
    }

    .appcast-ac-chip-link {
        padding: 5px 11px;
        font-size: 12px;
    }
}

/* ── Hide old group label (kept for safety if a cached HTML still references it) ─ */

.appcast-ac-group-label {
    display: none;
}

/* ── Results section header (typed state, both modes) ───────────────────── */

.appcast-ac-section--results > .appcast-ac-section-label {
    padding: 12px 16px 6px;
    margin-bottom: 0;
    border-top: 1px solid #f3f3f3;
    color: #6b7280;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.appcast-ac-section--results:first-child > .appcast-ac-section-label {
    border-top: none;
}

.appcast-ac-section-meta {
    margin-left: auto;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #9ca3af;
    text-transform: none;
}

.appcast-ac-rows {
    display: flex;
    flex-direction: column;
}

/* ── two-pane: left rail + right results pane ───────────────────────────── */

.appcast-ac-tp {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 280px;
}

.appcast-ac-tp-nav {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #f3f3f3;
    background: #fafafa;
    padding: 8px 0;
}

.appcast-ac-tp-nav-item {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    border-left: 3px solid transparent;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.appcast-ac-tp-nav-item:hover {
    background: #f3f7fc;
    color: #1e3a8a;
}

.appcast-ac-tp-nav-item--active {
    background: #fff;
    border-left-color: #4f46e5;
    color: #111827;
    font-weight: 600;
}

.appcast-ac-tp-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.appcast-ac-tp-nav-icon svg {
    width: 16px;
    height: 16px;
}

.appcast-ac-tp-nav-item--active .appcast-ac-tp-nav-icon {
    color: #4f46e5;
}

.appcast-ac-tp-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appcast-ac-tp-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba( 0, 0, 0, 0.06 );
    font-size: 11px;
    font-weight: 600;
    color: inherit;
}

.appcast-ac-tp-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.appcast-ac-tp-pane-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 12px 16px 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.appcast-ac-tp-pane-meta {
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    text-transform: none;
    letter-spacing: 0;
}

.appcast-ac-tp-pane-more {
    display: block;
    padding: 10px 16px 12px;
    color: #4f46e5;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    text-align: right;
    border-top: 1px solid #f3f3f3;
    margin-top: auto;
    transition: color 0.1s, background 0.1s;
}

.appcast-ac-tp-pane-more:hover {
    color: #3730a3;
    background: #f5f3ff;
    text-decoration: underline;
}

.appcast-ac-item--rich {
    grid-template-columns: 36px 1fr auto 20px;
    border-top: none;
}

.appcast-ac-item--rich + .appcast-ac-item--rich {
    border-top: 1px solid #f7f7f7;
}

.appcast-ac-item-count {
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
}

/* ── Default (scoped) mode: filter pills + tagged rows ──────────────────── */

.appcast-ac-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f3f3f3;
}

.appcast-ac-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    line-height: 1.3;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.appcast-ac-pill:hover {
    background: #f3f7fc;
    border-color: #93c5fd;
}

.appcast-ac-pill--active {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.appcast-ac-pill--active:hover {
    background: #4338ca;
    border-color: #4338ca;
    color: #fff;
}

.appcast-ac-pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba( 0, 0, 0, 0.06 );
    font-size: 11px;
    font-weight: 600;
    color: inherit;
}

.appcast-ac-pill--active .appcast-ac-pill-count {
    background: rgba( 255, 255, 255, 0.25 );
}

.appcast-ac-results-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 12px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.appcast-ac-results-head-meta {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
}

/* Tagged rows: left chip + title + count + arrow */

.appcast-ac-item--tagged {
    grid-template-columns: auto 1fr auto 20px;
    gap: 12px;
    border-top: 1px solid #f7f7f7;
}

.appcast-ac-item--tagged:first-child {
    border-top: none;
}

.appcast-ac-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 4px;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
    align-self: center;
}

.appcast-ac-tag--job      { background: #ede9fe; color: #5b21b6; }
.appcast-ac-tag--location { background: #fee2e2; color: #b91c1c; }
.appcast-ac-tag--page     { background: #e0e7ff; color: #3730a3; }
.appcast-ac-tag--extra    { background: #fef3c7; color: #92400e; }

/* ── Optional location field (second input in the search bar) ─────────────
   Used when [appcast_search_autocomplete show_location_field="true"].
   Desktop: the form itself is the pill — single rounded container, hairline
   divider between fields, submit button sits flush inside on the right. On
   mobile, this collapses to stacked pills (see the @media block below). */

.appcast-ac-wrap--with-location .appcast-ac-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.06 );
    gap: 0;
    padding: 4px 4px 4px 0;
    align-items: center;
}

.appcast-ac-wrap--with-location .appcast-ac-field-wrap--location {
    flex: 0 0 260px;
    border-left: 1px solid #e5e7eb;
}

.appcast-ac-wrap--with-location input.appcast-ac-input {
    border: none !important;
    background: transparent !important;
    border-radius: 0;
    box-shadow: none !important;
}

.appcast-ac-wrap--with-location input.appcast-ac-input:focus {
    border: none !important;
    box-shadow: none !important;
}

.appcast-ac-wrap--with-location .appcast-ac-field-wrap--location input.appcast-ac-input {
    padding-left: 38px !important; /* room for the pin icon */
    padding-right: 36px !important; /* room for the clear button */
}

.appcast-ac-wrap--with-location .appcast-ac-submit {
    border-radius: 999px;
    padding: 10px 22px;
    margin-left: 4px;
}

.appcast-ac-location-icon {
    left: 12px;
    color: #6b7280;
}

.appcast-ac-location-icon svg {
    width: 16px;
    height: 16px;
}

/* Location-only dropdown — simpler than the keyword dropdown (no pills, no
   section headers, just a flat list of selectable city/state items). */

.appcast-ac-dropdown--location {
    padding: 4px 0;
}

.appcast-ac-loc-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #1a1a1a;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.3;
    transition: background 0.1s;
}

.appcast-ac-loc-item:hover,
.appcast-ac-loc-item--active {
    background: #f3f7fc;
}

.appcast-ac-loc-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.appcast-ac-loc-item-icon svg {
    width: 16px;
    height: 16px;
}

.appcast-ac-loc-item-title {
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appcast-ac-loc-item-title mark {
    background: #fde68a;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

.appcast-ac-loc-item-count {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

@media ( max-width: 640px ) {
    /* On mobile, drop the unified pill — each control becomes its own pill
       and they stack vertically. The single-row inline divider doesn't make
       sense when fields are wrapped onto separate rows. */
    .appcast-ac-wrap--with-location .appcast-ac-form {
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
        gap: 8px;
        padding: 0;
        flex-wrap: wrap;
    }

    .appcast-ac-wrap--with-location input.appcast-ac-input {
        border: 1px solid #ccc !important;
        background: #fff !important;
        border-radius: 8px;
    }

    .appcast-ac-wrap--with-location input.appcast-ac-input:focus {
        border-color: #666 !important;
        box-shadow: 0 0 0 3px rgba( 0, 0, 0, 0.06 ) !important;
    }

    .appcast-ac-wrap--with-location .appcast-ac-field-wrap,
    .appcast-ac-wrap--with-location .appcast-ac-field-wrap--location {
        flex: 1 1 100%;
        border-left: none;
    }

    .appcast-ac-wrap--with-location .appcast-ac-submit {
        flex: 1 1 100%;
        margin-left: 0;
        border-radius: 6px;
    }
}

/* ── Mobile (≤640px) tweaks for the new layouts ─────────────────────────── */

@media ( max-width: 640px ) {
    .appcast-ac-pills {
        padding: 10px 12px 8px;
        gap: 6px;
    }

    .appcast-ac-pill {
        padding: 5px 10px;
        font-size: 12px;
    }

    .appcast-ac-results-head {
        padding: 10px 12px 6px;
        font-size: 13px;
    }

    .appcast-ac-section--results > .appcast-ac-section-label {
        padding: 10px 12px 4px;
    }

    .appcast-ac-item--rich,
    .appcast-ac-item--tagged {
        grid-template-columns: auto 1fr auto 16px;
        grid-template-areas: none;
        padding: 10px 12px;
        gap: 10px;
    }

    /* The new variants don't use grid-area, so unset the inherited areas */
    .appcast-ac-item--rich .appcast-ac-item-icon,
    .appcast-ac-item--rich .appcast-ac-item-text,
    .appcast-ac-item--rich .appcast-ac-item-count,
    .appcast-ac-item--rich .appcast-ac-item-arrow,
    .appcast-ac-item--tagged .appcast-ac-tag,
    .appcast-ac-item--tagged .appcast-ac-item-text,
    .appcast-ac-item--tagged .appcast-ac-item-count,
    .appcast-ac-item--tagged .appcast-ac-item-arrow {
        grid-area: auto;
    }

    .appcast-ac-item--rich .appcast-ac-item-icon {
        width: 28px;
        height: 28px;
    }

    .appcast-ac-item-count {
        font-size: 12px;
    }

    /* Two-pane: collapse to a horizontal section bar + stacked rows below */
    .appcast-ac-tp {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .appcast-ac-tp-nav {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #f3f3f3;
        padding: 6px 8px;
        gap: 4px;
    }

    .appcast-ac-tp-nav-item {
        flex: 0 0 auto;
        grid-template-columns: 16px auto auto;
        padding: 6px 10px;
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: 6px;
    }

    .appcast-ac-tp-nav-item--active {
        border-left: none;
        border-bottom-color: #4f46e5;
        background: #f3f4f6;
    }
}
