/* ===================================================
   FILE VIEWER DIALOG  –  Prefix: fxfv-
   Matches FiberX design system
   =================================================== */

/* ===== Dialog ===== */
.fxfv-dialog {
    border-radius: 16px !important;
    overflow: hidden !important;
    max-height: 92vh !important;
}

.fxfv-dialog .mud-dialog-content {
    padding: 0 !important;
    overflow: hidden !important;
}

.fxfv-dialog .mud-dialog-title {
    padding: 0 !important;
}

/* ===== Header ===== */
.fxfv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #2D2350, #4B3E7B);
    padding: 16px 20px;
    margin: -24px -24px 0;
}

.fxfv-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.fxfv-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fxfv-header-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fxfv-header-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .5);
    font-weight: 600;
    letter-spacing: .5px;
}

.fxfv-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.fxfv-btn-download {
    color: #4ADE80 !important;
    background: rgba(74, 222, 128, .1) !important;
    border-radius: 8px !important;
}

.fxfv-btn-download:hover {
    background: rgba(74, 222, 128, .2) !important;
}

.fxfv-btn-newtab {
    color: #38BDF8 !important;
    background: rgba(56, 189, 248, .1) !important;
    border-radius: 8px !important;
}

.fxfv-btn-newtab:hover {
    background: rgba(56, 189, 248, .2) !important;
}

.fxfv-btn-close {
    color: rgba(255, 255, 255, .6) !important;
    border-radius: 8px !important;
}

.fxfv-btn-close:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .1) !important;
}

/* ===== Body ===== */
.fxfv-body {
    min-height: 300px;
    max-height: calc(92vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0F0D1A;
    overflow: hidden;
}

/* ===== Loading ===== */
.fxfv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 24px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #9CA3AF;
}

/* ===== Error ===== */
.fxfv-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 24px;
    text-align: center;
}

.fxfv-error-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: #fff;
}

.fxfv-error-msg {
    font-size: 13px;
    color: #9CA3AF;
    max-width: 360px;
}

.fxfv-btn-retry {
    color: #fff !important;
    border-color: rgba(255, 255, 255, .2) !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    margin-top: 8px;
}

.fxfv-btn-retry:hover {
    border-color: rgba(255, 255, 255, .4) !important;
    background: rgba(255, 255, 255, .05) !important;
}

/* ===== Image Viewer ===== */
.fxfv-image-wrap {
    position: relative;
    width: 100%;
    height: calc(92vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 16px;
}

.fxfv-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    transition: opacity .3s;
}

.fxfv-image-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 13, 26, .8);
}

/* ===== PDF Viewer ===== */
.fxfv-iframe {
    width: 100%;
    height: calc(92vh - 80px);
    border: none;
    background: #fff;
}

/* ===== No Preview (download fallback) ===== */
.fxfv-no-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 24px;
    text-align: center;
}

.fxfv-no-preview-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    background: rgba(75, 62, 123, .15);
    border: 2px solid rgba(75, 62, 123, .2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fxfv-no-preview-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    word-break: break-all;
    max-width: 400px;
}

.fxfv-no-preview-ext {
    font-size: 13px;
    color: #9CA3AF;
}

.fxfv-btn-dl-large {
    background: linear-gradient(135deg, #FF7850, #FF9575) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    padding: 0 28px !important;
    height: 44px !important;
    box-shadow: 0 4px 16px rgba(255, 120, 80, .35) !important;
    margin-top: 8px;
}

.fxfv-btn-dl-large:hover {
    filter: brightness(1.08) !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .fxfv-body {
        max-height: calc(100vh - 80px);
    }

    .fxfv-image-wrap {
        height: calc(100vh - 80px);
        padding: 8px;
    }

    .fxfv-iframe {
        height: calc(100vh - 80px);
    }

    .fxfv-header-title {
        font-size: 12px;
    }
}
