:root {
    --red: #c61d25;
    --red-dark: #a9151c;
    --red-soft: #fff1f2;

    --bg: #f4f5f7;
    --panel: #ffffff;
    --border: #e7e8eb;

    --text: #17181b;
    --muted: #747780;

    --sidebar: 258px;

    --shadow:
        0 20px 50px rgba(20, 20, 25, .10);
}


/* RESET */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 0%,
            #ffffff 0,
            #f7f7f8 45%,
            #f0f1f3 100%
        );

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
}


/* APP */

#app {
    width: 100%;
    height: 100%;
}


/* TOPBAR */

.topbar {
    position: relative;
    z-index: 20;

    height: 64px;

    display: grid;

    grid-template-columns:
        260px
        1fr
        260px;

    align-items: center;

    padding: 0 22px;

    background: rgba(255,255,255,.94);

    border-bottom:
        1px solid var(--border);

    backdrop-filter:
        blur(18px);
}


/* BRAND */

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-logo {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background:
        linear-gradient(
            145deg,
            #df2931,
            #b5121a
        );

    color: white;

    font-size: 16px;
    font-weight: 800;

    box-shadow:
        0 7px 18px
        rgba(198,29,37,.22);
}

.brand-copy {
    min-width: 0;
}

.brand-name {
    font-size: 14px;
    font-weight: 750;

    line-height: 17px;
}

.brand-subtitle {
    margin-top: 1px;

    color: var(--muted);

    font-size: 10px;
    line-height: 12px;
}


/* DOCUMENT TITLE */

.document-title {
    text-align: center;

    overflow: hidden;

    color: #4d5058;

    font-size: 12px;
    font-weight: 600;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
}


/* BUTTON */

.toolbar-btn {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: white;

    color: #464850;

    cursor: pointer;

    transition:
        .18s ease;
}

.toolbar-btn:hover {
    color: var(--red);

    border-color:
        rgba(198,29,37,.25);

    background:
        var(--red-soft);
}

.toolbar-btn svg {
    width: 17px;
    height: 17px;

    fill: none;

    stroke: currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
}


/* VIEWER LAYOUT */

.viewer-layout {
    width: 100%;
    height: calc(100% - 64px);

    display: flex;
}


/* SIDEBAR */

.sidebar {
    position: relative;

    width: var(--sidebar);

    flex: 0 0 var(--sidebar);

    display: flex;
    flex-direction: column;

    background:
        rgba(249,249,250,.96);

    border-right:
        1px solid var(--border);

    transition:
        width .25s ease,
        flex-basis .25s ease;
}

.sidebar-header {
    min-height: 68px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding: 15px 17px;

    border-bottom:
        1px solid var(--border);
}

.sidebar-title {
    font-size: 13px;
    font-weight: 750;
}

.sidebar-count {
    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}

.sidebar-close {
    display: none;

    border: 0;
    background: none;

    font-size: 24px;

    color: #777;

    cursor: pointer;
}


/* THUMBNAILS */

.thumbnails {
    flex: 1;

    overflow-y: auto;

    padding:
        18px
        14px
        28px;
}

.thumbnails::-webkit-scrollbar,
.pdf-viewport::-webkit-scrollbar {
    width: 7px;
}

.thumbnails::-webkit-scrollbar-thumb,
.pdf-viewport::-webkit-scrollbar-thumb {
    background: #d4d5d8;

    border-radius: 10px;
}

.thumbnail {
    width: 100%;

    margin-bottom: 17px;

    cursor: pointer;

    text-align: center;
}

.thumbnail-page {
    position: relative;

    width: 100%;

    padding: 6px;

    border:
        1px solid #dedfe3;

    border-radius: 8px;

    background: white;

    box-shadow:
        0 3px 10px
        rgba(0,0,0,.05);

    transition:
        .18s ease;
}

.thumbnail:hover .thumbnail-page {
    border-color:
        rgba(198,29,37,.4);

    transform:
        translateY(-1px);
}

.thumbnail.active .thumbnail-page {
    border:
        2px solid var(--red);

    padding: 5px;

    box-shadow:
        0 7px 20px
        rgba(198,29,37,.14);
}

.thumbnail canvas {
    display: block;

    width: 100%;
    height: auto;

    border-radius: 4px;
}

.thumbnail-number {
    margin-top: 7px;

    color: #666;

    font-size: 10px;
    font-weight: 650;
}

.thumbnail.active .thumbnail-number {
    color: var(--red);
}


/* DOCUMENT AREA */

.document-area {
    position: relative;

    flex: 1;

    min-width: 0;
    min-height: 0;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            #f5f6f8 0%,
            #eceef1 100%
        );
}


/* PDF VIEWPORT */

.pdf-viewport {
    width: 100%;
    height: 100%;

    overflow: auto;

    padding:
        32px
        32px
        105px;

    scroll-behavior: smooth;
}

