/* ============================================================
   media-thumbnail.css
   Scoped styles for the Media Thumbnail editor component.
   Placed alongside MediaThumbnail.razor in Tevarai.Base.Presentation
   ============================================================ */

/* --- Root wrapper ------------------------------------------ */
.media-thumbnail-wrapper {
    --thumb-radius: 6px;
    --thumb-border: 1px solid #e0e0e0;
    --thumb-bg: #f7f7f8;
    --thumb-icon-color: #8a8fa8;
    --thumb-text-color: #555;
    --thumb-shadow: 0 1px 4px rgba(0,0,0,0.08);
    --thumb-overlay-bg: rgba(15,15,20,0.55);
    --thumb-transition: 0.18s ease;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--thumb-radius);
    border: var(--thumb-border);
    background: var(--thumb-bg);
    box-shadow: var(--thumb-shadow);
    overflow: hidden;
    position: relative;
    transition: box-shadow var(--thumb-transition);
}

.media-thumbnail-wrapper:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.13);
}

/* --- Sizes -------------------------------------------------- */
.media-thumb-sm {
    width: 48px;
    height: 48px;
    min-width: 48px;
}

.media-thumb-md {
    width: 80px;
    height: 80px;
    min-width: 80px;
}

.media-thumb-lg {
    width: 200px;
    height: 160px;
    min-width: 200px;
}

/* --- Skeleton / Loading ------------------------------------- */

.media-thumbnail-wrapper.is-loading {
    align-items: stretch;
    justify-content: stretch;
}

.media-thumbnail-skeleton {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #ececec;
}

.skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.55) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

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

/* --- Image -------------------------------------------------- */
.media-thumbnail-image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.media-thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--thumb-transition);
}

.media-thumbnail-wrapper:hover .media-thumbnail-img {
    transform: scale(1.04);
}

/* Date overlay on images */
.media-thumbnail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--thumb-overlay-bg);
    padding: 3px 5px;
    opacity: 0;
    transition: opacity var(--thumb-transition);
}

.media-thumbnail-wrapper:hover .media-thumbnail-overlay {
    opacity: 1;
}

.media-filename-overlay {
    font-size: 9px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* --- Placeholder (file icon) -------------------------------- */
.media-thumbnail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.media-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--thumb-icon-color);
    transition: color var(--thumb-transition);
}

.media-thumbnail-wrapper:hover .media-type-icon {
    color: #5a6282;
}

/* Scale icon SVG relative to container */
.media-thumb-sm .media-type-icon svg  { width: 24px; height: 24px; }
.media-thumb-md .media-type-icon svg  { width: 36px; height: 36px; }
.media-thumb-lg .media-type-icon svg  { width: 52px; height: 52px; }

/* --- Date label --------------------------------------------- */
.media-filename {
    font-size: 9px;
    color: var(--thumb-text-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.media-thumb-sm .media-filename {
    display: none; /* too small for label */
}

/* --- Error state -------------------------------------------- */
.media-thumbnail-wrapper.has-error {
    border-color: #f5c2c7;
    background: #fff5f5;
}

.media-thumbnail-wrapper.has-error .media-type-icon {
    color: #c5808a;
}

/* --- Dark theme support (XAF Blazor dark mode) -------------- */
@media (prefers-color-scheme: dark) {
    .media-thumbnail-wrapper {
        --thumb-border: 1px solid #3a3a4a;
        --thumb-bg: #1e1e2a;
        --thumb-icon-color: #7a7f9a;
        --thumb-text-color: #aaa;
        --thumb-shadow: 0 1px 4px rgba(0,0,0,0.3);
    }

    .media-thumbnail-skeleton {
        background: #2a2a38;
    }

    .media-thumbnail-wrapper.has-error {
        border-color: #6b3040;
        background: #2a1a1e;
    }
}