/* BNP Layout Viewer CSS - Estabilizado com Fallback */

.bnp-layout-viewer-wrap {
    position: relative;
    width: 100%;
    margin: 20px 0;
    min-height: 400px;
    background: #f3f4f6;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}

.bnp-layout-review-panel {
    margin: 0 0 16px;
    padding: 16px 18px;
    border: 1px solid #d7dde5;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
}

.bnp-layout-review-panel h3 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.25;
    color: #1f2937;
}

.bnp-layout-review-panel p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #667085;
}

.bnp-layout-review-panel-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e4e7ec;
}

.bnp-layout-review-panel-placeholder {
    color: #7a8797;
}

.bnp-layout-review-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.bnp-layout-review-meta-item {
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #fff;
}

.bnp-layout-review-meta-item span,
.bnp-layout-review-message span,
.bnp-layout-review-versions span {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.3;
    color: #7a8797;
}

.bnp-layout-review-meta-item strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    color: #1f2937;
}

.bnp-layout-review-message,
.bnp-layout-review-versions {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #fff;
}

.bnp-layout-review-message p {
    color: #344054;
}

.bnp-layout-review-versions ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    color: #344054;
    list-style: none;
}

.bnp-layout-review-version-card {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #f9fafb;
}

.bnp-layout-review-version-card.is-current {
    border-color: #b7c8df;
    background: #f1f6fb;
}

.bnp-layout-review-version-title strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
    color: #1f2937;
}

.bnp-layout-review-version-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 6px;
}

.bnp-layout-review-version-details span {
    display: inline;
    margin: 0;
    font-size: 12px;
    line-height: 1.3;
    color: #667085;
}

.bnp-layout-review-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 14px;
}

.bnp-layout-review-comment {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #fff;
}

.bnp-layout-review-comment label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #344054;
}

.bnp-layout-review-comment textarea {
    display: block;
    width: 100%;
    min-height: 92px;
    padding: 10px 12px;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
}

.bnp-layout-review-comment textarea:focus {
    border-color: #98a2b3;
    outline: 2px solid #e4e7ec;
    outline-offset: 1px;
}

.bnp-layout-review-tags {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 6px;
    background: #fff;
}

.bnp-layout-review-tags-empty {
    color: #7a8797;
}

.bnp-layout-review-tag-card {
    padding: 10px;
    border: 1px solid #d9e1ea;
    border-left: 3px solid #4f6f8f;
    border-radius: 6px;
    background: #fbfcfe;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.bnp-layout-review-tag-card.is-highlighted {
    border-color: #8aa9c6;
    border-left-color: #245c7a;
    background: #f1f7fc;
    box-shadow: 0 0 0 3px rgba(36, 92, 122, 0.14);
}

.bnp-layout-review-tag-card + .bnp-layout-review-tag-card {
    margin-top: 10px;
}

.bnp-layout-review-tag-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.bnp-layout-review-tag-card-header span {
    display: inline-flex;
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    color: #667085;
}

.bnp-layout-review-tag-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid #c3d3e3;
    border-radius: 999px;
    background: #eef5fb;
    color: #244f6b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.bnp-layout-review-tag-button:hover,
.bnp-layout-review-tag-button:focus {
    border-color: #9fb7cf;
    background: #e1edf7;
    outline: none;
}

.bnp-layout-review-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    margin-left: auto;
    padding: 5px 9px;
    border: 1px solid #ead7cf;
    border-radius: 6px;
    background: #fff7f4;
    color: #8a4b38;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.bnp-layout-review-tag-remove:hover,
.bnp-layout-review-tag-remove:focus {
    border-color: #d9b7aa;
    background: #feeee8;
    outline: none;
}

.bnp-layout-review-tag-card textarea {
    display: block;
    width: 100%;
    min-height: 78px;
    padding: 9px 10px;
    border: 1px solid #cfd6df;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.45;
    resize: vertical;
}

.bnp-layout-review-tag-card textarea:focus {
    border-color: #98a2b3;
    outline: 2px solid #e4e7ec;
    outline-offset: 1px;
}

.bnp-layout-review-approve-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid #1f6f43;
    border-radius: 6px;
    background: #24834f;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.bnp-layout-review-approve-btn:hover:not(:disabled) {
    background: #1f6f43;
}

.bnp-layout-review-approve-btn:disabled,
.bnp-layout-review-approve-btn.is-loading {
    border-color: #9ab7a8;
    background: #9ab7a8;
    cursor: wait;
    opacity: 0.9;
}

.bnp-layout-review-request-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid #8a4b38;
    border-radius: 6px;
    background: #9d563f;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.bnp-layout-review-request-btn:hover:not(:disabled) {
    background: #8a4b38;
}

.bnp-layout-review-request-btn:disabled,
.bnp-layout-review-request-btn.is-loading {
    border-color: #c0a297;
    background: #c0a297;
    cursor: wait;
    opacity: 0.9;
}

