/* ═══ PDF Upload — Scribd-style (ported from Upload.tsx/scss) ═══ */

/* ── Auth Button Widget ── */
.pdftopost-auth-btn-wrap {
    display: inline-flex;
    align-items: center;
}
.pdftopost-auth-btn-wrap .pdftopost-download-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 16px !important;
    background: #312e56 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    line-height: normal !important;
    height: auto !important;
    margin: 0 !important;
}
.pdftopost-auth-btn-wrap .pdftopost-download-btn:hover {
    background: #3f3b6d !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(49,46,86,0.3) !important;
    color: #ffffff !important;
    text-decoration: none !important;
}
.pdftopost-auth-btn-wrap .pdftopost-download-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(49,46,86,0.25) !important;
}
.pdftopost-auth-btn-wrap .pdftopost-download-btn:active {
    background: #1f1d3a !important;
    transform: translateY(0) !important;
    box-shadow: none !important;
}
.pdftopost-auth-btn-wrap .pdftopost-download-btn svg {
    width: 16px !important;
    height: 16px !important;
    stroke: #ffffff !important;
}

/* ── Auth widget alignment: Upload pill + profile avatar inline ── */
.pdftopost-auth-btn-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    line-height: 1 !important;
}
.pdftopost-auth-profile {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    line-height: 1 !important;
}
.pdftopost-profile-wrap {
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
}
.pdftopost-profile-trigger,
.pdftopost-profile-trigger:hover,
.pdftopost-profile-trigger:focus,
.pdftopost-profile-trigger:active,
.pdftopost-profile-trigger:focus-visible {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    -webkit-tap-highlight-color: transparent;
}
/* Subtle accessibility-preserving focus ring (only on keyboard focus) */
.pdftopost-profile-trigger:focus-visible .pdftopost-auth-avatar {
    box-shadow: 0 0 0 3px rgba(49,46,86,0.25) !important;
}

/* Profile avatar — brand-coloured circle. Single rule so we don't fight
   ourselves with stale green borders from earlier widget revisions. */
.pdftopost-auth-avatar,
.pdftopost-auth-btn-wrap .pdftopost-auth-avatar,
.pdftopost-profile-trigger .pdftopost-auth-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #312e56 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    display: block !important;
    vertical-align: middle !important;
}
.pdftopost-profile-trigger:hover .pdftopost-auth-avatar {
    border-color: #1f1d3a !important;
}

/* ── Download request row (shows document user wants to download) ── */
.pdftopost-download-request {
    max-width: 90% !important;
    margin: 0 auto 24px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    animation: pdftopost-slideDown 0.3s ease-out;
}

