/* Hover preview card for PDFs — see scripts/control/pdf_preview_popover.js */

/* The card itself is just a positioned wrapper so the arrow can sit outside the
   panel — the panel (.pdf-preview-inner) carries the chrome and does the clipping
   while it animates between its loading and final box. */
.pdf-preview-card {
    position: fixed;
    z-index: 9999;
    pointer-events: auto;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.2, 0, 0, 1.1);
}

.pdf-preview-card--visible {
    opacity: 1;
    transform: scale(1);
}

.pdf-preview-inner {
    box-sizing: border-box;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

/* Little arrow that ties the card back to the row it belongs to. */
.pdf-preview-arrow {
    position: absolute;
    z-index: 1;
    left: var(--pdf-preview-arrow-x, 50%);
    width: 12px;
    height: 12px;
    margin-left: -6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    transform: rotate(45deg);
}

.pdf-preview-card:not(.pdf-preview-card--above):not(.pdf-preview-card--left):not(.pdf-preview-card--right) .pdf-preview-arrow {
    top: -7px;
    border-right: 0;
    border-bottom: 0;
}

.pdf-preview-card--above .pdf-preview-arrow {
    bottom: -7px;
    border-left: 0;
    border-top: 0;
}

/* Side placement (placement:'side'): the arrow moves to the vertical edge facing the row,
   so it's driven off --pdf-preview-arrow-y and has to unset the horizontal `left` above. */
.pdf-preview-card--left .pdf-preview-arrow,
.pdf-preview-card--right .pdf-preview-arrow {
    top: var(--pdf-preview-arrow-y, 50%);
    margin-top: -6px;
    margin-left: 0;
}

.pdf-preview-card--left .pdf-preview-arrow {
    left: auto;
    right: -7px;
    border-left: 0;
    border-bottom: 0;
}

.pdf-preview-card--right .pdf-preview-arrow {
    left: -7px;
    border-right: 0;
    border-top: 0;
}

/* Optional explanatory lines above the strip (e.g. the rotation breakdown). */
.pdf-preview-heading {
    margin-bottom: 8px;
    max-width: 340px;
}

.pdf-preview-heading p {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #334155;
}

.pdf-preview-heading p + p {
    margin-top: 2px;
    font-weight: 500;
    color: #64748b;
}

/* Pages sit side by side so a multi-page preview reads horizontally. */
.pdf-preview-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pdf-preview-body--loading {
    align-items: center;
    justify-content: center;
}

.pdf-preview-page {
    flex: 0 0 auto;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pdf-preview-page canvas {
    display: block;
}

/* A thumbnail with a caption under it — the frame keeps its shadow, the label sits outside. */
.pdf-preview-cell {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.pdf-preview-page-label {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

/* A thumbnail that jumps to its page when clicked. */
.pdf-preview-tile--clickable {
    cursor: pointer;
}

.pdf-preview-tile--clickable:hover .pdf-preview-page,
.pdf-preview-page.pdf-preview-tile--clickable:hover {
    outline: 2px solid #14b8a6;
    outline-offset: 1px;
}

.pdf-preview-tile--clickable:hover .pdf-preview-page-label {
    color: #0f766e;
}

.pdf-preview-more {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 88px;
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    background: #f8fafc;
    color: #64748b;
    font-size: 15px;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.pdf-preview-more i {
    font-size: 14px;
}

.pdf-preview-more-label {
    font-size: 10px;
    font-weight: 500;
    color: #94a3b8;
}

.pdf-preview-more--clickable {
    cursor: pointer;
}

.pdf-preview-more--clickable:hover {
    border-color: #14b8a6;
    background: #f0fdfa;
    color: #0f766e;
}

.pdf-preview-hint {
    margin-top: 8px;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.pdf-preview-hint--clickable {
    cursor: pointer;
}

.pdf-preview-hint--clickable:hover {
    color: #0f766e;
    text-decoration: underline;
}

.pdf-preview-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    padding: 10px 4px;
    color: #e53935;
    font-size: 12px;
}

.pdf-preview-spinner svg {
    animation: pdf-preview-spin 0.8s linear infinite;
}

@keyframes pdf-preview-spin {
    to {
        transform: rotate(360deg);
    }
}
