/* Resources search dropdowns: same look as the header search results */
ul.ui-autocomplete.esp-suggest-menu {
    list-style: none;
    margin: 8px 0 0 !important;
    padding: 12px !important;
    background: #fff !important;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1001;
    font-family: "Red Hat Display", sans-serif;
    animation: espSrFadeIn 0.2s ease;
}

ul.esp-suggest-menu li.ui-menu-item {
    list-style: none;
    padding: 0 !important;
    margin: 0 0 10px;
    cursor: pointer;
}

ul.esp-suggest-menu li.ui-menu-item:last-child { margin-bottom: 0; }

/* Card */
.esp-sr-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 16px 46px 16px 16px;
    border-radius: 10px;
    background: #fff;
    border-left: 3px solid transparent;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    transition: all 0.2s ease;
}

/* Hover + keyboard highlight (jQuery UI adds .ui-state-active) */
.esp-sr-card:hover,
.esp-sr-card.ui-state-active {
    background: #f8fbff;
    border-left-color: #0F80D1;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(15, 128, 209, 0.1);
    margin: 0; /* jQuery UI default theme adds a margin on active */
}

.esp-sr-card:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 18px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230F80D1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") no-repeat;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.esp-sr-card:hover:after,
.esp-sr-card.ui-state-active:after {
    opacity: 0.7;
    transform: translate(5px, -50%);
}

/* Thumbnail */
.esp-sr-thumb {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
}

.esp-sr-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text */
.esp-sr-text { flex: 1; min-width: 0; }

.esp-sr-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: #2056A1;
    margin: 0 0 6px;
}

.esp-sr-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta: type pill + date */
.esp-sr-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
    color: #777;
}

.esp-sr-type {
    background: #e0e9f4;
    color: #0F80D1;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.esp-sr-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.esp-sr-date:before {
    content: "";
    width: 12px;
    height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23777777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat;
}

/* Note rows */
ul.esp-suggest-menu li.ui-state-disabled { cursor: default; opacity: 1; }

.esp-sr-suggestion {
    padding: 8px 12px;
    font-size: 13px;
    color: #0F80D1;
    background: #f0f7fd;
    border-radius: 8px;
}

.esp-sr-empty {
    padding: 30px 20px;
    text-align: center;
    font-size: 15px;
    color: #555;
    background: #f9f9f9;
    border-radius: 10px;
}

@keyframes espSrFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: keep thumbnail beside text, just smaller */
@media (max-width: 767px) {
    .esp-sr-card { padding: 12px 36px 12px 12px; gap: 12px; }
    .esp-sr-thumb { width: 56px; height: 56px; }
    .esp-sr-title { font-size: 15px; }
    .esp-sr-excerpt { font-size: 13px; }
}

/* Compact rows: title + type only (feedback: max 5 rows, shorter rows) */
ul.esp-suggest-menu li.ui-menu-item { margin-bottom: 6px; }
.esp-sr-card--compact { align-items: center; padding: 10px 40px 10px 14px; }
.esp-sr-card--compact .esp-sr-text { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.esp-sr-card--compact .esp-sr-title {
    font-size: 15px; margin: 0; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.esp-sr-card--compact .esp-sr-type { flex-shrink: 0; white-space: nowrap; }

/* "View all results" row */
.esp-sr-viewall {
    padding: 10px 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #0F80D1;
    border-radius: 8px;
    background: #f0f7fd;
}
.esp-sr-viewall:hover,
ul.esp-suggest-menu .ui-state-active .esp-sr-viewall,
ul.esp-suggest-menu .ui-state-active.esp-sr-viewall { background: #e0eefa; }

@media (max-width: 767px) {
    .esp-sr-card--compact .esp-sr-title { font-size: 14px; white-space: normal; }
}
