/* Dokumentenablage (Modules/Dokumente). Global eingebunden, weil Scoped CSS in dieser App nicht geladen wird. */

.dokumente-titel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 12px 0 16px;
}

/* ---------------------------------------------------------------- Übersicht */

.dokumente-schnellzugriff {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.dokumente-schnell-kachel {
    display: block;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #2563eb;
    border-radius: 6px;
    background: #fff;
    color: inherit;
    text-decoration: none;
}

.dokumente-schnell-kachel:hover {
    background: #f8faff;
    border-color: #2563eb;
    color: inherit;
}

.dokumente-anfrage {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.dokumente-anfrage:last-child {
    border-bottom: none;
}

.dokumente-aktionen {
    display: flex;
    gap: 6px;
}

.dokumente-kacheln {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.dokumente-kachel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.dokumente-kachel:hover {
    border-color: #2563eb;
    background: #f8faff;
}

.dokumente-kachel .bi {
    font-size: 1.6rem;
    color: #2563eb;
}

/* ---------------------------------------------------------------- Kundenseite */

.dokumente-kopfzeile {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.dokumente-kopfzeile .dokumente-titel {
    margin-bottom: 0;
}

/* Ansprechpartner des gewählten Projekts, rechts oben */
.dokumente-ansprechpartner {
    flex: 0 1 560px;
    min-width: 280px;
    margin-top: 12px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.dokumente-ansprechpartner-kopf {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.dokumente-kontakt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid #f1f1f1;
}

.dokumente-kontakt > .bi {
    font-size: 1.5rem;
    color: #6b7280;
}

.dokumente-kontakt-wege {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
}

.dokumente-kontakt-wege a {
    text-decoration: none;
    white-space: nowrap;
}

/* Schnellauswahl bekannter Ansprechpartner im Dialog */
.dokumente-vorschlaege {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
    max-height: 220px;
    overflow-y: auto;
}

.dokumente-vorschlag {
    display: flex;
    align-items: baseline;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    border: none;
    background: none;
    text-align: left;
}

.dokumente-vorschlag:hover {
    background: #eff6ff;
}

.dokumente-projekt {
    padding: 8px 10px;
    border-left: 3px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.dokumente-projekt:hover {
    background: #f3f4f6;
}

.dokumente-projekt.aktiv {
    background: #eff6ff;
    border-left-color: #2563eb;
}

.dokumente-projekt.ausgeblendet {
    opacity: 0.7;
}

.dokumente-projekt-kopf {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.dokumente-favorit {
    color: #f59e0b;
    margin-right: 2px;
}

/* ⋯ rechts in der Projektzeile: dezent, beim Überfahren und am gewählten Projekt deutlicher */
.dokumente-projekt-menue {
    padding: 0 4px;
    margin: -2px -4px 0 0;
    line-height: 1.4;
    color: #9ca3af;
    border: none;
}

.dokumente-projekt:hover .dokumente-projekt-menue,
.dokumente-projekt.aktiv .dokumente-projekt-menue {
    color: #374151;
}

.dokumente-projekt-menue:hover {
    background: #e5e7eb;
}

.dokumente-ausgeblendet-schalter {
    display: block;
    margin-top: 8px;
    padding: 4px 10px;
    color: #6b7280;
    text-decoration: none;
}

.dokumente-ausgeblendet-schalter:hover {
    color: #374151;
}

/* ---------------------------------------------------------------- Ordner-Browser */

.dokumente-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

/* Groß und mit Abstand zu den Buttons, damit man sich nicht verklickt */
.dokumente-pfad {
    font-size: 1.25rem;
    line-height: 1.4;
}

.dokumente-suche {
    position: relative;
    flex: 0 1 300px;
}

.dokumente-suche .bi {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

.dokumente-suche input {
    padding-left: 30px;
}

.dokumente-werkzeuge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.dokumente-upload {
    margin-bottom: 8px;
}

.dokumente-upload .progress {
    height: 6px;
}

.dokumente-dropbox {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 14px 18px;
    border: 2px dashed #93c5fd;
    border-radius: 8px;
    background: #f8faff;
    color: #1e40af;
    cursor: pointer;
}

.dokumente-dropbox .bi {
    font-size: 1.8rem;
}

.dokumente-dropbox:hover,
.dokumente-dropbox.aktiv {
    border-color: #2563eb;
    background: #eff6ff;
}

.dokumente-dropzone {
    position: relative;
    min-height: 160px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.dokumente-dropzone-hinweis {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    border: 2px dashed #2563eb;
    border-radius: 6px;
    color: #2563eb;
    font-weight: 600;
    pointer-events: none;
}

.dokumente-dropzone.aktiv .dokumente-dropzone-hinweis {
    display: flex;
}

/* Ganze Zeile klickbar: der Link im Namen deckt per .stretched-link die Zeile ab */
.dokumente-liste tbody tr {
    position: relative;
}

.dokumente-liste td {
    vertical-align: middle;
}

.dokumente-liste a {
    text-decoration: none;
}

/* Buttons liegen über dem Zeilen-Link */
.dokumente-aktion {
    position: relative;
    z-index: 2;
}

.dokumente-ordner-icon {
    color: #d4a72c;
}

/* Textausschnitt bei Volltexttreffern */
.dokumente-ausschnitt {
    margin-top: 2px;
    white-space: normal;
}

.dokumente-ausschnitt mark {
    padding: 0 1px;
    background: #fde68a;
    color: inherit;
}

/* Kachelansicht (wie im Explorer) */
.dokumente-kachelraster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    padding: 12px;
}

.dokumente-kachel-datei {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.dokumente-kachel-datei:hover {
    background: #f3f4f6;
}

.dokumente-kachel-datei img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    background: #f3f4f6;
}

.dokumente-kachel-datei > div {
    width: 100%;
}

.dokumente-kachel-icon {
    display: block;
    font-size: 4rem;
    line-height: 120px;
    height: 120px;
}

/* Verlauf (zuletzt hochgeladen/bearbeitet) – durch einen Strich von der Ordnerliste abgesetzt */
.dokumente-verlauf {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid #d1d5db;
}

.dokumente-verlauf-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.dokumente-verlauf .dokumente-liste {
    border: 1px solid #e5e7eb;
    background: #fff;
}

/* ---------------------------------------------------------------- E-Mail-Tab (Outlook-Stil) */

.dokumente-mail-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.dokumente-mail-werkzeuge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dokumente-mail-ansicht {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) 3fr;
    gap: 12px;
    height: 70vh;
    min-height: 420px;
}

@media (max-width: 900px) {
    .dokumente-mail-ansicht {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.dokumente-mail-liste {
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    outline: none;
}

.dokumente-mail-eintrag {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #f1f1f1;
    border-left: 3px solid transparent;
    background: none;
    text-align: left;
}

.dokumente-mail-eintrag:hover {
    background: #f8faff;
}

.dokumente-mail-eintrag.aktiv {
    background: #eff6ff;
    border-left-color: #2563eb;
}

.dokumente-mail-eintrag.ausgeblendet {
    opacity: 0.6;
}

.dokumente-mail-zeile {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.dokumente-mail-vorschau {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dokumente-mail-lesen {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.dokumente-mail-lesen-kopf {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    overflow-wrap: anywhere;
}

.dokumente-mail-anhaenge {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.dokumente-mail-anhang {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafafa;
}

.dokumente-mail-anhang > .bi {
    font-size: 1.4rem;
}

/* Noch in keinem Projektordner: rot. Abgelegt: grüner Vermerk */
.dokumente-mail-anhang.nicht-abgelegt {
    border-color: #dc3545;
    background: #fdecee;
}

.dokumente-mail-anhang.nicht-abgelegt > .bi,
.dokumente-mail-anhang.nicht-abgelegt .dokumente-mail-anhang-status {
    color: #b02a37;
}

.dokumente-mail-anhang.abgelegt .dokumente-mail-anhang-status {
    color: #198754;
}

.dokumente-mail-anhang-status {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dokumente-mail-offen {
    color: #dc3545;
    font-weight: 600;
}

.dokumente-mail-anhang a {
    text-decoration: none;
}

/* Lange Dateinamen auf bis zu zwei Zeilen statt hart abgeschnitten; voller Name als Tooltip */
.dokumente-mail-anhang-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

/* Ordnerauswahl beim Ablegen eines Anhangs */
.dokumente-ordnerauswahl {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.dokumente-ordnerauswahl-eintrag {
    display: block;
    width: 100%;
    padding: 6px 12px;
    border: none;
    border-bottom: 1px solid #f1f1f1;
    background: none;
    text-align: left;
}

.dokumente-ordnerauswahl-eintrag:hover {
    background: #eff6ff;
}

.dokumente-mail-inhalt {
    flex: 1;
    width: 100%;
    min-height: 300px;
    border: none;
}

/* ---------------------------------------------------------------- Vorschau (Bilder, PDF) */

/* Die Vorschau läuft als Vollbild-Dialog (Radzen) auf oberster Ebene */
/* Über einer offenen Seitenleiste (Letzte Aktivitäten), die dieselbe Ebene wie normale Dialoge hat */
.dokumente-vorschau-ebene {
    z-index: calc(var(--rz-dialog-zindex) + 2);
}

.rz-dialog.dokumente-vorschau-dialog {
    padding: 0;
    border-radius: 0;
    background: #111827;
    max-width: none;
    max-height: none;
}

.rz-dialog.dokumente-vorschau-dialog .rz-dialog-content {
    padding: 0;
    height: 100%;
    overflow: hidden;
}

.dokumente-vorschau {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #111827;
    color: #fff;
    outline: none;
}

.dokumente-vorschau-kopf {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.35);
}

.dokumente-vorschau-inhalt {
    position: relative;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dokumente-vorschau-inhalt > img {
    max-width: calc(100% - 120px);
    max-height: calc(100% - 24px);
    object-fit: contain;
}

/* PDF-Ansicht (dokumente.js): Werkzeugleiste oben, darunter die scrollbare Seitenspalte */
.dokumente-vorschau-pdf {
    width: 100%;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.dokumente-vorschau-pdf > .spinner-border {
    align-self: center;
}

.dokumente-pdf-leiste {
    position: relative;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 20px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dokumente-pdf-gruppe {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dokumente-pdf-leiste button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #fff;
}

.dokumente-pdf-leiste button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.dokumente-pdf-leiste input,
.dokumente-pdf-leiste select {
    height: 30px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.dokumente-pdf-leiste select option {
    color: #000;
}

.dokumente-pdf-seitenfeld {
    width: 56px;
    text-align: center;
}

.dokumente-pdf-suche input {
    width: 210px;
}

.dokumente-pdf-treffer {
    min-width: 72px;
    font-size: 0.85rem;
    opacity: 0.8;
    white-space: nowrap;
}

.dokumente-pdf-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable;
}

/* Breiter als das Fenster (gezoomt): Spalte wächst mit, sonst mittig */
.dokumente-pdf-seiten {
    position: relative;
    box-sizing: border-box;
    width: max-content;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 72px;
}

.dokumente-pdf-seite {
    position: relative;
    flex: none;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.dokumente-pdf-seite canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Textebene von pdf.js 3.11 (aus pdf_viewer.css): unsichtbarer Text über dem Bild zum Markieren und Kopieren */
.dokumente-pdf-seite .textLayer {
    position: absolute;
    text-align: initial;
    inset: 0;
    overflow: hidden;
    line-height: 1;
    text-size-adjust: none;
    forced-color-adjust: none;
    transform-origin: 0 0;
    z-index: 2;
}

.dokumente-pdf-seite .textLayer :is(span, br) {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0 0;
}

.dokumente-pdf-seite .textLayer span.markedContent {
    top: 0;
    height: 0;
}

.dokumente-pdf-seite .textLayer ::selection {
    background: rgba(0, 100, 255, 0.3);
}

.dokumente-pdf-seite .textLayer br::selection {
    background: transparent;
}

.dokumente-pdf-seite .textLayer .endOfContent {
    display: block;
    position: absolute;
    inset: 100% 0 0;
    z-index: -1;
    cursor: default;
    user-select: none;
}

.dokumente-pdf-seite .textLayer .endOfContent.active {
    top: 0;
}

.dokumente-pdf-seite .textLayer[data-main-rotation="90"] {
    transform: rotate(90deg) translateY(-100%);
}

.dokumente-pdf-seite .textLayer[data-main-rotation="180"] {
    transform: rotate(180deg) translate(-100%, -100%);
}

.dokumente-pdf-seite .textLayer[data-main-rotation="270"] {
    transform: rotate(270deg) translateX(-100%);
}

/* Suchtreffer */
.dokumente-pdf-seite .textLayer .treffer {
    background: rgba(255, 190, 0, 0.45);
    border-radius: 2px;
}

.dokumente-vorschau-pfeil {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
}

.dokumente-vorschau-pfeil:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dokumente-vorschau-pfeil.links {
    left: 16px;
}

.dokumente-vorschau-pfeil.rechts {
    right: 16px;
}
