/*
    Ortak e-belge görüntüleyicisi (global).
    Kullananlar: Giden Belgeler çalışma ekranı (OutgoingElectronicDocumentsPage), gelen belge bağlam aksiyonları
    (Layout/IncomingElectronicDocumentContextActions) ve E-Belge Görüntüle sayfası (PDF/HTML segment seçici).
    Birden fazla bileşen kullandığı için izole CSS'e taşınmaz; değerler yalnız erp-design-tokens.css değişkenlerinden gelir.
*/

.edo-viewer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--erp-backdrop);
}

.edo-viewer-modal {
    width: min(1500px, 96vw);
    height: min(920px, 94vh);
    min-height: 520px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--erp-border-card);
    border-radius: var(--erp-radius-dialog);
    background: var(--erp-surface-card);
    box-shadow: var(--erp-shadow-dialog);
}

.edo-viewer-toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: var(--erp-space-6);
    min-height: 56px;
    padding: var(--erp-space-3) var(--erp-space-6);
    border-block-end: 1px solid var(--erp-border-card);
    background: var(--erp-surface-card);
}

.edo-viewer-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.edo-viewer-heading span {
    color: var(--erp-color-muted);
    font-size: var(--erp-font-size-eyebrow);
    font-weight: var(--erp-font-weight-bold);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.edo-viewer-heading strong {
    overflow: hidden;
    color: var(--erp-color-navy);
    font-size: var(--erp-font-size-section-title);
    font-weight: var(--erp-font-weight-semibold);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edo-viewer-format,
.edo-viewer-actions {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
}

/* PDF / HTML segment seçici. */
.edo-viewer-format {
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--erp-border-card);
    border-radius: var(--erp-radius-panel);
    background: var(--erp-surface-soft);
}

.edo-viewer-format-button {
    min-height: 26px;
    padding: 0 var(--erp-space-5);
    border: 1px solid transparent;
    border-radius: var(--erp-radius-field);
    background: transparent;
    color: var(--erp-color-text);
    font: inherit;
    font-size: var(--erp-font-size-label);
    font-weight: var(--erp-font-weight-semibold);
    cursor: pointer;
}

.edo-viewer-format-button:hover {
    background: var(--erp-surface-hover);
}

.edo-viewer-format-button.active {
    border-color: var(--erp-border-field);
    background: var(--erp-surface-card);
    color: var(--erp-color-navy);
}

.edo-viewer-format-button:focus-visible {
    outline: none;
    box-shadow: var(--erp-focus-ring);
}

/* Henüz ortak sınıfa geçmemiş görüntüleyici çağıranlar için (.edo-button) .secondary-button.erp-button-sm eşdeğeri. */
.edo-viewer-actions .edo-button {
    min-height: var(--erp-control-height-sm);
    padding: 0 var(--erp-space-5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid var(--erp-border-button);
    border-radius: var(--erp-radius-control);
    background: var(--erp-surface-card);
    color: var(--erp-color-navy);
    font: inherit;
    font-size: var(--erp-font-size-label);
    font-weight: var(--erp-font-weight-semibold);
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}

.edo-viewer-actions .edo-button:hover {
    background: var(--erp-surface-hover);
}

.edo-viewer-actions a.secondary-button {
    text-decoration: none;
}

.edo-viewer-canvas {
    min-height: 0;
    overflow: hidden;
    padding: var(--erp-space-4);
    background: var(--erp-surface-page);
}

.edo-viewer-canvas .edo-document-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 1px solid var(--erp-border-field);
    border-radius: var(--erp-radius-control);
    background: var(--erp-surface-card);
}

@media (max-width: 760px) {
    .edo-viewer-backdrop {
        padding: var(--erp-space-3);
    }

    .edo-viewer-modal {
        width: 100%;
        height: 96vh;
        min-height: 440px;
    }

    .edo-viewer-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: var(--erp-space-2);
    }

    .edo-viewer-format,
    .edo-viewer-actions {
        flex-wrap: wrap;
    }

    .edo-viewer-actions .edo-button,
    .edo-viewer-actions .secondary-button {
        flex: 1 1 auto;
    }
}
