/* ═══════════════════════════════════════════════════════
   PDF Tool Workspace — shared full-screen RTL layout
   ───────────────────────────────────────────────────────
   Reusable layout shell for client-side PDF tools:
   full-viewport page, right options panel, left preview
   area, page thumbnails, hero/dropzone, panel controls,
   download list and SEO block.

   Tool-specific styling (e.g. Split ranges, JPG cards)
   lives in each tool's own stylesheet and layers on top
   of these generic `pdftool` classes.
   ═══════════════════════════════════════════════════════ */

:root {
    --sp-red:        #e8554f;
    --sp-red-dark:   #d44a44;
    --sp-red-light:  #fff5f5;
    --sp-gray-bg:    #eef0f4;
    --sp-border:     #dde1e8;
    --sp-text:       #2d3748;
    --sp-text-muted: #6c757d;
    --sp-nav-height: 56px;
    --sp-panel-width: 360px;

    --sp-c0: #e74c3c;
    --sp-c1: #3498db;
    --sp-c2: #2ecc71;
    --sp-c3: #f39c12;
    --sp-c4: #9b59b6;
}

/* ── Full-bleed page wrapper ─────────────────────────── */

.pdftool-page {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ── Shared full-viewport shell ──────────────────────── */

html:has(.pdftool-page) {
    height: 100%;
}

body:has(.pdftool-page) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

body:has(.pdftool-page) > header {
    flex: 0 0 auto;
}

body:has(.pdftool-page) header .navbar {
    margin-bottom: 0 !important;
}

body:has(.pdftool-page) .container {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body:has(.pdftool-page) main.pb-3 {
    padding: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body:has(.pdftool-page) .site-footer,
body:has(.pdftool-page) .footer {
    flex: 0 0 auto;
    position: static;
    width: 100%;
    line-height: 1.55;
    white-space: normal;
    padding: 0;
}

body:has(.pdftool-page) .site-footer .container,
body:has(.pdftool-page) .footer .container {
    max-width: none;
}

.footer--pdftool {
    border-top: 1px solid var(--sp-border) !important;
    text-align: center;
    font-size: 0.875rem;
    color: var(--sp-text-muted);
}

.footer--pdftool__privacy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.footer--pdftool__privacy .bi {
    color: var(--sp-red);
    font-size: 1rem;
    flex-shrink: 0;
}

.footer--pdftool__meta {
    margin: 0;
    font-size: 0.8rem;
}

.footer--pdftool__meta a {
    color: var(--sp-text-muted);
    text-decoration: none;
}

.footer--pdftool__meta a:hover {
    color: var(--sp-red);
    text-decoration: underline;
}

/* ── Full-screen workspace mode ────────────────────────
   Keep only the slim privacy strip; hide the full footer
   grid so it cannot steal viewport height. Upload/hero
   still shows the normal footer. Height comes from body
   flex: header + growing container + privacy bar. */

body:has(.pdftool--workspace) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

body:has(.pdftool--workspace) .site-footer,
body:has(.pdftool--workspace) .footer {
    display: block;
    flex: 0 0 auto;
    margin-top: 0;
    overflow: hidden;
    background: #0b1220;
    background-image: none;
    border-top: 1px solid rgb(255 255 255 / 0.1);
}

body:has(.pdftool--workspace) .site-footer__glow,
body:has(.pdftool--workspace) .site-footer__inner {
    display: none !important;
}

body:has(.pdftool--workspace) .site-footer__privacy-strip {
    border-bottom: none;
    background: rgb(0 0 0 / 0.35);
}

body:has(.pdftool--workspace) .site-footer__privacy-text {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    padding-block: 0.45rem;
    padding-inline: 0.75rem;
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: center;
}

/* Avoid PWA banner covering the mobile bottom options panel */
body:has(.pdftool--workspace) .pwa-install {
    display: none !important;
}

body:has(.pdftool--workspace) > header.site-header,
body:has(.pdftool--workspace) > header {
    flex: 0 0 auto;
}

body:has(.pdftool--workspace) > .container {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

body:has(.pdftool--workspace) main.pb-3,
body:has(.pdftool--workspace) .pdftool-page {
    overflow: hidden;
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
}

body:has(.pdftool--workspace) .pdftool--workspace {
    height: 100%;
    min-height: 0;
}

/* ── Base ─────────────────────────────────────────────── */

.pdftool {
    direction: rtl;
    font-family: inherit;
    width: 100%;
}

.pdftool:not(.pdftool--workspace) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ── Hero (upload) — centered full viewport ──────────── */

.pdftool__hero {
    flex: 0 0 auto;
    width: 100%;
    min-height: min(100dvh, 720px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(1.25rem, 5vw, 2.5rem);
    background: var(--sp-gray-bg);
}

.pdftool__hero-content {
    width: 100%;
    max-width: 720px;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdftool__hero-title {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    font-weight: 700;
    color: var(--sp-text);
    margin-bottom: 0.5rem;
    width: 100%;
}

.pdftool__hero-sub {
    color: var(--sp-text-muted);
    margin-bottom: clamp(1.25rem, 4vw, 2rem);
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
    max-width: 36rem;
    line-height: 1.6;
}

.pdftool__dropzone {
    border: 2px dashed var(--sp-border);
    border-radius: 16px;
    background: #fff;
    padding: clamp(2rem, 6vw, 3.5rem) clamp(1.25rem, 4vw, 2.5rem);
    width: 100%;
    max-width: 560px;
    cursor: default;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.pdftool__dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.pdftool__dropzone-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    width: 100%;
}

.pdftool__dropzone-or {
    font-size: 0.875rem;
    color: var(--sp-text-muted);
}

.pdftool__dropzone.is-busy {
    opacity: 0.55;
    pointer-events: none;
    cursor: default;
}

.pdftool__dropzone.is-drag-over {
    border-color: var(--sp-red);
    background: var(--sp-red-light);
    box-shadow: 0 8px 32px rgba(232, 85, 79, 0.12);
}

.pdftool__select-btn {
    background: var(--sp-red);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.85rem 2.25rem;
    font-size: clamp(0.95rem, 2.5vw, 1.05rem);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
    white-space: nowrap;
}

.pdftool__select-btn:hover {
    background: var(--sp-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 85, 79, 0.3);
}

.pdftool__dropzone-hint {
    font-size: 0.85rem;
    color: var(--sp-text-muted);
    margin: 0;
}

.pdftool__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pdftool__loading--inline {
    flex: 1;
    min-height: 280px;
}

/* ── Full-screen workspace grid ──────────────────────── */

.pdftool-page:has(.pdftool--workspace) {
    height: 100%;
}

.pdftool--workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sp-panel-width);
    grid-template-rows: minmax(0, 1fr);
    direction: ltr;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--sp-gray-bg);
}

/* ── Options panel — physical RIGHT column ───────────── */

.pdftool__panel {
    grid-column: 2;
    grid-row: 1;
    direction: rtl;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #fff;
    border-left: 1px solid var(--sp-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
    z-index: 2;
}

.pdftool__panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sp-text);
    margin: 0;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
    text-align: center;
}

.pdftool__panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overscroll-behavior: contain;
}

.pdftool__panel-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--sp-border);
    background: #fff;
}

