/**
 * Directorist Select2 Override Styles
 * Modern dropdown design with red accents to match theme
 * Features: Checkbox-style options, cleaner borders, visible scrollbars
 * Updated: Global cursor (I-beam) visibility with adjusted 0.75 brightness, 
 * caret color, and Everest Forms text fix.
 */

/* ==================================================
   GLOBAL INPUT & CURSOR STYLING
   ================================================== */

/* 1. Universal Gray Blinking Caret */
input,
textarea,
select,
[contenteditable="true"],
.select2-search__field,
.dcsw-search-input,
.atbd_wrapper input,
.directorist-add-listing-form input {
    caret-color: #808080 !important;
}

/* 2. Universal Gray I-Beam Mouse Pointer (Hover)
   Applies a lighter filter (0.75 brightness) to make the pointer a softer gray 
*/
input:hover,
textarea:hover,
.select2-search__field:hover,
.dcsw-search-input:hover {
    cursor: text !important;
    filter: grayscale(1) brightness(0.75) !important;
}

/* ==================================================
   EVEREST FORMS: BLACK TEXT FIX
   ================================================== */
/* Targets your specific story submission field and HTML tags */
#evf-13103-field_mFr2lnx6Xh-14,
.haunted-story-text,
.haunted-story-text b,
.haunted-story-text u {
    color: #000000 !important;
}

/* ==================================================
   SELECT2 BOX STYLING - Clean Modern Checkbox Style
   ================================================== */

html body .select2-container .select2-selection,
html body .select2-container .select2-selection--single,
html body .select2-container--default .select2-selection--single,
html body .select2-container .select2-selection--multiple,
html body .select2-container--default .select2-selection--multiple {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    min-height: 36px !important;
    padding: 4px 40px 4px 8px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Hover state for box */
html body .select2-container .select2-selection:hover,
html body .select2-container--default .select2-selection--single:hover {
    border-color: #9ca3af !important;
}

/* Red border on focus/open - matches theme */
html body .select2-container--open .select2-selection,
html body .select2-container--focus .select2-selection,
html body .select2-container--default.select2-container--open .select2-selection--single,
html body .select2-container--open .select2-selection--multiple,
html body .select2-container--focus .select2-selection--multiple {
    border-color: #cc0000 !important;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1) !important;
    outline: none !important;
}

/* ==================================================
   SELECT2 ARROW STYLING
   ================================================== */

/* Standard Arrow - Chevron Down */
html body .select2-container .select2-selection__arrow,
html body .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: 12px !important;
    height: 100% !important;
    top: 0 !important;
    width: 20px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    background-size: 20px 20px !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

html body .select2-selection__arrow b {
    display: none !important;
    /* Hide default arrow */
}

html body .select2-container--open .select2-selection__arrow {
    transform: rotate(180deg) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23cc0000'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
}

/* Fix for Directorist Multi-select: Hide the entire Directorist toggle arrow
   (which uses mask-image via CSS variable that conflicts with our overrides)
   and replace with a single clean chevron via ::after on the selection container */

/* Hide the Directorist arrow completely */
html body .directorist-select2-addons-area {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Add single clean chevron as ::after on the selection container */
html body .directorist-add-listing-form .select2-selection--multiple,
html body .directorist-listing-form-container .select2-selection--multiple {
    position: relative !important;
    padding-right: 40px !important;
}

html body .directorist-add-listing-form .select2-selection--multiple::after,
html body .directorist-listing-form-container .select2-selection--multiple::after {
    content: '' !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    background-size: 20px 20px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    pointer-events: none !important;
}

/* Red chevron when dropdown is open */
html body .directorist-add-listing-form .select2-container--open .select2-selection--multiple::after,
html body .directorist-listing-form-container .select2-container--open .select2-selection--multiple::after {
    transform: translateY(-50%) rotate(180deg) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23cc0000'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
}

/* ==================================================
   SELECT2 TEXT STYLING
   ================================================== */

html body .select2-container .select2-selection__rendered,
html body .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-right: 30px !important;
    padding-left: 0 !important;
    color: #1f2937 !important;
    /* Darker grey text */
    line-height: normal !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    font-size: 14px !important;
}

/* Placeholder text */
html body .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6b7280 !important;
}

/* ==================================================
   SELECT2 DROPDOWN STYLING - Modern rounded dropdown
   ================================================== */

html body .select2-dropdown {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    margin-top: 8px !important;
    overflow: hidden !important;
    z-index: 99999 !important;
    /* Ensure on top */
}

html body .select2-container .select2-results,
html body .select2-container--default .select2-results {
    background-color: #ffffff !important;
    padding: 6px !important;
}

/* Search Box inside dropdown */
html body .select2-search--dropdown {
    padding: 10px !important;
}

