.catalog-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 9, 22, 0.76);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.catalog-modal.is-open {
    display: flex;
    opacity: 1;
}

.catalog-modal__dialog {
    position: relative;
    display: grid !important;
    grid-template-rows: auto 1fr auto;
    width: min(96vw, 1280px);
    height: min(94vh, 900px);
    max-height: 94vh;
    padding: 22px 22px 18px;
    border: 1px solid rgba(153, 125, 47, 0.28);
    border-radius: 24px;
    background: #0d1323;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    overflow: hidden !important;
}

.catalog-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 4;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.catalog-modal__close:hover {
    background: rgba(153, 125, 47, 0.32);
    transform: scale(1.04);
}

.catalog-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-right: 54px;
    margin-bottom: 16px;
}

.catalog-modal__title {
    margin: 0;
    color: #ffffff;
    font-size: 26px;
    line-height: 1.15;
}

.catalog-modal__actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.catalog-modal__pdf-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.catalog-modal__pdf-link:hover {
    color: #d0b26a;
}

.catalog-modal__stage {
    position: relative;
    min-height: 0;
    border-radius: 18px;
    background:
        radial-gradient(circle at top, rgba(153, 125, 47, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.catalog-flipbook-wrap {
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-flipbook {
    width: 100%;
    height: 100%;
    max-width: 1080px;
    max-height: 100%;
    min-height: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center top;
    transition: transform 0.2s ease;
}

.catalog-page {
    background: #ffffff;
    overflow: hidden;
}

.catalog-page__inner {
    width: 100%;
    height: 100%;
    background: #ffffff;
}

.catalog-page__inner canvas,
.catalog-page canvas {
    display: block;
    width: 100%;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    background: #ffffff;
}

.catalog-modal__loading,
.catalog-modal__error {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #ffffff;
    font-size: 15px;
    text-align: center;
}

.catalog-modal__loading[hidden],
.catalog-modal__error[hidden] {
    display: none;
}

.catalog-controls {
    z-index: 3;
    flex-shrink: 0;
    min-height: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    overflow: visible;
}

.catalog-controls__button {
    min-width: 110px;
    padding: 11px 18px;
    border: 1px solid rgba(153, 125, 47, 0.38);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.catalog-controls__button:hover:not(:disabled) {
    background: rgba(153, 125, 47, 0.24);
    border-color: rgba(153, 125, 47, 0.6);
}

.catalog-controls__button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.catalog-controls__status {
    min-width: 86px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

body.catalog-modal-open {
    overflow: hidden;
}

.catalog-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(153, 125, 47, 0.38);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.catalog-icon-btn:hover,
.catalog-icon-btn:focus {
    background: rgba(153, 125, 47, 0.24);
    border-color: rgba(153, 125, 47, 0.6);
    color: #ffffff;
}

.catalog-zoom-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

@media only screen and (max-width: 991px) {
    .catalog-modal {
        padding: 12px;
    }

    .catalog-modal__dialog {
        padding: 18px 14px 16px;
        border-radius: 18px;
    }

    .catalog-modal__header {
        flex-direction: column;
        align-items: flex-start;
        padding-right: 48px;
        margin-bottom: 12px;
    }

    .catalog-modal__actions {
        justify-content: flex-start;
    }

    .catalog-modal__title {
        font-size: 22px;
    }

    .catalog-modal__stage {
        min-height: 0;
    }

    .catalog-flipbook-wrap {
        padding: 12px 8px;
    }

    .catalog-controls {
        gap: 10px;
        padding: 10px 8px 0;
    }

    .catalog-controls__button {
        min-width: 92px;
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media only screen and (max-width: 600px) {
    .catalog-modal__close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .catalog-modal__title {
        font-size: 19px;
    }

    .catalog-modal__stage {
        min-height: 0;
    }

    .catalog-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .catalog-controls__status {
        order: -1;
        width: 100%;
    }
}

.catalog-modal__topbar {
    position: relative;
}

.catalog-modal__pdf-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.catalog-modal__pdf-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.catalog-modal__close {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 20;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    box-shadow: none;
    outline: none;
}

.catalog-modal__close:hover,
.catalog-modal__close:focus {
    background: transparent;
    color: #ffffff;
    box-shadow: none;
    outline: none;
}

.catalog-modal__close::before,
.catalog-modal__close::after,
.catalog-modal__pdf-link::before,
.catalog-modal__pdf-link::after {
    display: none !important;
    content: none !important;
}

.catalog-modal__topbar button,
.catalog-modal__topbar a {
    min-width: 0;
    min-height: 0;
}

.catalog-modal__topbar button::-webkit-outer-spin-button,
.catalog-modal__topbar button::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.catalog-modal,
.catalog-modal * {
    scrollbar-width: none;
}

.catalog-modal::-webkit-scrollbar,
.catalog-modal *::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

.catalog-modal__dialog,
.catalog-modal__topbar,
.catalog-modal__close,
.catalog-modal__pdf-link {
    overflow: visible;
}

.catalog-modal__dialog {
    overflow: hidden !important;
}

.catalog-modal__close {
    background-image: none !important;
}

.catalog-modal__close::before,
.catalog-modal__close::after,
.catalog-modal__pdf-link::before,
.catalog-modal__pdf-link::after {
    display: none !important;
    content: none !important;
    background: none !important;
    background-image: none !important;
}