/* ── Main preview area — physical LEFT column ────────── */

.pdftool__main {
    grid-column: 1;
    grid-row: 1;
    direction: rtl;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdftool__main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
}

.pdftool__file-name {
    font-weight: 600;
    color: var(--sp-text);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.pdftool__main-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.pdftool__page-count {
    font-size: 0.82rem;
    color: var(--sp-text-muted);
    background: var(--sp-gray-bg);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
}

.pdftool__change-btn {
    background: #fff;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    color: var(--sp-text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}

.pdftool__change-btn:hover {
    border-color: var(--sp-red);
    color: var(--sp-red);
}

.pdftool__add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--sp-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(232, 85, 79, 0.35);
}

.pdftool__add-btn:hover:not(:disabled) {
    background: var(--sp-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(232, 85, 79, 0.42);
}

.pdftool__add-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pdftool__add-btn .bi {
    font-size: 1.05rem;
    line-height: 1;
}

.pdftool__dropzone-bi {
    font-size: 2.75rem;
    color: var(--sp-red);
    line-height: 1;
}

.pdftool__change-btn .bi {
    font-size: 0.95rem;
    line-height: 1;
}

.pdftool__thumbs {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 1.25rem 1.25rem;
    align-content: start;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ── Thumbnail cards ─────────────────────────────────── */

.pdftool__thumb {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 8px;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.12s;
}

.pdftool__thumb:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.pdftool__thumb-skeleton {
    width: 100%;
    aspect-ratio: 0.707;
    background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.pdftool__thumb-img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.pdftool__thumb-num {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--sp-text-muted);
}

.pdftool__thumb.is-selected {
    border-color: var(--sp-red);
    background: var(--sp-red-light);
}

.pdftool__thumb.is-clickable {
    cursor: pointer;
    user-select: none;
}

.pdftool__thumb.is-clickable:hover {
    border-color: var(--sp-red);
    transform: translateY(-2px);
}

.pdftool__thumb-check {
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
}

/* ── Panel controls ──────────────────────────────────── */

.pdftool__tabs {
    display: flex;
    gap: 0.35rem;
    background: var(--sp-gray-bg);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 1rem;
}

.pdftool__tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--sp-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.pdftool__tab.is-active {
    background: #fff;
    color: var(--sp-text);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.pdftool__tab:disabled { opacity: 0.55; cursor: not-allowed; }

.pdftool__tab-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.pdftool__section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sp-text-muted);
    margin: 0;
}

.pdftool__toggle-group {
    display: flex;
    gap: 0.35rem;
    background: var(--sp-gray-bg);
    border-radius: 10px;
    padding: 4px;
}

.pdftool__toggle {
    flex: 1;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--sp-text-muted);
    cursor: pointer;
}

.pdftool__toggle.is-active {
    background: #fff;
    color: var(--sp-red);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.pdftool__pages-input {
    width: 100%;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
    background: #fff;
}

.pdftool__pages-input:focus {
    outline: none;
    border-color: var(--sp-red);
    box-shadow: 0 0 0 3px rgba(232, 85, 79, 0.12);
}

.pdftool__input-hint {
    font-size: 0.75rem;
    color: var(--sp-text-muted);
    margin: 0.35rem 0 0;
    line-height: 1.5;
}

.pdftool__check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.88rem;
    cursor: pointer;
    line-height: 1.5;
}

.pdftool__checkbox {
    margin-top: 3px;
    accent-color: var(--sp-red);
    width: 16px;
    height: 16px;
}

.pdftool__info-text {
    font-size: 0.82rem;
    color: var(--sp-text-muted);
    background: var(--sp-gray-bg);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    margin: 0;
    border-inline-start: 3px solid var(--sp-red);
    line-height: 1.5;
}

.pdftool__info-text--info {
    background: #eef6ff;
    border-inline-start-color: #3b82f6;
    color: #1e40af;
}

.pdftool__progress-bar-wrap {
    height: 7px;
    border-radius: 4px;
    overflow: hidden;
    background: #e9ecef;
}

.pdftool__progress-bar {
    background: var(--sp-red) !important;
}

.pdftool__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--sp-red);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.95rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
}