html body .select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    outline: none !important;
}

html body .select2-search--dropdown .select2-search__field:focus {
    border-color: #cc0000 !important;
    box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.1) !important;
}

/* ==================================================
   SELECT2 OPTIONS - CHECKBOX STYLE
   ================================================== */

html body .select2-container .select2-results__option,
html body .select2-container--default .select2-results__option {
    background-color: #ffffff !important;
    color: #374151 !important;
    padding: 10px 12px 10px 42px !important;
    /* Left padding space for checkbox */
    font-size: 14px !important;
    line-height: 1.4 !important;
    transition: background-color 0.15s ease !important;
    position: relative !important;
    border-radius: 6px !important;
    margin-bottom: 2px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
}

/* The Fake Checkbox */
html body .select2-container .select2-results__option::before,
html body .select2-container--default .select2-results__option::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.2s ease;
}

/* Hover state */
html body .select2-container .select2-results__option--highlighted,
html body .select2-container .select2-results__option--highlighted[aria-selected],
html body .select2-container .select2-results__option:hover,
html body .select2-container--default .select2-results__option--highlighted,
html body .select2-container--default .select2-results__option--highlighted[aria-selected],
html body .select2-container--default .select2-results__option:hover {
    background-color: #f3f4f6 !important;
    /* Very light grey */
    color: #111827 !important;
}

html body .select2-container .select2-results__option--highlighted::before,
html body .select2-container--default .select2-results__option:hover::before {
    border-color: #9ca3af !important;
}

/* Selected option styling - Checked State */
html body .select2-container .select2-results__option[aria-selected="true"],
html body .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: transparent !important;
    color: #111827 !important;
}

/* Ensure highlighted+selected also has transparent bg (checklist style) */
html body .select2-container--default .select2-results__option--highlighted[aria-selected="true"] {
    background-color: transparent !important;
    color: #111827 !important;
}

/* Only adding a very subtle hover effect to the checkbox itself on hover for selected items */
html body .select2-container--default .select2-results__option--highlighted[aria-selected="true"]::before {
    border-color: #b91c1c !important;
    /* Darker red border on hover */
}


/* Checked Box Style */
html body .select2-container .select2-results__option[aria-selected="true"]::before,
html body .select2-container--default .select2-results__option[aria-selected="true"]::before {
    background-color: #cc0000 !important;
    /* Theme Red */
    border-color: #cc0000 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: 14px 14px;
    background-position: center;
    background-repeat: no-repeat;
}

/* ==================================================
   SCROLLBAR STYLING
   ================================================== */

html body .select2-results__options {
    scrollbar-width: thin !important;
    scrollbar-color: #d1d5db transparent !important;
    max-height: 250px !important;
}

html body .select2-results__options::-webkit-scrollbar {
    width: 8px !important;
}

html body .select2-results__options::-webkit-scrollbar-track {
    background: transparent !important;
}

html body .select2-results__options::-webkit-scrollbar-thumb {
    background-color: #d1d5db !important;
    border-radius: 4px !important;
    border: 2px solid transparent !important;
    background-clip: content-box !important;
}

html body .select2-results__options::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af !important;
}

/* ==================================================
   SINGLE LISTING PAGE STYLING
   Listing titles = red
   ================================================== */

/* Listing title - red color */
.directorist-listing-details__listing-title,
h1.directorist-listing-details__listing-title,
.single-at_biz_dir h1.directorist-listing-details__listing-title,
body .directorist-listing-details__listing-title,
html body h1.directorist-listing-details__listing-title {
    color: #cc0000 !important;
}

/* Location and category links - ensure they're visible */
.directorist-listing-location a,
.directorist-listing-category a,
.directorist-single-info a,
.directorist-listing-location span,
.directorist-listing-category span {
    color: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hover effect for location/category links */
.directorist-listing-location a:hover,
.directorist-listing-category a:hover {
    color: #cc0000 !important;
    text-decoration: underline !important;
}

/* ==================================================
   DIRECTORIST FORM INPUT VISIBILITY FIXES
   ================================================== */

/* Form inputs - visible with white background */
.directorist-add-listing-form input:not([type="submit"]):not([type="button"]):not([type="radio"]):not([type="checkbox"]),
.directorist-add-listing-form textarea,
.directorist-add-listing-form select,
.directorist-listing-form-container input:not([type="submit"]):not([type="button"]):not([type="radio"]):not([type="checkbox"]),
.directorist-listing-form-container textarea,
.directorist-listing-form-container select,
#directorist.atbd_wrapper input:not([type="submit"]):not([type="button"]):not([type="radio"]):not([type="checkbox"]),
#directorist.atbd_wrapper textarea,
#directorist.atbd_wrapper select {
    background-color: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
}

