/*
 * Web Viewer - Oberfläche der Vorschau. Farben aus den EspoCRM-Theme-Variablen bzw. aus currentColor
 * abgeleitet, damit helle und dunkle Themes passen. Die PDF.js-Stile liegen gekapselt unter .wv-pdf
 * (vendor/pdfjs/web/pdf_viewer.css) und werden erst beim ersten PDF geladen.
 */

.wv-panel [hidden],
.wv-viewer [hidden] {
    display: none !important;
}

.wv-tabs {
    margin-bottom: 8px;
}

.wv-banner {
    margin: 0 0 8px;
    padding: 6px 10px;
    border-left: 3px solid var(--brand-success, #5cb85c);
    border-radius: var(--border-radius, 4px);
    background: color-mix(in srgb, var(--brand-success, #5cb85c) 12%, transparent);
}

.wv-viewer {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wv-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.wv-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wv-group.btn-group {
    gap: 0;
}

.wv-toolbar .form-control.input-sm {
    display: inline-block;
    width: auto;
    height: var(--input-height-small, 30px);
}

.wv-zoom-select {
    min-width: 130px;
    border-radius: 0;
}

.wv-page-input {
    width: 70px !important;
}

.wv-search-input {
    width: 170px !important;
}

.wv-page-total,
.wv-search-info {
    font-size: var(--font-size-small, 12px);
    color: var(--text-muted-color, #777);
    white-space: nowrap;
}

.wv-spacer {
    flex: 1 1 auto;
}

.wv-status {
    font-size: var(--font-size-small, 12px);
    color: var(--text-muted-color, #777);
    padding: 0 2px;
}

.wv-stage {
    position: relative;
    height: 75vh;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid var(--default-border-color, #ddd);
    border-radius: var(--border-radius, 4px);
    background: color-mix(in srgb, currentColor 7%, transparent);
}

.wv-compact .wv-stage {
    height: 55vh;
    min-height: 280px;
}

.wv-viewer.wv-fullscreen {
    height: 100vh;
    padding: 8px;
    background: var(--body-bg, #fff);
}

.wv-viewer.wv-fullscreen .wv-stage {
    flex: 1 1 auto;
    height: auto;
}

/* ---- Inhalte ---------------------------------------------------------------------------------------- */

.wv-pdf,
.wv-pdf-container,
.wv-scroll,
.wv-sheet,
.wv-frame {
    position: absolute;
    inset: 0;
}

.wv-pdf-container,
.wv-scroll {
    overflow: auto;
}

.wv-pdf-container:focus,
.wv-scroll:focus {
    outline: none;
}

.wv-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.wv-image-scroll {
    display: flex;
    padding: 12px;
}

.wv-image-frame {
    position: relative;
    flex: 0 0 auto;
    margin: auto;
}

.wv-image {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
    background: repeating-conic-gradient(#e8e8e8 0 25%, #fff 0 50%) 50% / 16px 16px;
}

.wv-code {
    margin: 0;
    padding: 12px 14px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
}

.wv-xml-tag { color: #2f8f46; }
.wv-xml-attr { color: #8a63d2; }
.wv-xml-value { color: #2f7fc4; }
.wv-xml-comment { color: #8b949e; }

.wv-note {
    padding: 6px 12px;
    font-size: var(--font-size-small, 12px);
    color: var(--text-muted-color, #777);
    border-bottom: 1px solid var(--default-border-color, #ddd);
}

.wv-message {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    overflow: auto;
    text-align: center;
}

.wv-message p {
    margin: 0;
    max-width: 640px;
}

.wv-password .form-control {
    max-width: 320px;
}

.wv-password-error {
    min-height: 18px;
    font-size: var(--font-size-small, 12px);
}

.wv-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.wv-watermark {
    position: absolute;
    right: 14px;
    bottom: 10px;
    z-index: 5;
    font-size: 12px;
    color: rgba(0, 0, 0, .38);
    text-shadow: 0 0 2px rgba(255, 255, 255, .9);
    pointer-events: none;
    user-select: none;
}

/* ---- Tabellen --------------------------------------------------------------------------------------- */

.wv-sheet {
    display: flex;
    flex-direction: column;
}

.wv-sheet .wv-scroll {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.wv-sheet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
}

.wv-table {
    border-collapse: collapse;
    font-size: 12px;
    background: #fff;
    color: #222;
}

.wv-table th,
.wv-table td {
    max-width: 480px;
    padding: 2px 6px;
    border: 1px solid #d4d4d4;
    vertical-align: top;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.wv-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f1f1;
    text-align: center;
}

.wv-table tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #f1f1f1;
    color: #666;
    text-align: right;
}

.wv-table .wv-corner {
    left: 0;
    z-index: 3;
}

/* ---- Textvorschau (PPTX, ODP, ODT) ------------------------------------------------------------------ */

.wv-outline {
    max-width: 960px;
    padding: 0 0 12px;
}

.wv-outline-section {
    padding: 8px 18px;
    border-bottom: 1px solid var(--default-border-color, #ddd);
}

.wv-outline-section h4 {
    margin: 4px 0 6px;
}

.wv-outline-section p {
    margin: 0 0 4px;
}

.wv-outline-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.wv-outline-images img {
    max-width: 100%;
    max-height: var(--wv-outline-image-height, 360px);
    border: 1px solid var(--default-border-color, #ddd);
    background: #fff;
}

/* ---- Bestandteile ----------------------------------------------------------------------------------- */

.wv-parts-section h5 {
    margin: 4px 0 6px;
    font-weight: 600;
}

.wv-parts-table td {
    vertical-align: middle !important;
}

.wv-parts-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.wv-inline-label {
    margin-left: 6px;
}

.wv-parts-hint {
    margin-top: 4px;
}

.wv-parts-preview {
    margin-top: 12px;
}

.wv-parts-preview-title {
    margin-bottom: 4px;
    font-weight: 600;
}

/* ---- PDF.js ----------------------------------------------------------------------------------------- */

.wv-pdf .pdfViewer {
    padding: 8px 0;
}

.wv-pdf .pdfViewer .page {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

/* Umschalter der Quelle (EspoCRM / angemeldete Quelle wie ecoDMS) */
.wv-sources {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}