.pdftool__cta:hover:not(:disabled) {
    background: var(--sp-red-dark);
    box-shadow: 0 6px 20px rgba(232, 85, 79, 0.35);
    transform: translateY(-1px);
}

.pdftool__cta:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pdftool__cta .pdftool__cta-icon.bi {
    font-size: 1.1rem;
    line-height: 1;
}

/* ── Converter tools (JPG / Word / PPTX) ───────────── */

.pdf-convert__panel-body {
    gap: 0.85rem;
}

.pdf-convert__file-meta {
    font-size: 0.82rem;
    color: var(--sp-text-muted);
    margin: 0;
    font-weight: 500;
}

.pdf-convert__option-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sp-text-muted);
    margin-bottom: 0.35rem;
}

.pdf-convert__progress-wrap {
    margin-top: 0.25rem;
}

.office-convert__preview {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    min-height: 280px;
}

.office-convert__file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    max-width: 360px;
    width: 100%;
    padding: 2rem 1.5rem;
    border: 1.5px solid var(--sp-border, #e8e8ec);
    border-radius: 14px;
    background: #fafbfc;
    text-align: center;
}

.office-convert__file-icon {
    font-size: 3.5rem;
    line-height: 1;
}

.office-convert__file-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sp-text, #333);
    margin: 0;
    word-break: break-word;
    line-height: 1.4;
}

