﻿html.attachment-open {
    overflow: hidden;
}

.attachment-viewer {
    box-sizing: border-box;
    position: fixed;
    width: min(1000px, calc(100vw - 32px));
    height: 90vh;
    height: 90dvh;
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    border: 1px solid #d4af4f;
    border-radius: 12px;
    background: #26282c;
    color: #fff;
    box-shadow: 0 20px 70px #0008;
}

    .attachment-viewer[open] {
        display: flex;
        flex-direction: column;
    }

    .attachment-viewer::backdrop {
        background: #000b;
    }

.attachment-header,
.attachment-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #d4af4f55;
    flex-shrink: 0;
}

    .attachment-header strong {
        flex: 1;
        font-size: .9rem;
    }

    .attachment-header button,
    .attachment-header a,
    .attachment-controls button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        min-width: 36px;
        padding: 4px 9px;
        border: 1px solid #d4af4f;
        border-radius: 6px;
        background: transparent;
        color: #f1d78a;
        font: inherit;
        font-size: .75rem;
        text-decoration: none;
        cursor: pointer;
    }

        .attachment-header button:hover,
        .attachment-header a:hover,
        .attachment-controls button:hover {
            background: #ffffff12;
        }

.attachment-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
}

    .attachment-controls span {
        min-width: 40px;
        font-size: .75rem;
        text-align: center;
    }

    .attachment-controls button:disabled {
        opacity: .4;
        cursor: default;
    }

.attachment-message {
    margin: 0;
    padding: 10px;
    font-size: .8rem;
    color: #d1d5db;
}

    .attachment-message:empty {
        display: none;
    }

.attachment-pages {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    background: #45464a;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

    .attachment-pages canvas {
        display: block;
        margin: 0 auto;
        background: #fff;
    }

.attachment-viewer [hidden] {
    display: none !important;
}

@media (max-width: 639px) {
    .attachment-viewer {
        width: calc(100vw - 12px);
        height: 94vh;
        height: 94dvh;
        border-radius: 8px;
    }

    .attachment-header {
        gap: 6px;
        padding: 6px;
    }

        .attachment-header strong {
            font-size: .8rem;
        }

    .attachment-controls {
        padding: 5px;
    }
}

@media print {
    .attachment-viewer {
        display: none !important;
    }
}
