/**
 * Directorist Select2 Override Styles
 * Modern dropdown design with red accents to match theme
 * Features: Checkbox-style options, cleaner borders, visible scrollbars
 */

/* ==================================================
   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;
    /* Lighter cleaner border */
    border-radius: 6px !important;
    min-height: 42px !important;
    padding: 6px 12px !important;
    /* Adjusted padding */
    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 Custom Arrow Structure (Multi-select) */
html body .directorist-select2-addons-area .directorist-select2-dropdown-toggle i {
    mask-image: none !important;
    -webkit-mask-image: none !important;
    background-color: transparent !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;
    width: 20px !important;
    height: 20px !important;
    display: block !important;
}

html body .directorist-select2-addons-area .directorist-select2-dropdown-toggle.--is-open i {
    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;
}

/* ==================================================
   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;
}

/* 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;
}