.office-convert__file-meta {
    font-size: 0.82rem;
    color: var(--sp-text-muted, #888);
    margin: 0;
}

/* ── Download history ────────────────────────────────── */

.pdftool__downloads {
    flex-shrink: 0;
    border-top: 1px solid var(--sp-border);
    background: #fafbfc;
    max-height: min(240px, 32vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdftool__downloads-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem 0.5rem;
    flex-shrink: 0;
}

.pdftool__downloads-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--sp-text);
}

.pdftool__downloads-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--sp-text-muted);
    background: #eef0f4;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    min-width: 1.4rem;
    text-align: center;
}

.pdftool__download-list {
    list-style: none;
    margin: 0;
    padding: 0 0.85rem 0.75rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pdftool__download-item {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    background: #fff;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.pdftool__download-info {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    min-width: 0;
}

.pdftool__download-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--sp-red-light);
    color: var(--sp-red);
}

.pdftool__download-meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pdftool__download-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sp-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: right;
}

.pdftool__download-size {
    font-size: 0.72rem;
    color: var(--sp-text-muted);
    direction: ltr;
    text-align: right;
}

.pdftool__download-actions {
    display: flex;
    gap: 0.4rem;
}

.pdftool__download-btn,
.pdftool__download-remove {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    line-height: 1.2;
}

.pdftool__download-btn {
    background: var(--sp-red);
    color: #fff;
    border: 1px solid var(--sp-red);
}

.pdftool__download-btn:hover {
    background: var(--sp-red-dark);
    border-color: var(--sp-red-dark);
    color: #fff;
}

.pdftool__download-remove {
    background: #fff;
    color: #94a3b8;
    border: 1px solid var(--sp-border);
}

.pdftool__download-remove:hover {
    color: #dc3545;
    border-color: #f5c2c7;
    background: #fff5f5;
}

/* ── Responsive ──────────────────────────────────────── */

/* Hero upload — mobile */
@media (max-width: 575px) {
    .pdftool__hero {
        padding: 1.25rem 1rem;
    }

    .pdftool__dropzone {
        border-radius: 12px;
    }

    .pdftool__dropzone-actions {
        flex-direction: column;
        gap: 0.65rem;
    }

    .pdftool__select-btn {
        width: 100%;
        padding: 0.9rem 1rem;
    }

    .pdftool__dropzone-or {
        width: 100%;
    }
}

/* Tablet: narrower panel, still side-by-side */
@media (max-width: 991px) and (min-width: 768px) {
    :root {
        --sp-panel-width: 300px;
    }

    .pdftool__thumbs {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
        padding: 0.85rem;
    }
}

/* Mobile: column flex so panel stays at bottom of viewport (never under header).
   DOM order is panel-first for desktop RTL grid; order overrides that here. */
