/**
 * Weighted Search - Styles
 */

/* Results Container */
.weighted-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: 999999;
    margin-top: 10px;
    display: none;
    border: 1px solid #e0e0e0;
}

/* Inside modal adjustments */
.bmm-search-modal .weighted-search-results {
    position: relative;
    margin-top: 20px;
    max-height: 60vh;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.1);
}

/* Inner wrapper */
.weighted-search-inner {
    padding: 8px 0;
}

/* Results list */
.weighted-search-results .results-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Individual result item */
.weighted-search-results .result-item {
    display: flex;
    align-items: flex-start;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 90px; /* Ensure consistent height */
    gap: 16px; /* Add gap between thumbnail and content */
}

.weighted-search-results .result-item:last-child {
    border-bottom: none;
}

.weighted-search-results .result-item:hover,
.weighted-search-results .result-item.selected {
    background: transparent !important; /* Remove dark hover background */
    border-left: 4px solid #216BFF;
    padding-left: 16px; /* Compensate for border */
    transform: translateX(4px); /* Subtle slide effect instead of background */
}

.weighted-search-results .result-item.selected {
    background: rgba(33, 107, 255, 0.05) !important; /* Very subtle blue tint for selected */
}

/* Thumbnail */
.weighted-search-results .result-thumbnail {
    flex-shrink: 0;
    max-width: 90px;
    max-height: 90px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    border: 2px solid #e9ecef;
}

.weighted-search-results .result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.weighted-search-results .result-item:hover .result-thumbnail img {
    transform: scale(1.05);
}

/* Content */
.weighted-search-results .result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

/* Post type badge */
.weighted-search-results .result-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #003594;
    background: #DBEEFF;
    padding: 4px 8px;
    border-radius: 12px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    max-width: fit-content;
    line-height: 1.1rem;
}

/* Title */
.weighted-search-results .result-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 600;
    margin-bottom: 8px;
}

.weighted-search-results .result-title a {
    color: #003594;
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
}

.weighted-search-results .result-item:hover .result-title a {
    color: #216BFF;
}

/* Excerpt */
.weighted-search-results .result-excerpt {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Highlight matches - Better styling */
.weighted-search-results .result-excerpt mark,
.weighted-search-results .result-title mark {
    background: rgba(255, 184, 28, 0.25); /* Gold highlight with transparency */
    color: #003594; /* University blue text */
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Meta info */
.weighted-search-results .result-meta {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.weighted-search-results .result-meta span {
    margin-right: 16px;
}

.weighted-search-results .result-meta span::before {
    content: "•";
    margin-right: 6px;
    color: #ccc;
}

.weighted-search-results .result-meta span:first-child::before {
    display: none;
}

/* Footer */
.weighted-search-results .results-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.weighted-search-results .view-all-results {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #216BFF;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 2px solid #216BFF;
}

.weighted-search-results .view-all-results:hover {
    background: #216BFF;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 107, 255, 0.3);
}

/* Loading state */
.weighted-search-results .search-loading {
    padding: 40px 20px;
    text-align: center;
}

.weighted-search-results .search-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #216BFF;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.weighted-search-results .search-loading span {
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

/* No results */
.weighted-search-results .search-no-results {
    padding: 50px 20px;
    text-align: center;
}

.weighted-search-results .search-no-results p {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 16px;
}

.weighted-search-results .search-no-results .suggestion {
    font-size: 14px;
    color: #999;
    font-style: italic;
}

/* Error state */
.weighted-search-results .search-error {
    padding: 30px 20px;
    text-align: center;
    background: #fff5f5;
    color: #d32f2f;
    border-radius: 8px;
    margin: 8px;
}

.weighted-search-results .search-error p {
    margin: 0;
    font-weight: 500;
}

/* Scrollbar styling */
.weighted-search-results::-webkit-scrollbar {
    width: 10px;
}

.weighted-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.weighted-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
    border: 2px solid #f1f1f1;
}

.weighted-search-results::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .weighted-search-results {
        max-height: 400px;
        border-radius: 8px;
    }
    
    .weighted-search-results .result-item {
        padding: 16px 16px;
        gap: 12px;
        min-height: 80px;
    }
    
    .weighted-search-results .result-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .weighted-search-results .result-title {
        font-size: 16px;
    }
    
    .weighted-search-results .result-excerpt {
        font-size: 14px;
        -webkit-line-clamp: 1;
    }
    
    .weighted-search-results .result-type {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Animation for results appearance */
.weighted-search-results {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Focus states for accessibility */
.weighted-search-results .result-item:focus-visible {
    outline: 2px solid #216BFF;
    outline-offset: -2px;
    background: #f0f4ff;
}

/* Improved keyboard navigation */
.weighted-search-results .result-item.selected {
    position: relative;
}

.weighted-search-results .result-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #216BFF;
    border-radius: 0 4px 4px 0;
}