/**
 * SEO Link Obfuscation Styles for ps_facetedsearch
 *
 * These styles ensure that obfuscated filter links (spans instead of anchors)
 * maintain the same visual appearance and accessibility as regular links.
 */

/* Base styles for obfuscated links */
.js-search-link-obfuscated {
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

/* Match the original link styles in facet labels */
#search_filters .facet .facet-label .js-search-link-obfuscated {
    width: calc(100% - 30px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hover state - mimic link behavior */
.js-search-link-obfuscated:hover {
    text-decoration: underline;
}

/* Focus state for keyboard navigation - accessibility */
.js-search-link-obfuscated:focus {
    outline: 2px solid #2fb5d2;
    outline-offset: 2px;
}

/* Focus-visible for modern browsers (only show focus ring on keyboard nav) */
.js-search-link-obfuscated:focus:not(:focus-visible) {
    outline: none;
}

.js-search-link-obfuscated:focus-visible {
    outline: 2px solid #2fb5d2;
    outline-offset: 2px;
}

/* Active/pressed state */
.js-search-link-obfuscated:active {
    opacity: 0.8;
}

/* Dropdown menu items */
.facet-dropdown .dropdown-menu .js-search-link-obfuscated {
    display: block;
    width: 100%;
    padding: 0.25rem 1.5rem;
    clear: both;
    font-weight: 400;
    color: #232323;
    text-align: inherit;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
}

.facet-dropdown .dropdown-menu .js-search-link-obfuscated:hover,
.facet-dropdown .dropdown-menu .js-search-link-obfuscated:focus {
    color: #16181b;
    text-decoration: none;
    background-color: #f8f9fa;
}

/* Active filters remove button */
#js-active-search-filters .js-search-link-obfuscated {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 0.5rem;
}

#js-active-search-filters .js-search-link-obfuscated:hover {
    text-decoration: none;
}

#js-active-search-filters .js-search-link-obfuscated:hover .material-icons {
    color: #d9534f;
}

/* Ensure material icons in obfuscated links display correctly */
.js-search-link-obfuscated .material-icons {
    vertical-align: middle;
    font-size: inherit;
}

/* Screen reader only text helper (if needed) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .js-search-link-obfuscated:focus {
        outline: 3px solid currentColor;
        outline-offset: 3px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .js-search-link-obfuscated {
        transition: none;
    }
}

/* =============================================
   Jpresta Theme Compatibility
   Mirror anchor styles for obfuscated spans
   ============================================= */

/* Facet label link styles */
.jpresta_module.ps_facetedsearch .facet-label .js-search-link-obfuscated {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    color: #1f2328;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.35;
    cursor: pointer;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Focus visible state */
.jpresta_module.ps_facetedsearch .facet-label .js-search-link-obfuscated:focus-visible {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
    border-color: #0ea5e9;
    border-radius: 10px;
}

/* Disabled state */
.jpresta_module.ps_facetedsearch input[disabled] ~ .js-search-link-obfuscated {
    opacity: 0.5;
    cursor: not-allowed !important;
}

/* Gray darker variant */
.jpresta_module.ps_facetedsearch .facet-label .js-search-link-obfuscated._gray-darker {
    color: #1f2328;
}

.jpresta_module.ps_facetedsearch .facet-label .js-search-link-obfuscated._gray-darker:hover {
    text-decoration: none;
}

/* Search filters facet label */
#search_filters .facet .facet-label .js-search-link-obfuscated {
    white-space: normal;
}

/* Facet filter label (search-link) - font weight */
#search_filters .facet .facet-label .js-search-link {
    font-weight: 400;
}
