/*
 * Inspection file preview modal layout.
 * Loaded after bundled scoped CSS (see App.razor) because MudOverlay portals
 * outside component scope and MudFileUpload uses height:100% on its input area.
 */

.preview-overlay-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    padding: 1rem;
    box-sizing: border-box;
}

/* Grid rows: header | divider | body (fills) | footer (content-sized, capped). */
.preview-overlay-panel {
    width: 90vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 90vh;
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-columns: 1fr;
    overflow: hidden;
    background-color: var(--mud-palette-surface);
    border-radius: var(--mud-default-borderradius);
    box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12);
}

.preview-overlay-panel > .preview-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    min-width: 0;
    gap: 1rem;
}

.preview-overlay-panel > .preview-overlay-body {
    min-height: 0 !important;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    background-color: var(--mud-palette-background);
}

.preview-overlay-panel > .preview-overlay-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--mud-palette-divider);
    height: auto !important;
    max-height: 5rem !important;
    min-height: 0 !important;
    overflow: visible;
    box-sizing: border-box;
}

.preview-overlay-footer-upload {
    height: auto !important;
    max-height: 4rem !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
}

.preview-overlay-footer-upload .mud-file-upload,
.preview-overlay-footer-upload .mud-input-control,
.preview-overlay-footer-upload .mud-input-control.mud-file-upload,
.preview-overlay-footer-upload .mud-input-control-input-container,
.preview-overlay-footer-upload .mud-input-control-input-container > div {
    height: auto !important;
    max-height: 4rem !important;
    min-height: 0 !important;
    flex-grow: 0 !important;
    align-items: center !important;
}

.preview-overlay-image-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-overlay-image-frame {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
    max-height: 100%;
}

.preview-overlay-image-display {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.preview-overlay-image-frame .mp-image-annotation-container.preview-overlay-annotation-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.preview-overlay-image-frame .mp-image-annotation-container.preview-overlay-annotation-layer .mp-image-annotation-image {
    opacity: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-overlay-image-frame .mp-image-annotation-container.preview-overlay-annotation-layer .mp-image-annotation-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    background: transparent;
}

.preview-overlay-video {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--mud-default-borderradius);
}

.preview-overlay-pdf {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--mud-default-borderradius);
}

.preview-overlay-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.preview-title-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