.pdf-pages {
    width: fit-content;

    min-width: 100%;

    margin: 0 auto;
}


/* PDF PAGE */

.pdf-page {
    position: relative;

    width: fit-content;

    margin:
        0 auto
        28px;

    background: white;

    box-shadow:
        0 8px 28px
        rgba(20,25,35,.14);

    border-radius: 2px;

    overflow: hidden;
}

.pdf-page canvas {
    display: block;
}


/* PAGE NUMBER */

.pdf-page-label {
    position: absolute;

    bottom: 10px;
    left: 50%;

    transform:
        translateX(-50%);

    padding:
        4px
        9px;

    border-radius: 20px;

    background:
        rgba(30,30,32,.72);

    color: white;

    font-size: 9px;

    opacity: 0;

    transition:
        opacity .2s ease;
}

.pdf-page:hover .pdf-page-label {
    opacity: 1;
}


/* IMAGE */

.image-viewport {
    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 35px;

    overflow: auto;
}

.image-viewport img {
    display: block;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    border-radius: 4px;

    box-shadow:
        0 12px 40px
        rgba(20,25,35,.14);
}


/* BOTTOM TOOLBAR */

.bottom-toolbar {
    position: absolute;

    z-index: 15;

    left: 50%;
    bottom: 18px;

    transform:
        translateX(-50%);

    height: 50px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding:
        6px 10px;

    background:
        rgba(255,255,255,.96);

    border:
        1px solid #e0e1e4;

    border-radius: 15px;

    box-shadow:
        0 10px 35px
        rgba(20,20,25,.14);

    backdrop-filter:
        blur(16px);
}

.toolbar-group {
    display: flex;
    align-items: center;

    gap: 4px;
}

.toolbar-divider {
    width: 1px;
    height: 25px;

    background:
        #e2e3e5;
}


/* CONTROLS */

.control-btn,
.zoom-value {
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 9px;

    background: transparent;

    color: #36383d;

    cursor: pointer;

    transition:
        .15s ease;
}

.control-btn {
    width: 36px;

    font-size: 21px;
}

.control-btn:hover,
.zoom-value:hover {
    background:
        var(--red-soft);

    color:
        var(--red);
}

.zoom-value {
    min-width: 54px;

    font-size: 11px;
    font-weight: 700;
}

.page-indicator {
    display: flex;
    align-items: center;

    gap: 6px;

    color: #8a8c92;

    font-size: 11px;
}

.page-indicator input {
    width: 40px;
    height: 30px;

    border:
        1px solid #dedfe2;

    border-radius: 7px;

    background: white;

    color: #222;

    text-align: center;

    font-size: 11px;
    font-weight: 700;

    outline: none;
}

.page-indicator input:focus {
    border-color:
        var(--red);
}


/* STATES */

.state {
    position: absolute;

    inset: 0;

    z-index: 10;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}

.state-title {
    margin-top: 14px;

    color: #282a2e;

    font-size: 15px;
    font-weight: 700;
}

.state-text {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;
}

.loader {
    width: 34px;
    height: 34px;

    border:
        3px solid #e7e8eb;

    border-top-color:
        var(--red);

    border-radius: 50%;

    animation:
        spin .8s linear infinite;
}

.empty-logo,
.error-icon {
    width: 50px;
    height: 50px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background:
        var(--red-soft);

    color:
        var(--red);

    font-size: 21px;
    font-weight: 800;
}

.error-icon {
    background: #fff3f3;
}

.hidden {
    display: none !important;
}


/* ANIMATION */

@keyframes spin {
    to {
        transform:
            rotate(360deg);
    }
}


/* MOBILE */

@media (max-width: 800px) {

    .topbar {
        height: 58px;

        grid-template-columns:
            1fr
            auto;

        padding: 0 14px;
    }

    .document-title {
        display: none;
    }

    .viewer-layout {
        height:
            calc(100% - 58px);
    }

    .sidebar {
        position: absolute;

        z-index: 30;

        top: 58px;
        bottom: 0;
        left: 0;

        width: 235px;

        transform:
            translateX(-100%);

        box-shadow:
            15px 0 35px
            rgba(0,0,0,.12);

        transition:
            transform .25s ease;
    }

    .sidebar.open {
        transform:
            translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .document-area {
        width: 100%;
    }

    .pdf-viewport {
        padding:
            18px
            12px
            95px;
    }

    .bottom-toolbar {
        bottom: 12px;

        max-width:
            calc(100% - 24px);

        gap: 5px;

        padding:
            5px 7px;
    }

    .toolbar-divider {
        display: none;
    }
}


/* FULLSCREEN */

:fullscreen .topbar {
    height: 58px;
}

:fullscreen .viewer-layout {
    height:
        calc(100% - 58px);
}