.bnp-layout-review-approved-message {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #cfe7d8;
    border-radius: 6px;
    background: #f0f8f3;
    color: #1f6f43;
    font-weight: 600;
}

.bnp-layout-review-requested-message {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #ead7cf;
    border-radius: 6px;
    background: #fff7f4;
    color: #8a4b38;
    font-weight: 600;
}

.bnp-layout-adjustments-panel {
    margin: 16px 0 20px;
    padding: 16px 18px;
    border: 1px solid #d7dde5;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
}

.bnp-layout-adjustments-panel[hidden] {
    display: none;
}

.bnp-layout-adjustments-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
}

.bnp-layout-adjustments-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    line-height: 1.25;
    color: #1f2937;
}

.bnp-layout-adjustments-header p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #667085;
}

.bnp-layout-adjustments-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    max-width: 360px;
}

.bnp-layout-adjustments-submit,
.bnp-layout-adjustments-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.bnp-layout-adjustments-submit {
    border: 1px solid #8a4b38;
    background: #9d563f;
    color: #fff;
}

.bnp-layout-adjustments-submit:hover:not(:disabled) {
    background: #8a4b38;
}

.bnp-layout-adjustments-submit:disabled,
.bnp-layout-adjustments-submit.is-loading {
    border-color: #c0a297;
    background: #c0a297;
    cursor: not-allowed;
    opacity: 0.9;
}

.bnp-layout-adjustments-cancel {
    border: 1px solid #cfd6df;
    background: #fff;
    color: #344054;
}

.bnp-layout-adjustments-cancel:hover,
.bnp-layout-adjustments-cancel:focus {
    border-color: #b8c2cf;
    background: #f3f6f9;
    outline: none;
}

.bnp-layout-adjustments-submit-note {
    flex-basis: 100%;
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: #7a8797;
    text-align: right;
}

.bnp-layout-adjustments-submit-note[hidden] {
    display: none;
}

.bnp-layout-draft-status {
    margin: 12px 0 0;
    padding: 7px 10px;
    border: 1px solid #d7dde5;
    border-radius: 6px;
    background: #fff;
    color: #5f6f82;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

.bnp-layout-draft-status[hidden],
.bnp-layout-draft-status:empty {
    display: none;
}

.bnp-layout-draft-status.is-loading,
.bnp-layout-draft-status.is-saving {
    border-color: #c9d7e4;
    background: #f4f8fb;
    color: #36566f;
}

.bnp-layout-draft-status.is-saved,
.bnp-layout-draft-status.is-restored {
    border-color: #cfe4d7;
    background: #f1f8f4;
    color: #23603f;
}

.bnp-layout-draft-status.is-error {
    border-color: #efc9c2;
    background: #fff5f3;
    color: #9b3f2f;
}

.bnp-layout-adjustments-panel .bnp-layout-review-tags {
    margin-top: 14px;
    padding: 0;
    border: 0;
    border-top: 1px solid #e4e7ec;
    border-radius: 0;
    background: transparent;
    padding-top: 14px;
}

.bnp-layout-adjustments-panel .bnp-layout-review-tags-empty {
    padding: 10px 0;
}

.bnp-layout-review-card {
    margin-bottom: 18px;
}

.bnp-layout-flipbook-card {
    width: 100%;
}

.bnp-layout-review-placeholder {
    padding: 8px 0;
}

.bnp-layout-review-placeholder h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.bnp-layout-review-placeholder p {
    margin: 0;
    color: #667085;
}

.bnp-layout-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    background: rgba(255,255,255,0.8);
    padding: 20px;
    border-radius: 10px;
}

.bnp-layout-flipbook-shell {
    display: none;
    width: calc(100% - 24px);
    max-width: 1180px;
    margin: 18px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    min-height: 300px;
    text-align: center;
    overflow: visible;
    box-sizing: border-box;
}

.bnp-flipbook-container {
    margin: 0 auto;
    display: block;
    position: relative;
    gap: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
    line-height: 0;
}

/* Fallback: Modo Lista (quando Turn.js não inicia ou está oculto) */
.bnp-mode-fallback-list .bnp-flipbook-container {
    display: flex;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    height: auto !important;
    overflow-y: auto !important;
    max-height: 600px;
    padding: 10px;
}

.bnp-mode-fallback-list .bnp-flipbook-page {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin: 0 auto !important;
    width: 90% !important;
    height: auto !important;
    display: block !important;
}

.bnp-mode-fallback-list .bnp-flipbook-page canvas {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Turn.js Page Styles */
.bnp-flipbook-page {
    background-color: white;
    overflow: hidden;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
    line-height: 0;
}

.bnp-flipbook-page.bnp-page-hard {
    background-color: #fff;
}

.bnp-flipbook-page canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-sizing: border-box;
}

.bnp-layout-marking-mode .bnp-flipbook-page canvas {
    cursor: crosshair;
}

.bnp-annotations-overlay {
    position: absolute;
    z-index: 12;
    pointer-events: none;
    line-height: normal;
}

.bnp-marker-pin {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #1f2937;
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    box-sizing: border-box;
}

