/* ============================================
   MBS Search Result Cards & Modal
   ============================================ */

/* --- MBS Result Card --- */
.mbs-result-card {
    display: block;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    transition: border-color 0.15s ease;
}

.mbs-result-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.mbs-card-image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mbs-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mbs-card-image .mbs-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.5rem;
}

.mbs-card-info {
    padding: 6px 8px;
}

.mbs-card-code {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mbs-card-title {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mbs-card-category {
    margin-top: 4px;
}

/* Skeleton variant */
.mbs-skeleton-card {
    pointer-events: none;
}

.mbs-skeleton-code {
    height: 14px;
    border-radius: 4px;
    width: 60%;
}

.mbs-skeleton-title {
    height: 10px;
    border-radius: 4px;
    width: 80%;
    margin-top: 4px;
}

/* --- MBS Result Preview (in-chat) --- */
.mbs-result-preview {
    padding: 4px 0;
}

.mbs-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (min-width: 960px) {
    .mbs-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mbs-no-results {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 0;
}

/* --- MBS See More Modal: Split Layout --- */
.mbs-modal-split {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

@media (min-width: 768px) {
    .mbs-modal-split {
        flex-direction: row;
        gap: 24px;
    }
}

.mbs-modal-image-panel {
    flex: none;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

@media (min-width: 768px) {
    .mbs-modal-image-panel {
        flex: 0 0 300px;
        width: 300px;
        position: sticky;
        top: 0;
        align-self: flex-start;
    }
}

.mbs-search-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 4px;
}

.mbs-search-image-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 8px;
}

.mbs-modal-results-panel {
    flex: 1;
    min-width: 0;
}

/* --- MBS See More Modal --- */
.mbs-see-more-modal .modal-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.mbs-see-more-modal .mbs-modal-stats {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
}

.mbs-see-more-modal .mbs-sort-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.mbs-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 768px) {
    .mbs-modal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .mbs-modal-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.mbs-see-more-modal .mud-dialog-content {
    max-height: 70vh;
    overflow-y: auto;
}

/* MBS modal card (extended info) */
.mbs-modal-card .mbs-card-details {
    padding: 4px 8px 6px;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
}

.mbs-modal-card .mbs-card-details .mbs-detail-row {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.mbs-modal-card .mbs-card-details .mbs-detail-label {
    color: rgba(255, 255, 255, 0.35);
}

.mbs-card-score {
    margin-top: 4px;
    padding: 0 8px 6px;
}

.mbs-score-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.mbs-score-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--mud-palette-primary);
    transition: width 0.3s ease;
}

.mbs-score-text {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

/* --- MBS Detail View --- */
.mbs-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.mbs-detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 768px) {
    .mbs-detail-content {
        flex-direction: row;
        gap: 24px;
    }
}

.mbs-detail-image-container {
    position: relative;
    flex: 1;
    min-height: 300px;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.mbs-detail-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mbs-detail-image img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

/* Overlay navigation arrows */
.mbs-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mbs-nav-arrow:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.75);
}

.mbs-nav-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.mbs-nav-left {
    left: 8px;
}

.mbs-nav-right {
    right: 8px;
}

/* Detail info panel */
.mbs-detail-info-panel {
    flex: 0 0 auto;
    min-width: 200px;
    padding: 8px 0;
}

@media (min-width: 768px) {
    .mbs-detail-info-panel {
        flex: 0 0 240px;
    }
}

.mbs-detail-info-panel .mbs-detail-row {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

.mbs-detail-info-panel .mbs-detail-label {
    color: rgba(255, 255, 255, 0.35);
}

/* Clickable result cards in grid */
.mbs-result-card.mbs-clickable {
    cursor: pointer;
}
