/* ───────────────────────────────────────────────────────────────────
   PDF Document Meta widget — author / pages / language / type /
   category. All visual properties (background, colors, icon visibility,
   row/column gap) are driven by Elementor Style + Layout controls —
   this stylesheet only provides sensible defaults.
   ───────────────────────────────────────────────────────────────── */

.pdftopost-doc-meta {
    display: flex;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 8px;
    align-items: center;
    line-height: 1.4;
}

.pdftopost-doc-meta--stacked {
    flex-direction: column;
    align-items: flex-start;
    row-gap: 6px;
}

.pdftopost-doc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4b5563;
    font-size: 13px;
    min-width: 0;
    position: relative; /* anchor for the CSS tooltip */
}

/* ── Styled CSS tooltip (data-tooltip) ─────────────────────────────
   Shows what each value represents on hover/focus — "Author",
   "Language", "Document type", etc. The native `title` attribute is
   also set on the element as an accessible fallback; this styled
   version is the nicer visual on pointer devices. Pure CSS, no JS. */
.pdftopost-doc-meta-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
}
/* Little arrow under the bubble. */
.pdftopost-doc-meta-item[data-tooltip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 5px solid transparent;
    border-top-color: #111827;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
}
.pdftopost-doc-meta-item[data-tooltip]:hover::after,
.pdftopost-doc-meta-item[data-tooltip]:focus-within::after,
.pdftopost-doc-meta-item[data-tooltip]:hover::before,
.pdftopost-doc-meta-item[data-tooltip]:focus-within::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
/* Suppress the native title tooltip's double-up on hover by keeping it
   only for accessibility — browsers show it after a longer delay, so
   the styled one wins visually. No CSS needed; both can coexist. */

/* Inline chips — rounded pill background. Override via the Style tab. */
.pdftopost-doc-meta--inline .pdftopost-doc-meta-item {
    padding: 4px 10px;
    background: #f4f4f7;
    border-radius: 999px;
    white-space: nowrap;
}

/* Stacked rows — full-width, no chip background. */
.pdftopost-doc-meta--stacked .pdftopost-doc-meta-item {
    width: 100%;
    padding: 0;
    background: transparent;
}

.pdftopost-doc-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #6b7280;
}
.pdftopost-doc-meta-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.pdftopost-doc-meta-label {
    color: inherit;
    opacity: 0.8;
    font-weight: 500;
}