.bnp-marker-pin:hover,
.bnp-marker-pin:focus,
.bnp-marker-pin.is-active,
.bnp-marker-pin.is-highlighted {
    background: #245c7a;
    outline: 2px solid rgba(36, 92, 122, 0.22);
    outline-offset: 2px;
}

.bnp-marker-pin.is-highlighted {
    animation: bnp-marker-pin-pulse 1200ms ease-in-out 2;
    box-shadow: 0 0 0 6px rgba(36, 92, 122, 0.18), 0 8px 18px rgba(15, 23, 42, 0.28);
}

@keyframes bnp-marker-pin-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(36, 92, 122, 0.32), 0 4px 12px rgba(15, 23, 42, 0.28);
    }

    55% {
        transform: translate(-50%, -50%) scale(1.14);
        box-shadow: 0 0 0 10px rgba(36, 92, 122, 0), 0 8px 18px rgba(15, 23, 42, 0.28);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 0 0 rgba(36, 92, 122, 0), 0 4px 12px rgba(15, 23, 42, 0.28);
    }
}

/* Controles */
.bnp-layout-controls {
    display: none;
    padding: 15px;
    background: #e9e9e9;
    border-top: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bnp-layout-page-info {
    font-weight: bold;
    color: #444;
}

.bnp-layout-btn-prev, .bnp-layout-btn-next {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.bnp-layout-btn-prev:disabled, .bnp-layout-btn-next:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.bnp-layout-error-msg {
    color: #d63638;
    background: #fcf0f1;
    padding: 10px;
    margin: 10px;
    border-left: 4px solid #d63638;
    display: none;
}

/* ==========================================================
   BNP Flipbook — Sombras centralizadas por estado visual
   JS controla apenas classes. Todas as sombras ficam aqui.
   ========================================================== */

/* Shell externo do visualizador */
.bnp-layout-flipbook-shell {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* Transições base */
.bnp-flipbook-container,
.bnp-flipbook-page.bnp-page-hard,
.bnp-mode-fallback-list .bnp-flipbook-page {
    transition:
        box-shadow 220ms ease,
        filter 220ms ease;
}

/* Fallback em lista */
.bnp-mode-fallback-list .bnp-flipbook-page {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.20) !important;
}

/* Base: páginas duras não têm sombra própria fora dos estados */
.bnp-ready .bnp-flipbook-page.bnp-page-hard {
    box-shadow: none !important;
    filter: none !important;
}

/* Álbum aberto no miolo */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-view-spread:not(.bnp-mode-fallback-list) .bnp-flipbook-container {
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.20) !important;
        filter: none !important;
    }
}

/* Álbum fechado na capa e na contra capa */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-view-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container,
    .bnp-ready.bnp-layout-view-back-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container,
    .bnp-ready.bnp-layout-view-cover:not(.bnp-mode-fallback-list) .bnp-page-cover,
    .bnp-ready.bnp-layout-view-back-cover:not(.bnp-mode-fallback-list) .bnp-page-back-cover {
        box-shadow: none !important;
        filter: none !important;
    }
}

/* Abrindo capa/contra capa para miolo:
   Não força sombra forte no início. Só prepara transição suave. */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-opening-from-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container,
    .bnp-ready.bnp-layout-opening-from-back-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container {
        transition:
            transform 800ms ease,
            margin-left 800ms ease,
            left 800ms ease,
            box-shadow 260ms ease,
            filter 260ms ease !important;
        box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06) !important;
        filter: none !important;
    }
}

/* Fechando miolo para capa/contra capa:
   Sombra some rápido no começo do fechamento. */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-closing-to-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container,
    .bnp-ready.bnp-layout-closing-to-back-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container,
    .bnp-ready.bnp-layout-closing-to-cover:not(.bnp-mode-fallback-list) .bnp-page-hard,
    .bnp-ready.bnp-layout-closing-to-back-cover:not(.bnp-mode-fallback-list) .bnp-page-hard {
        transition:
            transform 800ms ease,
            margin-left 800ms ease,
            left 800ms ease,
            box-shadow 120ms ease,
            filter 120ms ease !important;
        box-shadow: none !important;
        filter: none !important;
    }
}

/* Remove sombras internas geradas pelo Turn.js nos estados fechados/fechando */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-view-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container .shadow,
    .bnp-ready.bnp-layout-view-back-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container .shadow,
    .bnp-ready.bnp-layout-closing-to-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container .shadow,
    .bnp-ready.bnp-layout-closing-to-back-cover:not(.bnp-mode-fallback-list) .bnp-flipbook-container .shadow {
        display: none !important;
    }
}

/* Evita sobra visual da página 2 quando o álbum volta para capa */
@media (min-width: 768px) {
    .bnp-ready.bnp-layout-view-cover:not(.bnp-layout-opening-from-cover):not(.bnp-mode-fallback-list) .bnp-flipbook-container .page-wrapper[page="2"] {
        display: none !important;
    }
}
