/* ============================================
   Clean & Robust Search Results Styling
   ============================================ */

/* Container: Force it to sit securely within the modal flow */
.search-results {
    display: block !important;
    background: transparent;
    /* No background needed for container */
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    /* Clear visual separator */

    /* Let Flexbox in modal parent handle height, but ensure scrolling works */
    flex: 1;
    overflow-y: auto;
    width: 100%;

    /* Ensure it doesn't float over anything */
    position: relative;
    z-index: 1;
}

/* Custom Scrollbar */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background-color: var(--text-tertiary);
    border-radius: 4px;
}

/* Result Card */
.search-result-card {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    /* Thumb | Info | Button */
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;

    /* Solid Card Background */
    background: var(--bg-card);
    /* Should be opaque in theme */
    border: 1px solid var(--border-color);
    border-radius: 8px;

    /* No fancy transforms checking z-index/overlay issues */
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-result-card:hover {
    border-color: var(--text-accent);
    background: var(--bg-tertiary);
}

/* Thumbnail */
.result-thumb {
    width: 60px;
    height: 90px;
    background: #0f172a;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    background: #475569;
}

/* Info Text */
.result-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.result-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.result-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.result-year {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* Button */
.select-btn {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.select-btn:hover {
    background: var(--text-accent);
    color: white;
    border-color: var(--text-accent);
}

/* States */
.search-loading,
.empty-state-text {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.error-msg {
    padding: 1rem;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 8px;
    text-align: center;
    margin: 1rem 0;
}