/* ============================================================
 * STOCK FOR SALE - AACS CORPORATE PALETTE
 * ============================================================
 * Primary ink:   #1C1A19
 * Brand green:   #8AB336
 * Contrast:      dark ink on green, never white text on green.
 *
 * Scope: WPAdverts frontend components (search, listings, forms,
 * author profiles, details and management). Nothing here targets
 * the global Divi navigation, WordPress dashboard or other forms.
 */

:root {
    --aacs-sfs-ink: #1C1A19;
    --aacs-sfs-green: #8AB336;
    --aacs-sfs-border: #dedede;
    --aacs-sfs-soft: #f5f7f1;
    --aacs-sfs-menu-hover: #f1f5e9;
    --aacs-sfs-white: #fff;
}

/* ============================================================
 * STOCK FOR SALE - TYPOGRAPHY AND LINK COLOURS
 * ============================================================ */
:is(.adverts-search, .adverts-form, .adverts-list, .adverts-single,
    .adverts-manage, .adverts-authors, .adverts-categories,
    .adverts-options, .adverts-pagination) {
    color: var(--aacs-sfs-ink);
}

:is(.adverts-search, .adverts-form, .adverts-single, .adverts-manage,
    .adverts-authors) :is(label, .adverts-field-label, .adverts-row-title) {
    color: var(--aacs-sfs-ink);
}

:is(.adverts-single, .adverts-form, .adverts-manage, .adverts-authors,
    .adverts-categories) a:not(.adverts-button):not([class*="button"]):not(.button) {
    color: var(--aacs-sfs-ink);
    text-decoration-color: var(--aacs-sfs-green);
}

:is(.adverts-single, .adverts-form, .adverts-manage, .adverts-authors,
    .adverts-categories) a:not(.adverts-button):not([class*="button"]):not(.button):hover {
    color: var(--aacs-sfs-green);
}

/* ============================================================
 * STOCK FOR SALE - CHECKBOXES AND RADIO BUTTONS
 * ============================================================ */
:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors,
    .adverts-single) input:is([type="checkbox"], [type="radio"]),
.adverts-multiselect-options input:is([type="checkbox"], [type="radio"]),
.ds-stock-sidebar .adverts-search input[type="checkbox"][name^="aacs_hide_sold"] {
    accent-color: var(--aacs-sfs-green) !important;
    cursor: pointer;
}

:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    input:is([type="checkbox"], [type="radio"]):focus-visible {
    outline: 2px solid var(--aacs-sfs-green);
    outline-offset: 3px;
}

/* ============================================================
 * STOCK FOR SALE - INPUT FOCUS, MULTISELECTS AND ACTIVE OPTIONS
 * ============================================================ */
:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(input[type="text"], input[type="email"], input[type="tel"],
        input[type="url"], input[type="number"], input[type="date"],
        input[type="password"], textarea, select):focus,
.adverts-search .adverts-multiselect-holder:focus-within,
.adverts-form .adverts-multiselect-holder:focus-within {
    border-color: var(--aacs-sfs-green) !important;
    box-shadow: 0 0 0 1px var(--aacs-sfs-green) !important;
    outline: none;
}

:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(input, select, textarea):focus-visible {
    outline-color: var(--aacs-sfs-green) !important;
}

.adverts-search .adverts-multiselect-options label:hover,
.adverts-form .adverts-multiselect-options label:hover,
.adverts-search .adverts-multiselect-options .adverts-selected {
    background-color: var(--aacs-sfs-menu-hover);
    color: var(--aacs-sfs-ink);
}

/* ============================================================
 * STOCK FOR SALE - PRIMARY FORM ACTIONS
 * ============================================================ */
:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(input[type="submit"], button[type="submit"], button.adverts-button,
        a.adverts-button),