.pdftopost-doc-meta-value {
    color: #111827;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pdftopost-doc-meta-value a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}
.pdftopost-doc-meta-value a:hover {
    border-bottom-style: solid;
}

/* Category breadcrumb separator — › chevron between linked term names. */
.pdftopost-doc-meta-sep {
    color: #9ca3af;
    margin: 0 2px;
    font-weight: 400;
}

/* ── Per-device label visibility ──────────────────────────────────
   Field labels ("Type:", "Language:" …) are shown/hidden independently
   per breakpoint, driven by the widget's "Show Labels on Desktop" and
   "Show Labels on Mobile" toggles. The widget adds:
     .pdftopost-doc-meta--labels-desktop  → labels visible >768px
     .pdftopost-doc-meta--labels-mobile   → labels visible ≤768px
   Absence of a class hides labels on that breakpoint (values stay
   visible). Defaults: desktop on, mobile off — matching the previous
   hardcoded behaviour. */

/* Desktop (>768px): hide labels unless the desktop toggle is on. */
@media (min-width: 769px) {
    .pdftopost-doc-meta:not(.pdftopost-doc-meta--labels-desktop) .pdftopost-doc-meta-label {
        display: none !important;
    }
}

/* Mobile (≤768px): hide labels unless the mobile toggle is on. */
@media (max-width: 768px) {
    .pdftopost-doc-meta:not(.pdftopost-doc-meta--labels-mobile) .pdftopost-doc-meta-label {
        display: none !important;
    }
}

/* ── Creator internal-link tooltip ("More by <Author>") ───────────────────
   Real crawlable <a> links (stored at creation), shown in a hover/tap grid. */
.pdftopost-creator-hover { position: relative; cursor: pointer; outline: none; }
.pdftopost-creator-name  { border-bottom: 1px dotted currentColor; }
.pdftopost-creator-tip {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 8px;
    z-index: 1001; /* above the sticky PDF toolbar (z-index 999) */
    width: 270px;
    max-width: 86vw;
    max-height: 250px;            /* whole tooltip caps at 250px */
    display: flex;
    flex-direction: column;       /* header fixed, list fills + scrolls */
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(20, 20, 50, 0.16);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
    pointer-events: none;
    text-align: left;
}
.pdftopost-creator-hover:hover .pdftopost-creator-tip,
.pdftopost-creator-hover:focus-within .pdftopost-creator-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: auto;
}
/* Header bar: "More by <Author>" + "Search more" link */
.pdftopost-creator-tip-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 2px 2px 6px; margin-bottom: 4px;
}
.pdftopost-creator-tip-head { font-weight: 700; font-size: 13px; color: #1f1d3d; }
.pdftopost-creator-tip-more {
    display: inline-flex; align-items: center; gap: 4px; flex: none;
    font-size: 12px; font-weight: 600; color: #4b48a6 !important; text-decoration: none !important;
    border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent;
}

.pdftopost-creator-tip-bar { flex: none; }
/* Vertical list of documents (thumb | title | open-in-new icon). Fills the
   remaining height under the header and scrolls inside the 200px tooltip. */
.pdftopost-creator-tip-list {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    background: #f4f5fa;            /* colored container behind the rows */
    border: 0;                      /* no border (incl. bottom) */
    border-radius: 10px;
    padding: 4px;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #c3c6dc #f4f5fa;
}
.pdftopost-creator-tip-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 7px 6px; border: 0 !important; border-radius: 8px;
    text-decoration: none !important; color: #312e56 !important;
}
.pdftopost-creator-tip-row:hover { background: #ffffff; }
.pdftopost-creator-tip-thumb {
    flex: none; width: 34px; height: 46px; border-radius: 4px; overflow: hidden;
    background: #fff; border: 1px solid #eceef5; box-shadow: 0 1px 2px rgba(49, 46, 86, 0.12);
}
.pdftopost-creator-tip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdftopost-creator-tip-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 9px; font-weight: 700; color: #b9bcd0; }
.pdftopost-creator-tip-title {
    flex: 1 1 auto; min-width: 0;
    display: -webkit-box !important; -webkit-line-clamp: 2 !important; line-clamp: 2;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: normal !important;     /* clamp to 2 lines with "…", not a 1-line fade */
    word-break: break-word;
    font-size: 12.5px; line-height: 1.32; font-weight: 600; color: #2a2750;
}
.pdftopost-creator-tip-row:hover .pdftopost-creator-tip-title { text-decoration: underline; }
.pdftopost-creator-tip-ext { flex: none; color: #9aa0bf; }
.pdftopost-creator-tip-list::-webkit-scrollbar { width: 8px; }
.pdftopost-creator-tip-list::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
.pdftopost-creator-tip-list::-webkit-scrollbar-thumb { background: #c3c6dc; border-radius: 8px; border: 2px solid #f4f5fa; }
.pdftopost-creator-tip-list::-webkit-scrollbar-thumb:hover { background: #a7abca; }
@media (max-width: 600px) {
    /* On phones the author name can sit anywhere in the row, so an absolutely
       positioned (left:0) tooltip ran off the right edge. Pin it to the viewport
       with equal left/right insets instead — a centered bottom sheet that can
       never overflow either edge, whatever the name's x position. */
    .pdftopost-creator-tip {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 50%;
        bottom: auto;
        width: auto;
        max-width: none;
        max-height: 70vh;
        margin: 0;
        transform: translateY(calc(-50% + 8px));
    }
    .pdftopost-creator-hover:hover .pdftopost-creator-tip,
    .pdftopost-creator-hover:focus-within .pdftopost-creator-tip {
        transform: translateY(-50%);
    }
}

/* The author meta value uses overflow:hidden (ellipsis for long values), which
   was CLIPPING the absolutely-positioned "More by <Author>" tooltip so it never
   showed on hover. Let the value (and its row) overflow visibly only when it
   contains the creator tooltip. */
.pdftopost-doc-meta-value:has(.pdftopost-creator-hover),
.pdftopost-doc-meta-item:has(.pdftopost-creator-hover),
.pdftopost-doc-meta-row:has(.pdftopost-creator-hover),
.pdftopost-doc-meta:has(.pdftopost-creator-hover) {
    overflow: visible !important;
}