@keyframes pdftopost-slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pdftopost-download-request-inner {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.pdftopost-download-request-thumb {
    flex-shrink: 0;
    width: 120px !important;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.pdftopost-download-request-thumb img {
    width: 100% !important;
    height: auto;
    display: block;
    object-fit: cover;
}

.pdftopost-download-request-info {
    flex: 1;
}

.pdftopost-download-request-title {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: #111;
}

.pdftopost-download-request-desc {
    margin: 0 0 12px;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.pdftopost-download-request-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pdftopost-download-request-badge {
    display: inline-block;
    padding: 6px 14px;
    background: white;
    border: 1px solid #86efac;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.pdftopost-download-request-ready {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #16a34a;
}

.pdftopost-download-request-ready svg {
    width: 16px !important;
    height: 16px;
}

/* Download button (replaces progress badge when credits available) */
.pdftopost-download-request-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px 28px !important;
    background: #3ddc97 !important;
    color: black !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s !important;
    margin-top: 8px !important;
    box-shadow: none !important;
}

.pdftopost-download-request-btn:hover {
    background: #35c885 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(61,220,151,0.3) !important;
    color: black !important;
    text-decoration: none !important;
}

.pdftopost-download-request-btn:active {
    background: #2db877 !important;
    transform: translateY(0) !important;
}

.pdftopost-download-request-btn svg {
    width: 18px !important;
    height: 18px !important;
}

@media (max-width: 768px) {
    .pdftopost-download-request {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100% !important;
        margin: 0;
        padding: 12px 16px;
        border-radius: 16px 16px 0 0;
        border: none;
        border-top: 1px solid #bbf7d0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
        z-index: 9999;
        animation: pdftopost-slideUp 0.3s ease-out;
    }

    @keyframes pdftopost-slideUp {
        from { opacity: 0; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }

    .pdftopost-download-request-inner {
        flex-direction: row;
        align-items: center;
    }

    .pdftopost-download-request-thumb {
        width: 56px !important;
        min-width: 56px !important;
        border-radius: 6px;
    }

    .pdftopost-download-request-thumb img {
        max-height: 72px;
        object-fit: cover;
    }

    .pdftopost-download-request-title {
        font-size: 14px;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px !important;
    }

    .pdftopost-download-request-desc {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .pdftopost-download-request-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .pdftopost-download-request-btn {
        padding: 8px 16px !important;
        font-size: 14px !important;
        margin-top: 4px !important;
    }

    /* Push page content up so it's not hidden behind the sticky bar */
    .pdftopost-upload-wrap {
        padding-bottom: 120px;
    }
}

.pdftopost-upload-wrap {
    min-height: 100vh;
    background: #fff;
    padding: 30px 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Drag overlay (full-screen brand-aligned) ── */
.pdftopost-drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(49, 46, 86, 0.55); /* brand navy scrim */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: pdftopost-overlay-fade-in 0.18s ease-out;
}

@keyframes pdftopost-overlay-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pdftopost-drag-overlay-card {
    max-width: 520px !important;
    width: 100% !important;
    padding: 48px 32px;
    background: linear-gradient(180deg, #ffffff 0%, #f9faff 100%);
    border: 2.5px dashed #312e56;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 24px 80px -16px rgba(0, 0, 0, 0.35);
    animation: pdftopost-overlay-pop-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    position: relative;
    overflow: hidden;
}

.pdftopost-drag-overlay-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px !important;
    height: 220px;
    background: radial-gradient(circle, #e0e3f5 1px, transparent 1px);
    background-size: 14px 14px;
    opacity: 0.55;
    pointer-events: none;
}

@keyframes pdftopost-overlay-pop-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

.pdftopost-drag-overlay-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px !important;
    height: 76px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f2f4fe 0%, #d6dcf7 100%);
    color: #312e56;
    box-shadow: 0 6px 18px -6px rgba(49, 46, 86, 0.35);
    animation: pdftopost-overlay-icon-bounce 1.4s ease-in-out infinite;
}

@keyframes pdftopost-overlay-icon-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.pdftopost-drag-overlay-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: #1f1d3d;
    letter-spacing: -0.01em;
}

.pdftopost-drag-overlay-sub {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #5a5878;
}

/* ── Main upload card (modern, brand palette) ── */
.pdftopost-upload-card {
    max-width: 720px !important;
    margin: 0 auto 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f9faff 100%);
    border: 2px dashed #d6dcf7;
    border-radius: 20px;
    padding: 56px 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 1px 0 rgba(49,46,86,0.04), 0 16px 40px -16px rgba(49,46,86,0.12);
    position: relative;
    overflow: hidden;
}

.pdftopost-upload-card:hover,
.pdftopost-upload-card.is-dragover {
    border-color: #312e56;
    background: linear-gradient(180deg, #ffffff 0%, #f2f4fe 100%);
    box-shadow: 0 1px 0 rgba(49,46,86,0.06), 0 24px 60px -16px rgba(49,46,86,0.22);
    transform: translateY(-1px);
}
.pdftopost-upload-card.is-dragover {
    border-style: solid;
}

/* Decorative dot pattern in the top-right corner (subtle brand accent) */
.pdftopost-upload-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px !important;
    height: 200px;
    background: radial-gradient(circle, #e0e3f5 1px, transparent 1px);
    background-size: 14px 14px;
    opacity: 0.5;
    pointer-events: none;
}

.pdftopost-upload-icon {
    margin-bottom: 20px;
    display: inline-flex;
    width: 80px !important;
    height: 80px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f2f4fe 0%, #e0e3f5 100%);
    color: #312e56;
    position: relative;
}
.pdftopost-upload-icon svg {
    width: 40px !important;
    height: 40px !important;
    stroke: #312e56 !important;
    stroke-width: 1.5 !important;
}

.pdftopost-upload-heading {
    font-size: 20px;
    font-weight: 700;
    color: #0b0b14;
    margin: 0 0 8px;
    line-height: 1.25;
}

.pdftopost-upload-subheading {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
}

.pdftopost-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #312e56;
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(49,46,86,0.18);
}

.pdftopost-upload-btn:hover {
    background: #3f3b6d;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(49,46,86,0.30);
}
.pdftopost-upload-btn:active {
    background: #1f1d3a;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(49,46,86,0.18);
}

.pdftopost-file-input {
    display: none;
}

/* Format badges */
.pdftopost-format-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pdftopost-badge {
    padding: 4px 10px;
    background: #f2f4fe;
    border: 1px solid #d6dcf7;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #312e56;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pdftopost-copyright-note {
    margin-top: 16px;
    font-size: 12px;
    color: #999;
}

/* ── Help links (modern, brand-aligned pills) ── */
.pdftopost-help-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 36px;
}

.pdftopost-help-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #ffffff;
    border: 1px solid #d6dcf7;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #312e56;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    box-shadow: 0 1px 0 rgba(49, 46, 86, 0.04);
}