.adverts-single :is(button.adverts-button, a.adverts-button),
.adverts-button.adverts-button-primary {
    background: var(--aacs-sfs-ink) !important;
    background-color: var(--aacs-sfs-ink) !important;
    border: 1px solid var(--aacs-sfs-ink) !important;
    color: var(--aacs-sfs-white) !important;
    border-radius: 2px !important;
    box-shadow: none !important;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(input[type="submit"], button[type="submit"], button.adverts-button,
        a.adverts-button):hover,
.adverts-single :is(button.adverts-button, a.adverts-button):hover,
.adverts-button.adverts-button-primary:hover {
    background: var(--aacs-sfs-green) !important;
    background-color: var(--aacs-sfs-green) !important;
    border-color: var(--aacs-sfs-green) !important;
    color: var(--aacs-sfs-ink) !important;
}

:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(input[type="submit"], button[type="submit"], button.adverts-button,
        a.adverts-button):focus-visible,
.adverts-single :is(button.adverts-button, a.adverts-button):focus-visible {
    outline: 2px solid var(--aacs-sfs-green) !important;
    outline-offset: 3px !important;
}

/* Keep disabled action buttons visibly disabled. */
:is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
    :is(button, input[type="submit"]):disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ============================================================
 * STOCK FOR SALE - FILTER ACTION BUTTONS, GRID/LIST AND SORTING
 * ============================================================
 * Keep the idle button appearance neutral. When hovered/keyboard-
 * focused, fill controls with the corporate green (not pale green
 * with a green outline). Preserve dropdown arrows and SVG icons.
 * Scoped to WPAdverts options to avoid other Divi/site controls.
 */
.adverts-options :is(a, button, select, input[type="button"], input[type="submit"]) {
    color: var(--aacs-sfs-ink) !important;
    border-color: var(--aacs-sfs-border) !important;
    border-radius: 0 !important;
}

.adverts-options :is(a, button, input[type="button"], input[type="submit"]):hover,
.adverts-options :is(a, button, input[type="button"], input[type="submit"]):focus-visible,
.adverts-options :is(.adverts-options-left, .adverts-options-right) select:hover,
.adverts-options :is(.adverts-options-left, .adverts-options-right) select:focus-visible,
.adverts-options .adverts-active,
.adverts-options .adverts-current,
.adverts-options .active {
    color: var(--aacs-sfs-ink) !important;
    border-color: var(--aacs-sfs-green) !important;
    background-color: var(--aacs-sfs-green) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Icons adopt dark text colour on green-filled controls. */
.adverts-options :is(a, button):is(:hover, :focus-visible) :is(i, .adverts-icon, svg),
.adverts-options :is(.adverts-active, .adverts-current, .active) :is(i, .adverts-icon, svg) {
    color: var(--aacs-sfs-ink) !important;
}

/* The sorting select is also an interactive control. */
.adverts-options :is(.adverts-options-left, .adverts-options-right) select:focus {
    border-color: var(--aacs-sfs-green) !important;
}

/* ============================================================
 * STOCK FOR SALE - PAGINATION
 * ============================================================ */
.adverts-pagination :is(a, span, .page-numbers) {
    color: var(--aacs-sfs-ink);
}
.adverts-pagination :is(a, .page-numbers):hover,
.adverts-pagination :is(.current, .adverts-current) {
    border-color: var(--aacs-sfs-green) !important;
    background-color: var(--aacs-sfs-soft) !important;
    color: var(--aacs-sfs-ink) !important;
}

/* ============================================================
 * STOCK FOR SALE - DETAILS AND STATUS ACCENTS
 * ============================================================ */
.adverts-single .adverts-round-icon {
    color: var(--aacs-sfs-ink);
    background-color: var(--aacs-sfs-soft);
}

.adverts-single :is(.adverts-row-title, .adverts-field-label) {
    color: var(--aacs-sfs-ink);
}

/* Card category, title, button and status colours are defined once in
   aacs-stock-for-sale.css, which this file depends on. */

@media (prefers-reduced-motion: reduce) {
    :is(.adverts-search, .adverts-form, .adverts-manage, .adverts-authors)
        :is(input[type="submit"], button[type="submit"], button.adverts-button,
            a.adverts-button) {
        transition: none;
    }
}


/* ============================================================
 * STOCK FOR SALE - "ALL LOCATIONS / ALL CATEGORIES" RESET ROW
 * ============================================================ */
.adverts-search .adverts-multiselect-options button.aacs-sfs-clear-selection {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 29px;
    margin: 0;
    padding: 5px 9px;
    border: 0 !important;
    border-bottom: 1px solid #e5e5e5 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #1C1A19 !important;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    text-transform: none;
    text-align: left;
    cursor: pointer;
}

.adverts-search .adverts-multiselect-options button.aacs-sfs-clear-selection:hover,
.adverts-search .adverts-multiselect-options button.aacs-sfs-clear-selection:focus-visible {
    color: #1C1A19 !important;
    background: var(--aacs-sfs-menu-hover) !important;
    border-radius: 0 !important;
}

.adverts-search .adverts-multiselect-options button.aacs-sfs-clear-selection:focus-visible {
    outline: 1px solid #777777 !important;
    outline-offset: -1px !important;
}

.adverts-search .aacs-sfs-clear-selection__square {
    display: inline-block;
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    border: 1px solid #9e9e9e;
    border-radius: 2px;
    background: #fff;
    box-sizing: border-box;
}


/* ============================================================
 * STOCK FOR SALE - WHITE SIDEBAR FILTER PANEL WITH 15PX INSET
 * ============================================================
 * Scope to the Stock for Sale Divi sidebar only. Do not modify
 * the WPAdverts forms, sorting controls or other site sections.
 */
.ds-stock-sidebar .adverts-options {
    background-color: #ffffff !important;
    padding: 15px !important;
    box-sizing: border-box;
}


/* ============================================================
 * STOCK FOR SALE - WPADVERTS FLASH NOTIFICATIONS
 * ============================================================ */

/* Use the corporate green for WPAdverts frontend notifications.
   This intentionally includes info, success, warning and error variants. */
div.adverts-flash-messages,
div.adverts-flash-messages.adverts-flash-info,
div.adverts-flash-messages.adverts-flash-success,
div.adverts-flash-messages.adverts-flash-warning,
div.adverts-flash-messages.adverts-flash-error {
    background-color: #8AB336 !important;
    margin-bottom: 0 !important;
}


/* ============================================================
 * STOCK FOR SALE - MOBILE MULTISELECT CHECKBOX CONSISTENCY
 * ============================================================
 * WPAdverts Location/Category/Hide Sold use native checkboxes,
 * whereas Age and the "All ..." reset row use drawn squares.
 * Disable native iOS/Safari appearance for the search filters
 * and match the existing 15px / 2px square design everywhere.
 * The real input remains clickable and still submits normally.
 */
.ds-stock-sidebar .adverts-search .adverts-multiselect-options input[type="checkbox"],
.ds-stock-sidebar .adverts-search input[type="checkbox"][name^="aacs_hide_sold"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-block;
    flex: 0 0 15px;
    width: 15px !important;
    min-width: 15px !important;
    max-width: 15px !important;
    height: 15px !important;
    min-height: 15px !important;
    max-height: 15px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #858585 !important;
    border-radius: 2px !important;
    background-color: #FFFFFF !important;
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    vertical-align: middle;
    cursor: pointer;
}

.ds-stock-sidebar .adverts-search .adverts-multiselect-options input[type="checkbox"]:checked,
.ds-stock-sidebar .adverts-search input[type="checkbox"][name^="aacs_hide_sold"]:checked {
    border-color: #8AB336 !important;
    background-color: #8AB336 !important;
    /* Draw the dark tick as an SVG background, reliably on iOS Safari. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15'%3E%3Cpath d='M3 7.3l3 3.1L12 4' fill='none' stroke='%231C1A19' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-size: 14px 14px !important;
}

.ds-stock-sidebar .adverts-search .adverts-multiselect-options input[type="checkbox"]:focus-visible,
.ds-stock-sidebar .adverts-search input[type="checkbox"][name^="aacs_hide_sold"]:focus-visible {
    outline: 2px solid #8AB336 !important;
    outline-offset: 2px !important;
}

/* Preserve the existing text gap on Hide sold listings. */
.ds-stock-sidebar .adverts-search input[type="checkbox"][name^="aacs_hide_sold"] {
    margin: 0 8px 0 0 !important;
}


/* ============================================================
 * STOCK FOR SALE - AUTHORS CREATE AD PREVIEW ACTIONS
 * ============================================================
 * Authors shows Edit Listing / Publish Listing as bare <input type=submit>
 * in separate inline forms. Give these the same AACS corporate styling,
 * without affecting account settings, WPForms or the WordPress admin.
 */
body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] {
    display: inline-block !important;
    margin: 14px 10px 6px 0 !important;
    padding: 0 !important;
    vertical-align: top;
}

body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"] {
    display: inline-block !important;
    min-width: 130px;
    min-height: 44px;
    height: auto !important;
    padding: 11px 18px !important;
    margin: 0 !important;
    border: 1px solid #1C1A19 !important;
    border-radius: 0 !important;
    background: #1C1A19 !important;
    box-shadow: none !important;
    color: #FFFFFF !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 20px !important;
    text-align: center !important;
    text-transform: none !important;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* Publishing / submitting is the primary action. */
body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"][value="Publish Listing"] {
    border-color: #8AB336 !important;
    background: #8AB336 !important;
    color: #1C1A19 !important;
}

body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"]:is(:hover, :focus-visible) {
    border-color: #8AB336 !important;
    background: #8AB336 !important;
    color: #1C1A19 !important;
}
body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"][value="Publish Listing"]:is(:hover, :focus-visible) {
    border-color: #1C1A19 !important;
    background: #1C1A19 !important;
    color: #FFFFFF !important;
}
body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"]:focus-visible {
    outline: 2px solid #8AB336 !important;
    outline-offset: 3px;
}

