/*
 * Export von Tabellen (US 77831), siehe js/table_export.js
 * ID-Selektoren, weil der Button hinter der jeweiligen Tabelle im DOM steht
 * und sonst Panel-Regeln wie ".box button" greifen würden.
 */

#tableExportBtn {
    position: fixed;
    z-index: 1002;
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #b8c6d6;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.95);
    color: #1a6bb8;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

#tableExportBtn.visible,
#tableExportBtn:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

#tableExportBtn[hidden],
#tableExportMenu[hidden] {
    display: none;
}

#tableExportBtn:hover,
#tableExportBtn:focus-visible {
    background-color: #1a6bb8;
    border-color: #1a6bb8;
    color: #fff;
}

#tableExportMenu {
    position: fixed;
    z-index: 1003;
    min-width: 160px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    font-size: 13px;
}

#tableExportMenu button {
    padding: 7px 12px;
    border: none;
    border-radius: 4px;
    background: none;
    color: #222;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

#tableExportMenu button:hover,
#tableExportMenu button:focus-visible {
    background-color: #e6eef7;
    outline: none;
}

#tableExportMenu .table-export-status {
    padding: 0 12px;
    color: #2b7a2b;
    font-size: 12px;
}

#tableExportMenu .table-export-status:not(:empty) {
    padding: 4px 12px 6px;
}

#tableExportMenu .table-export-status.error {
    color: #b00020;
}

html[data-theme="dark"] #tableExportBtn {
    background-color: rgba(40, 44, 52, 0.95);
    border-color: #4a5462;
    color: #8ab8e6;
}

html[data-theme="dark"] #tableExportBtn:hover,
html[data-theme="dark"] #tableExportBtn:focus-visible {
    background-color: #2f6fae;
    border-color: #2f6fae;
    color: #fff;
}

html[data-theme="dark"] #tableExportMenu {
    background-color: #2a2e35;
    border-color: #4a5462;
}

html[data-theme="dark"] #tableExportMenu button {
    color: #e2e6ea;
}

html[data-theme="dark"] #tableExportMenu button:hover,
html[data-theme="dark"] #tableExportMenu button:focus-visible {
    background-color: #3a414b;
}

html[data-theme="dark"] #tableExportMenu .table-export-status {
    color: #7fcf7f;
}

html[data-theme="dark"] #tableExportMenu .table-export-status.error {
    color: #ff8a8a;
}

@media print {
    #tableExportBtn,
    #tableExportMenu {
        display: none !important;
    }
}
