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

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

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

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

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

.card-image-container .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;
}

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

.card-title {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

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

.skeleton-pulse {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-card .card-image-container {
    aspect-ratio: 4 / 3;
}

.skeleton-title {
    height: 12px;
    border-radius: 4px;
    width: 80%;
}

.skeleton-domain {
    height: 10px;
    border-radius: 4px;
    width: 50%;
    margin-top: 4px;
}

@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

.result-preview .best-guess-label {
    font-size: 0.75rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    padding: 0 2px;
}

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

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

.see-more-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: transparent;
    color: var(--mud-palette-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.see-more-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.see-more-modal .best-guess-label {
    font-size: 0.8125rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

.see-more-modal .section-header {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 16px 0 8px;
}

.see-more-modal .section-header:first-child {
    margin-top: 0;
}

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

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

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

/* --- Crop Modal --- */
.crop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
}

.crop-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.crop-container .crop-image {
    width: 100%;
    height: 100%;
}

.crop-hint {
    text-align: center;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
}

.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.5);
}

.crop-btn-cancel {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* --- Crop Thumbnail in Results --- */
.crop-thumbnail {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.crop-thumbnail img {
    max-height: 48px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.crop-thumbnail .crop-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* --- Crop Searching Status --- */
.crop-searching {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crop-searching-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