/* The review message is part of the Authors panel, not a public advert. */
body .wpa-author-dashboard .aacs-sfs-pending-review-notice {
    margin: 8px 0 12px;
    color: #1C1A19;
    font-size: 14px;
    line-height: 1.6;
}
body .wpa-author-dashboard .aacs-sfs-pending-review-notice a {
    color: #587a20 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}
body .wpa-author-dashboard .aacs-sfs-pending-review-notice a:hover,
body .wpa-author-dashboard .aacs-sfs-pending-review-notice a:focus-visible {
    color: #1C1A19 !important;
}
@media (max-width: 480px) {
    body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] {
        display: block !important;
        width: 100%;
        margin: 10px 0 !important;
    }
    body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"] {
        width: 100%;
    }
}
@media (prefers-reduced-motion: reduce) {
    body .wpa-author-dashboard .wpa-author-content > form[style*="inline"] > input[type="submit"] {
        transition: none;
    }
}

/* ============================================================
 * STOCK FOR SALE - SINGLE ADVERT MOBILE DATE OF BIRTH LABEL
 * ============================================================
 * Target ONLY the actual value <span>. WPAdverts assigns the same DOB class
 * to both the enclosing grid <div> and the nested <span>; targeting both
 * creates duplicate DOB labels (as happened in v1.2.36).
 */
@media (max-width: 767px) {
    body.single-advert .adverts-single-grid-details .adverts-grid-row.wpa-row-name--aacs_date_of_birth .adverts-grid-col > span.adverts-row-value::before,
    body.single-advert .adverts-single-grid-details .adverts-grid-row.wpa-row-name-aacs_date_of_birth .adverts-grid-col > span.adverts-row-value::before {
        content: "DOB:";
        display: inline;
        margin-right: 6px;
        color: #777777;
        font-weight: 600;
        white-space: nowrap;
    }
}