.pdftopost-help-pill .pdftopost-help-icon {
    width: 16px !important;
    height: 16px;
    flex-shrink: 0;
    color: #312e56;
    opacity: 0.85;
}

.pdftopost-help-pill:hover,
.pdftopost-help-pill:focus-visible {
    background: #f2f4fe;
    border-color: #312e56;
    color: #312e56;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -8px rgba(49, 46, 86, 0.35);
    outline: none;
}

/* ── Benefits cards (modern, brand-aligned) ── */
.pdftopost-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    max-width: 900px !important;
    margin: 0 auto 36px;
}

.pdftopost-benefit-card {
    position: relative;
    padding: 28px 22px 24px;
    border-radius: 18px;
    text-align: left;
    background: #ffffff;
    border: 1px solid #e6e8f5;
    box-shadow: 0 1px 0 rgba(49, 46, 86, 0.04), 0 18px 36px -24px rgba(49, 46, 86, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.pdftopost-benefit-card::after {
    content: '';
    position: absolute;
    inset: auto -30px -30px auto;
    width: 120px !important;
    height: 120px;
    background: radial-gradient(circle at 30% 30%, rgba(49, 46, 86, 0.08), transparent 70%);
    pointer-events: none;
}

.pdftopost-benefit-card:hover {
    transform: translateY(-2px);
    border-color: #d6dcf7;
    box-shadow: 0 1px 0 rgba(49, 46, 86, 0.06), 0 26px 50px -22px rgba(49, 46, 86, 0.28);
}

.pdftopost-benefit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px;
    border-radius: 12px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #f2f4fe 0%, #e0e3f5 100%);
    color: #312e56;
}

.pdftopost-benefit-icon svg {
    width: 22px !important;
    height: 22px;
}

.pdftopost-benefit-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #1f1d3d;
    letter-spacing: -0.01em;
}

.pdftopost-benefit-card p {
    margin: 0;
    font-size: 13px;
    color: #5a5878;
    line-height: 1.55;
}