/* Fully hide native <select> elements replaced by Select2 in Directorist forms */
.directorist-add-listing-form select.select2-hidden-accessible,
.directorist-listing-form-container select.select2-hidden-accessible,
.directorist-add-listing-form .directorist-form-group select,
.directorist-listing-form-container .directorist-form-group select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Select2 multi-select search input: remove inner border, clean appearance */
.directorist-add-listing-form .select2-search__field,
.directorist-listing-form-container .select2-search__field {
    min-width: 150px !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 4px 4px !important;
    margin: 0 !important;
    height: auto !important;
    line-height: 1.4 !important;
    font-size: 14px !important;
}


/* ==================================================
   EVEREST FORMS: DROPDOWN ARROW FIX
   ================================================== */

/* Remove native browser dropdown arrow and add custom SVG chevron */
.evf-frontend-form select,
.evf-field select,
.everest-forms select {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 20px 20px !important;
    padding-right: 40px !important;
    cursor: pointer !important;
}

/* Form labels */
.directorist-add-listing-form label,
.directorist-listing-form-container label,
#directorist.atbd_wrapper label,
.directorist-form-label {
    color: #333333 !important;
    font-weight: 500 !important;
    margin-bottom: 6px !important;
}

/* ==================================================
   DIRECTORIST FORM: COMPACT SPACING
   ================================================== */

/* Reduce section padding */
html body .directorist-add-listing-form .directorist-content-module__contents,
html body .directorist-add-listing-form .directorist-form-section__contents {
    padding: 0 16px 16px !important;
    gap: 8px !important;
    /* Removed top padding completely to tighten header-to-field gap */
}

/* Reduce section header padding */
html body .directorist-add-listing-form .directorist-content-module__title,
html body .directorist-add-listing-form .directorist-form-section__title {
    padding: 10px 16px !important;
    /* Slightly increased to give header breathing room */
    margin-bottom: 12px !important;
    /* Re-added margin-bottom to ensure fields aren't crushed against the header */
}

/* Reduce space between sections */
html body .directorist-add-listing-form .directorist-content-module,
html body .directorist-add-listing-form .directorist-form-section {
    margin-bottom: 2px !important;
    /* Squeezed the boxes together */
}

/* Reduce space between form groups */
html body .directorist-add-listing-form .directorist-form-group {
    margin-bottom: 8px !important;
}

/* Reduce label spacing */
html body .directorist-add-listing-form label {
    margin-bottom: 3px !important;
    font-size: 14px !important;
}

/* ==================================================
   DIRECTORIST FORM: WHITE TEXT FIX
   ================================================== */

/* Fix invisible white section headers on white background */
html body .directorist-add-listing-form h2,
html body .directorist-add-listing-form h3,
html body .directorist-add-listing-form h4,
html body .directorist-add-listing-form .directorist-content-module__title h2,
html body .directorist-add-listing-form .directorist-content-module__title-text,
html body .directorist-add-listing-form .directorist-form-section__title h2 {
    color: #333333 !important;
}

/* Fix the "Drop Here" and publish confirmation text */
html body .directorist-add-listing-form .directorist-dragarea h2,
html body .directorist-add-listing-form .directorist-publish-confirmation h2 {
    color: #333333 !important;
}

/* ==================================================
   DIRECTORIST FORM: EXCESSIVE WHITESPACE FIXES
   ================================================== */

/* 1. Fix the empty map field leaving a huge 475px gap in the General section */
html body #add-listing-content-general-section .directorist-form-map-field {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 2. Fix massive padding on the Finish tab publish confirmation area */
html body .directorist-add-listing-form .directorist-add-listing-form__publish,
html body .directorist-add-listing-form .directorist-publish-confirmation {
    padding: 30px 20px !important;
    /* Reduced from 100px */
}

html body .directorist-add-listing-form .directorist-add-listing-form__publish__title,
html body .directorist-add-listing-form .directorist-add-listing-form__publish h2,
html body .directorist-add-listing-form .directorist-publish-confirmation h2 {
    margin-top: 15px !important;
    /* Reduced from 56px */
    margin-bottom: 15px !important;
    /* Reduced from 32px */
}

/* Fix icon spacing on finish tab */
html body .directorist-add-listing-form .directorist-icon-mask,
html body .directorist-add-listing-form .directorist-publish-confirmation i {
    margin-bottom: 10px !important;
    /* Reduced from 25px */
}

/* 3. General form group spacing - eliminate arbitrary top paddings */
html body .directorist-add-listing-form .directorist-form-group {
    padding-top: 0 !important;
}

/* 4. Fix specific large gaps on Social or Email fields */
html body .directorist-add-listing-form .directorist-form-social-field,
html body .directorist-add-listing-form .directorist-form-email-field {
    margin-top: 5px !important;
}