@media (max-width: 767px) {
    :root {
        --sp-panel-width: 100%;
    }

    .pdftool--workspace {
        display: flex;
        flex-direction: column;
        direction: rtl;
        grid-template-columns: unset;
        grid-template-rows: unset;
    }

    .pdftool__main {
        order: 1;
        grid-column: unset;
        grid-row: unset;
        flex: 1 1 auto;
        min-height: 0;
        min-width: 0;
        width: 100%;
        height: auto;
    }

    .pdftool__panel {
        order: 2;
        grid-column: unset;
        grid-row: unset;
        position: relative;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        max-height: min(48dvh, 420px);
        border-left: none;
        border-top: 1px solid var(--sp-border);
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
        /* Above tool content; below sticky header (--z-sticky: 1020) */
        z-index: 1010;
        border-radius: 14px 14px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .pdftool__panel-body {
        padding: 0.75rem 1rem;
    }

    .pdftool__panel-footer {
        padding: 0.65rem 1rem 0.85rem;
    }

    .pdftool__downloads {
        max-height: min(140px, 20vh);
    }

    .pdftool__downloads-header {
        padding-inline: 1rem;
    }

    .pdftool__download-list {
        padding-inline: 0.65rem;
    }

    .pdftool__panel-title {
        padding: 0.75rem 1rem 0.6rem;
        font-size: 1.05rem;
    }

    .pdftool__main-header {
        padding: 0.55rem 0.75rem;
        flex-wrap: wrap;
    }

    .pdftool__file-name {
        font-size: 0.85rem;
        flex: 1 1 100%;
        order: 2;
    }

    .pdftool__main-meta {
        flex: 1 1 auto;
        width: 100%;
        justify-content: space-between;
        order: 1;
    }

    .pdftool__page-count {
        font-size: 0.75rem;
    }

    .pdftool__change-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }

    .pdftool__thumbs {
        grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
        gap: 0.55rem;
        padding: 0.65rem;
    }

    .pdftool__thumb-img {
        max-height: 140px;
    }

    .pdftool__thumb {
        padding: 5px;
        border-radius: 8px;
    }

    .pdftool__tab {
        font-size: 0.72rem;
        padding: 0.45rem 0.25rem;
    }

    .pdftool__tab-icon {
        width: 14px;
        height: 14px;
    }

    .pdftool__cta {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
}

/* Desktop wide: dense grid like iLovePDF */
@media (min-width: 992px) {
    .pdftool__thumbs {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    :root {
        --sp-panel-width: 380px;
    }

    .pdftool__thumbs {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 1rem;
        padding: 1.15rem 1.5rem 1.5rem;
    }

    .pdftool__thumb-img {
        max-height: 210px;
    }
}

@media (min-width: 1600px) {
    .pdftool__thumbs {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .pdftool__thumb-img {
        max-height: 220px;
    }
}

/* ── SEO content (below tool on landing) ─────────────── */

body:has(.pdftool--workspace) .pdftool-seo {
    display: none;
}

.pdftool-seo {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid var(--sp-border);
    padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem) clamp(2.5rem, 6vw, 4rem);
}

.pdftool-seo__inner {
    max-width: 720px;
    margin-inline: auto;
    color: var(--sp-text);
    line-height: 1.85;
}

.pdftool-seo h2 {
    font-size: clamp(1.35rem, 3.5vw, 1.65rem);
    font-weight: 700;
    color: var(--sp-text);
    margin-bottom: 1rem;
    line-height: 1.45;
}

.pdftool-seo h3 {
    font-size: clamp(1.05rem, 2.5vw, 1.2rem);
    font-weight: 700;
    color: var(--sp-text);
    margin-top: 1.75rem;
    margin-bottom: 0.65rem;
}

.pdftool-seo p {
    margin-bottom: 0.85rem;
    color: #4a5568;
    font-size: 0.98rem;
}

.pdftool-seo ul {
    padding-right: 1.25rem;
    margin-bottom: 1rem;
}

.pdftool-seo li {
    margin-bottom: 0.45rem;
    color: #4a5568;
    font-size: 0.98rem;
}

.pdftool-seo__tagline {
    margin-top: 1.5rem;
    margin-bottom: 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sp-border);
    color: var(--sp-text) !important;
}