/* Accent tints — keep the navy brand, vary the icon-chip hue for visual rhythm */
.pdftopost-benefit-points .pdftopost-benefit-icon {
    background: linear-gradient(135deg, #fff4d6 0%, #ffe6a1 100%);
    color: #8a5a00;
}
.pdftopost-benefit-share .pdftopost-benefit-icon {
    background: linear-gradient(135deg, #fde2ef 0%, #f9c3dc 100%);
    color: #9c2a63;
}
.pdftopost-benefit-easy .pdftopost-benefit-icon {
    background: linear-gradient(135deg, #f2f4fe 0%, #d6dcf7 100%);
    color: #312e56;
}

/* Legacy class names kept harmless if other markup still uses them */
.pdftopost-benefit-yellow,
.pdftopost-benefit-pink,
.pdftopost-benefit-blue { background: #ffffff; }

/* ── File cards (after upload) ── */
.pdftopost-file-cards {
    max-width: 90% !important;
    margin: 0 auto 24px;
}

.pdftopost-file-card {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 32px;
    background: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: none;
}

/* Preview column */
.pdftopost-file-preview {
    position: sticky;
    top: 24px;
    align-self: start;
}

.pdftopost-file-preview-heading {
    font-size: 13px;
    font-weight: 700;
    color: #312e56;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pdftopost-file-preview img {
    width: 100% !important;
    height: auto;
    max-height: 384px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #e6e8f5;
    background: linear-gradient(180deg, #f9faff 0%, #f2f4fe 100%);
    display: block;
    box-shadow: 0 4px 16px -8px rgba(49, 46, 86, 0.18);
}

.pdftopost-file-preview-loading {
    width: 100% !important;
    height: 256px;
    background: linear-gradient(180deg, #f9faff 0%, #f2f4fe 100%);
    border-radius: 12px;
    border: 1px dashed #d6dcf7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #6b6890;
    font-size: 13px;
    font-weight: 500;
}

.pdftopost-file-preview-loading p {
    margin: 0;
}

.pdftopost-preview-spinner {
    width: 32px !important;
    height: 32px;
    border: 3px solid #d6dcf7;
    border-top-color: #312e56;
    border-radius: 50%;
    animation: pdftopost-preview-spin 0.7s linear infinite;
}

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

/* Form column */
.pdftopost-file-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    background: transparent;
    padding: 0;
}

.pdftopost-file-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1f1d3d;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.pdftopost-file-form .pdftopost-required {
    color: #d6336c;
    margin-left: 2px;
}

.pdftopost-file-form input[type="text"],
.pdftopost-file-form textarea {
    width: 100% !important;
    padding: 12px 14px;
    background: #ffffff;
    border: 1.5px solid #e6e8f5;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1f1d3d;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-sizing: border-box;
    outline: none;
}

.pdftopost-file-form input[type="text"]::placeholder,
.pdftopost-file-form textarea::placeholder {
    color: #9b99b8;
}

.pdftopost-file-form input[type="text"]:hover,
.pdftopost-file-form textarea:hover {
    border-color: #d6dcf7;
}

.pdftopost-file-form input[type="text"]:focus,
.pdftopost-file-form textarea:focus {
    border-color: #312e56;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(49, 46, 86, 0.10);
}

.pdftopost-file-form textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.55;
}

/* Advanced settings toggle */
.pdftopost-advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: #312e56 !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    align-self: flex-start;
    text-decoration: none !important;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pdftopost-advanced-toggle:hover,
.pdftopost-advanced-toggle:focus-visible {
    background: #f2f4fe !important;
    border-color: #d6dcf7;
    color: #312e56 !important;
    text-decoration: none !important;
    outline: none;
}

.pdftopost-advanced-toggle:active {
    background: #e8ebfa !important;
}

/* Opened / clicked state — persistent while the panel is expanded. */
.pdftopost-advanced-toggle.open,
.pdftopost-advanced-toggle[aria-expanded="true"] {
    background: #312e56 !important;
    border-color: #312e56;
    color: #ffffff !important;
    box-shadow: 0 4px 12px -4px rgba(49, 46, 86, 0.35);
}

.pdftopost-advanced-toggle.open:hover,
.pdftopost-advanced-toggle[aria-expanded="true"]:hover {
    background: #1f1d3d !important;
    border-color: #1f1d3d;
    color: #ffffff !important;
}

.pdftopost-advanced-toggle.open svg,
.pdftopost-advanced-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.pdftopost-advanced-toggle svg {
    transition: transform 0.2s ease;
}

.pdftopost-advanced-panel {
    display: none;
    padding: 18px;
    background: linear-gradient(180deg, #f9faff 0%, #f2f4fe 100%);
    border-radius: 12px;
    border: 1px solid #d6dcf7;
}

.pdftopost-advanced-panel.open {
    display: block;
}

.pdftopost-advanced-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1f1d3d;
}

.pdftopost-advanced-row:last-child {
    margin-bottom: 0;
}

.pdftopost-advanced-row input[type="checkbox"] {
    accent-color: #312e56;
    width: 16px !important;
    height: 16px;
}

.pdftopost-advanced-row select {
    padding: 8px 12px;
    background: #ffffff;
    border: 1.5px solid #e6e8f5;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1f1d3d;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pdftopost-advanced-row select:focus {
    outline: none;
    border-color: #312e56;
    box-shadow: 0 0 0 4px rgba(49, 46, 86, 0.10);
}

/* Action buttons */
.pdftopost-file-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    justify-content: flex-end;
    align-items: center;
}

.pdftopost-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    background: #312e56;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    box-shadow: 0 2px 8px rgba(49, 46, 86, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    letter-spacing: -0.01em;
}

.pdftopost-submit-btn:hover:not(:disabled) {
    background: #1f1d3d;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px rgba(49, 46, 86, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.pdftopost-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(49, 46, 86, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.pdftopost-submit-btn:disabled {
    opacity: 0.55;
    cursor: wait;
    box-shadow: none;
    transform: none;
}

.pdftopost-cancel-btn {
    padding: 11px 22px;
    background: #ffffff;
    color: #1f1d3d;
    border: 1.5px solid #e6e8f5;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
    letter-spacing: -0.01em;
}

.pdftopost-cancel-btn:hover {
    background: #f2f4fe;
    border-color: #d6dcf7;
    color: #312e56;
}

.pdftopost-cancel-btn:active {
    transform: translateY(1px);
}

/* Processing status inside file card */
.pdftopost-file-status {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdftopost-file-status-processing {
    background: linear-gradient(180deg, #f9faff 0%, #f2f4fe 100%);
    color: #312e56;
    border: 1px solid #d6dcf7;
}

/* ── Success state — modern card with brand-aligned success accent ── */
.pdftopost-file-status-success {
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f9faff 100%);
    color: #1f1d3d;
    border: 1px solid #d6dcf7;
    border-radius: 16px;
    box-shadow: 0 8px 24px -14px rgba(49, 46, 86, 0.22);
    animation: pdftopost-success-pop-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes pdftopost-success-pop-in {
    from { opacity: 0; transform: translateY(6px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pdftopost-success-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px !important;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px -6px rgba(16, 185, 129, 0.55);
}

.pdftopost-success-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.pdftopost-success-title {
    font-size: 15px;
    font-weight: 700;
    color: #1f1d3d;
    letter-spacing: -0.01em;
}

.pdftopost-success-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #312e56 !important;
    text-decoration: none !important;
    transition: color 0.18s ease, transform 0.18s ease;
    width: fit-content;
}

.pdftopost-success-link:hover {
    color: #1f1d3d !important;
    transform: translateX(2px);
}

.pdftopost-success-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.pdftopost-success-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #f2f4fe;
    border: 1px solid #d6dcf7;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #312e56;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pdftopost-success-chip-alt {
    background: #ffffff;
    color: #5a5878;
    border-color: #e6e8f5;
}

.pdftopost-file-status-error {
    background: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.pdftopost-file-status a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* Progress bar inside status */
.pdftopost-file-progress {
    height: 4px;
    background: #dbeafe;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.pdftopost-file-progress-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Upload progress bar */
.pdftopost-upload-progress {
    margin-top: 12px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.pdftopost-upload-progress-bar {
    height: 100%;
    background: #7c3aed;
    border-radius: 6px;
    transition: width 0.3s;
    width: 0% !important;
}

/* Error message */
.pdftopost-file-error {
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 13px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .pdftopost-auth-btn-wrap .pdftopost-download-btn span {
        display: none !important;
    }
    .pdftopost-auth-btn-wrap .pdftopost-download-btn {
        padding: 8px !important;
    }

    .pdftopost-upload-wrap {
        padding: 16px 12px;
    }

    .pdftopost-upload-card {
        padding: 32px 20px;
    }

    .pdftopost-upload-heading {
        font-size: 16px;
    }

    .pdftopost-benefits {
        grid-template-columns: 1fr;
    }

    .pdftopost-file-card {
        grid-template-columns: 1fr;
    }

    .pdftopost-file-preview {
        position: static;
        max-height: 160px;
        overflow: hidden;
    }

    .pdftopost-file-preview img {
        max-height: 160px;
        object-fit: contain;
    }

    .pdftopost-file-form {
        padding: 0;
    }

    .pdftopost-help-links {
        flex-direction: column;
        align-items: center;
    }
}

/* ═══ Auth Modal (shared styles for upload page) ═══ */

.pdftopost-auth-modal {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 100001 !important;
    /* display is controlled by inline style (JS toggle) — do NOT set display here */
    align-items: center !important;
    justify-content: center !important;
    animation: pdftopost-modalFadeIn 0.2s ease-out !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
}

@keyframes pdftopost-modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pdftopost-modal-overlay {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background: rgba(0,0,0,0.6) !important;
    /* Removed backdrop-filter: blur(4px) — Safari scroll-jank GPU cost. */
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.pdftopost-modal-content {
    position: relative !important;
    background: white !important;
    border-radius: 16px !important;
    padding: 32px !important;
    max-width: 400px !important;
    width: 90% !important;
    text-align: center !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15) !important;
    animation: pdftopost-modalSlideUp 0.3s ease-out !important;
    border: none !important;
    margin: 0 !important;
    color: #333 !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
}

@keyframes pdftopost-modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pdftopost-modal-close {
    position: absolute !important;
    top: 12px !important; right: 16px !important;
    background: none !important; border: none !important;
    font-size: 24px !important; color: #999 !important;
    cursor: pointer !important; line-height: 1 !important;
    padding: 4px !important; border-radius: 50% !important;
    transition: all 0.2s !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
}

.pdftopost-modal-close:hover {
    background: #f0f0f0 !important; color: #333 !important;
    box-shadow: none !important;
    border: none !important;
}

.pdftopost-modal-close:focus {
    outline: none !important;
    box-shadow: none !important;
}

.pdftopost-modal-close:active {
    background: #e5e5e5 !important;
    transform: scale(0.95) !important;
}

.pdftopost-modal-icon { margin-bottom: 16px !important; }

.pdftopost-modal-content h3,
.pdftopost-modal-heading {
    margin: 0 0 8px !important; font-size: 20px !important; font-weight: 700 !important; color: #1a1a1a !important;
    padding: 0 !important;
    border: none !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.pdftopost-modal-content p {
    margin: 0 0 8px !important; font-size: 15px !important; color: #555 !important; line-height: 1.5 !important;
    padding: 0 !important;
    border: none !important;
}

.pdftopost-auth-content {
    max-width: 380px !important; padding: 32px 28px !important;
}

.pdftopost-auth-tab:not(.active) { display: none !important; }
.pdftopost-auth-tab.active { display: block !important; }

.pdftopost-auth-form {
    display: flex !important; flex-direction: column !important; gap: 12px !important; margin-top: 16px !important;
    padding: 0 !important;
    border: none !important;
}

.pdftopost-auth-form input {
    width: 100% !important; padding: 12px 14px !important;
    border: 1px solid #e0e0e0 !important; border-radius: 10px !important;
    font-size: 15px !important; font-family: inherit !important;
    box-sizing: border-box !important; transition: border-color 0.2s !important; outline: none !important;
    background: white !important;
    color: #333 !important;
    margin: 0 !important;
    box-shadow: none !important;
    height: auto !important;
    line-height: normal !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.pdftopost-auth-form input:focus {
    border-color: #3ddc97 !important; box-shadow: 0 0 0 3px rgba(61,220,151,0.12) !important;
    outline: none !important;
    background: white !important;
}

.pdftopost-auth-form input:hover {
    border-color: #ccc !important;
}

.pdftopost-auth-form input::placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

.pdftopost-auth-submit {
    width: 100% !important; padding: 12px !important;
    background: #3ddc97 !important; color: black !important;
    border: none !important; border-radius: 10px !important;
    font-size: 16px !important; font-weight: 600 !important;
    cursor: pointer !important; transition: all 0.2s !important; margin-top: 4px !important;
    box-shadow: none !important;
    line-height: normal !important;
    font-family: inherit !important;
    outline: none !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.pdftopost-auth-submit:hover {
    background: #35c885 !important;
    color: black !important;
    box-shadow: 0 2px 8px rgba(61,220,151,0.3) !important;
    transform: translateY(-1px) !important;
}

.pdftopost-auth-submit:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(61,220,151,0.3) !important;
}

.pdftopost-auth-submit:active {
    background: #2db877 !important;
    transform: translateY(0) !important;
    box-shadow: none !important;
}

.pdftopost-auth-submit:disabled {
    opacity: 0.6 !important; cursor: wait !important;
    transform: none !important;
    box-shadow: none !important;
}

.pdftopost-auth-error {
    padding: 10px 14px !important; background: #fef0f0 !important;
    border: 1px solid #f5c6cb !important; border-radius: 8px !important;
    color: #c00 !important; font-size: 13px !important;
    margin: 0 !important;
    line-height: 1.5 !important;
    text-align: left !important;
}

.pdftopost-auth-switch {
    margin-top: 16px !important; font-size: 14px !important; color: #666 !important; text-align: center !important;
    padding: 0 !important;
    border: none !important;
}

.pdftopost-auth-switch a {
    color: #3ddc97 !important; font-weight: 600 !important; text-decoration: none !important;
    transition: all 0.2s !important;
    border: none !important;
    background: none !important;
}

.pdftopost-auth-switch a:hover {
    text-decoration: underline !important;
    color: #35c885 !important;
}

.pdftopost-auth-switch a:focus {
    outline: none !important;
    color: #2db877 !important;
}

.pdftopost-google-btn {
    display: flex !important; align-items: center !important; justify-content: center !important;
    gap: 10px !important; width: 100% !important; padding: 12px 16px !important;
    background: white !important; border: 1px solid #dadce0 !important;
    border-radius: 10px !important; font-size: 15px !important; font-weight: 500 !important;
    color: #3c4043 !important; cursor: pointer !important; transition: all 0.2s !important;
    margin-top: 16px !important; font-family: inherit !important;
    box-shadow: none !important;
    line-height: normal !important;
    text-decoration: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    height: auto !important;
}

.pdftopost-google-btn:hover {
    background: #f7f8f8 !important; box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    border-color: #c6c9cd !important;
    color: #3c4043 !important;
    text-decoration: none !important;
}

.pdftopost-google-btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(66,133,244,0.2) !important;
    border-color: #4285f4 !important;
}

.pdftopost-google-btn:active {
    background: #f0f1f1 !important;
    box-shadow: none !important;
    transform: scale(0.99) !important;
}

.pdftopost-google-btn svg {
    flex-shrink: 0 !important;
    width: 20px !important;
    height: 20px !important;
}

.pdftopost-auth-divider {
    display: flex !important; align-items: center !important; gap: 12px !important;
    margin: 16px 0 !important; color: #999 !important; font-size: 13px !important;
    padding: 0 !important;
    border: none !important;
}

.pdftopost-auth-divider::before,
.pdftopost-auth-divider::after {
    content: '' !important; flex: 1 !important; height: 1px !important; background: #e0e0e0 !important;
    border: none !important;
}

/* ── Category dropdown ── */
.pdftopost-file-category {
    width: 100% !important;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.2s;
}

.pdftopost-file-category:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ── Job progress steps ── */
.pdftopost-job-progress {
    margin: 12px 0;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* ── Job-progress stepper (brand-aligned) ── */
.pdftopost-job-progress {
    margin: 4px 0 0;
    padding: 14px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f9faff 100%);
    border: 1px solid #e6e8f5;
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(49,46,86,0.04);
}

.pdftopost-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pdftopost-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #9b99b8;
    background: #f2f4fe;
    border: 1px solid #e6e8f5;
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

/* Upcoming step (default) — muted dot before the label */
.pdftopost-step::before {
    content: '';
    display: inline-block;
    width: 6px !important;
    height: 6px;
    border-radius: 50%;
    background: #c8c7dc;
    flex-shrink: 0;
}

/* DONE — solid navy chip with white check */
.pdftopost-step-done {
    color: #ffffff;
    background: #312e56;
    border-color: #312e56;
    box-shadow: 0 2px 6px -2px rgba(49,46,86,0.35);
}

.pdftopost-step-done::before {
    content: '';
    width: 12px !important;
    height: 12px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23312e56' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-size: 10px 10px;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 50%;
}

/* ACTIVE — tinted background, navy text, pulsing navy dot */
.pdftopost-step-active {
    color: #312e56;
    background: #f2f4fe;
    border-color: #312e56;
    box-shadow: 0 0 0 3px rgba(49, 46, 86, 0.12);
    transform: translateY(-1px);
}

.pdftopost-step-active::before {
    background: #312e56;
    width: 8px !important;
    height: 8px;
    box-shadow: 0 0 0 0 rgba(49, 46, 86, 0.55);
    animation: pdftopost-step-pulse 1.4s ease-in-out infinite;
}

@keyframes pdftopost-step-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(49, 46, 86, 0.55); transform: scale(1); }
    50%      { box-shadow: 0 0 0 5px rgba(49, 46, 86, 0); transform: scale(1.1); }
}

/* ── Hide form-edit affordances once processing has started — the user
   can't change Title/Description/Advanced anymore, so collapsing them
   keeps focus on the progress stepper.
   The :has() selector also hides the wrapper <div> that contains the
   toggle + panel — otherwise the empty wrapper would still occupy a
   flex slot and produce a double-22px gap between the description and
   the progress stepper. ── */
.pdftopost-file-card.pdftopost-is-processing .pdftopost-advanced-toggle,
.pdftopost-file-card.pdftopost-is-processing .pdftopost-advanced-panel,
.pdftopost-file-card.pdftopost-is-processing .pdftopost-file-form > div:has(> .pdftopost-advanced-toggle) {
    display: none !important;
}

/* Once the post is created, hide the stepper too — the success banner
   alone tells the story. The JS already hides + empties it; this is a
   safety net for any redraw race. */
.pdftopost-file-card.pdftopost-is-completed .pdftopost-job-progress {
    display: none !important;
}
