/* =========================
   GLOBAL
========================= */
body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: #f4f6f8;
}

h1 {
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

/* =========================
   HEADER / NAVBAR
========================= */
.header {
    background: white;
    color: #ff6a00;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #ff6a00;
}

.logo {
    display: flex;
    flex-direction: column;
}

.logo-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 24px;
    font-weight: 700;
}

.logo-icon {
    width: 42px;
    height: 42px;
}

.tagline {
    font-size: 12px;
    margin-top: 2px;
}

/* NAV CENTER */
.nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav a {
    color: black;
    margin: 0 15px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.nav a:hover {
    text-decoration: underline;
}

/* RIGHT ACTIONS */
.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.actions .pricing {
    color: black;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.login {
    background: white;
    border: 1px solid #ccc;
    color: black;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.signup {
    background: #ff6a00;
    color: white;
    border: 1px solid #ff6a00;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

/* =========================
   INDEX PAGE (HOME)
========================= */

/* v=16 */
/* Two-column layout: tile grid + sidebar ad */
.main-layout {
    display: flex;
    align-items: flex-start;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px 20px;
    gap: 20px;
}
.main-layout .content { flex: 1; min-width: 0; }
.main-layout .sidebar {
    width: 200px;
    flex-shrink: 0;
    padding-top: 20px;
}

/* Collapse AdSense containers when the ad is unfilled — no empty space */
.adsbygoogle[data-ad-status="unfilled"] { display: none !important; }

.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.tile {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: 0.2s;
}

.tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.tile h3 {
    margin: 10px 0;
    font-size: 14px;
}

.tile p {
    color: #777;
    font-size: 10px;
}

.icon {
    font-size: 32px;
    margin-bottom: 15px;
    color: #ff6a00;
}

/* =========================
   TRUST / SECURITY SECTION
========================= */
.trust-section {
    background: #1a1a2e;
    color: #fff;
    padding: 60px 20px 80px;
    text-align: center;
}

.trust-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: #fff;
}

.trust-subtitle {
    color: #aab;
    font-size: 15px;
    margin-bottom: 40px;
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    text-align: left;
}

.trust-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #ffffff0f;
    border: 1px solid #ffffff18;
    border-radius: 12px;
    padding: 20px;
}

.trust-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ff6a0022;
    border: 1px solid #ff6a0055;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ff6a00;
    font-size: 16px;
}

.trust-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #fff;
}

.trust-item p {
    font-size: 12px;
    color: #99a;
    margin: 0;
    line-height: 1.6;
}

/* =========================
   TOOL PAGE - HERO
========================= */
.tool-hero {
    text-align: center;
    margin-top: 80px;
}

.tool-hero h1 {
    font-size: 28px;
    font-weight: 700;
}

.tool-subtitle {
    font-size: 16px;
    color: #666;
    margin: 20px 0 40px;
}

.upload-btn {
    background: #ff6a00;
    color: white;
    padding: 20px 50px;
    font-size: 18px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

.drop-text {
    margin-top: 15px;
    color: #777;
    font-size: 16px;
}

/* =========================
   TOOL PAGE - WORKSPACE
========================= */
.workspace {
    display: flex;
    height: calc(100vh - 110px);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* LEFT — scrollable */
.workspace-left {
    flex: 3;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* RIGHT — fixed, no overflow growth */
.workspace-right {
    flex: 1;
    background: #fff;
    padding: 30px;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

/* CONTAINER */
.pdf-container {
    background: #e9eaec;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    flex: 1;
}

/* GRID */
.preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* FILE CARD */
.page {
    width: 140px;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.page canvas {
    width: 100%;
    border-radius: 6px;
}

.file-name {
    font-size: 11px;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-count {
    font-size: 10px;
    color: #777;
    margin-top: 6px;

}

.delete-btn {
    background: none;
    border: 1px solid #ff3d00;
    color: #ff3d00;
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
    margin-top: 6px;
}

.delete-btn:hover {
    background: #ff3d00;
    color: white;
}

/* ADD BUTTON */
.add-more {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    background: #e53935;
    color: white;
    font-size: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}


/* PUSH BUTTON TO BOTTOM */
.process-btn-right {
    margin-top: auto;
    background: #ff3d00;
    color: white;
    padding: 18px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}

.info-box {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

/* FULL SCREEN OVERLAY */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: rgba(0,0,0,0.5);
    display: none;

    justify-content: center;
    align-items: center;

    z-index: 9999;
}

/* BOX */
.loader-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
}

/* SPINNER */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top: 4px solid #ff6a00;
    border-radius: 50%;
    margin: 0 auto 15px;

    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}


/*! Ad Box at Processing */


.ad-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.loader-ad {
    margin-top: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
    color: #555;
}

.download-overlay {
    position: absolute; /* 🔥 IMPORTANT: not fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;

    z-index: 5;
}

/* Attach overlay ONLY to preview container */
.pdf-container {
    position: relative; /* 🔥 REQUIRED */
}

.download-box {
    background: white;
    padding: 50px 70px; /* bigger */
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);

    width: 420px; /* consistent size */
    max-width: 90%;
}

.download-box h2 {
    font-size: 24px;
    margin-bottom: 25px;
}

.download-btn {
    background: #ff3d00;
    color: white;
    padding: 18px 50px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
}

.blur-bg {
    filter: blur(6px) brightness(0.8);
    transition: 0.3s;
}

/* ############### */

/* DOWNLOAD OVERLAY */
.download-overlay {
    position: absolute;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.download-box {
    background: white;
    padding: 50px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* BUTTON */
.download-btn {
    background: #ff3d00;
    color: white;
    padding: 16px 40px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.download-btn:disabled {
    background: #aaa;
    cursor: default;
    opacity: 0.7;
}

/* BLUR ONLY PREVIEW */
.blur-bg {
    filter: blur(6px);
}

/* ── PDF to Word — mode cards ────────────────────────────────────────────── */
.word-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}
.word-mode-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 12px 12px;
    cursor: pointer;
    position: relative;
    background: #fff;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.word-mode-card:hover {
    border-color: #ff6a00;
}
.word-mode-card.active {
    border-color: #ff6a00;
    background: #fff5f0;
}
.word-mode-card.pro-card {
    opacity: 0.72;
}
.word-mode-card.pro-card.active {
    border-color: #f59e0b;
    background: #fffbeb;
    opacity: 1;
}
.word-mode-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.word-mode-icon {
    font-size: 20px;
    color: #ff6a00;
}
.pro-card .word-mode-icon {
    color: #f59e0b;
}
.word-mode-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
}
.word-mode-badge.free {
    background: #e8f5e9;
    color: #2e7d32;
}
.word-mode-badge.pro {
    background: #fef3c7;
    color: #92400e;
}
.word-mode-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 4px;
}
.word-mode-desc {
    font-size: 11.5px;
    color: #777;
    line-height: 1.4;
}
.word-mode-lock {
    position: absolute;
    bottom: 10px;
    right: 10px;
    color: #bbb;
    font-size: 13px;
}

/* ── Site Footer ─────────────────────────────────────────────────────────── */
.site-footer {
    background: #0d0d1a;
    color: #aaa;
    padding: 52px 60px 32px;
    margin-top: 0;
    border-top: 2px solid #ff6a0033;
}
.site-footer-grid {
    display: flex;
    gap: 80px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto 40px;
}
.site-footer-col h4 {
    color: #ff6a00;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 20px;
}
.site-footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.site-footer-col ul li a {
    color: #aaa;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s;
}
.site-footer-col ul li a:hover {
    color: #ff6a00;
}
.site-footer-bottom {
    border-top: 1px solid #333;
    padding-top: 24px;
    text-align: center;
    font-size: 12.5px;
    color: #555;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================
   EDIT PDF TOOL
========================= */
.edit-canvas-container {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;        /* center page horizontally */
    padding: 20px;
    min-height: 0;
}

.edit-page-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 6px 30px rgba(0,0,0,0.18);
    border-radius: 4px;
    flex-shrink: 0;
}

.edit-page-wrapper canvas {
    display: block;
    border-radius: 4px;
}

.edit-annotation-layer {
    position: absolute;
    inset: 0;
    cursor: text;
    border-radius: 4px;
}

/* ── OCR Edit word overlays ───────────────────────────────────────────────── */
.ocr-word {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed transparent;
    border-radius: 2px;
    cursor: text;
    background: transparent;
    transition: background 0.1s, border-color 0.1s;
}
.ocr-word:hover {
    border-color: rgba(255,106,0,0.55);
    background: rgba(255,106,0,0.09);
}
.ocr-word.ocr-modified {
    border-color: rgba(34,197,94,0.65);
    background: rgba(34,197,94,0.10);
}
.ocr-word.ocr-word-active {
    border-color: #ff6a00;
    background: #fff;
    z-index: 10;
    overflow: visible;
}
.ocr-word.ocr-deleted {
    border-color: rgba(200, 0, 0, 0.55) !important;
    background: rgba(255, 60, 60, 0.12) !important;
    cursor: text !important;
}
.ocr-word.ocr-selected {
    border-color: rgba(59, 130, 246, 0.9) !important;
    background: rgba(59, 130, 246, 0.14) !important;
    cursor: grab !important;
}
.ocr-word.ocr-dragging {
    cursor: grabbing !important;
    opacity: 0.65;
}

.ocr-word-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    padding: 0 2px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    white-space: nowrap;
    min-width: 60px;
}

/* Placed annotation */
.edit-annotation {
    position: absolute;
    display: inline-flex;
    align-items: flex-start;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1.5px solid transparent;
    cursor: default;
    white-space: nowrap;
    line-height: 1.2;
    transform: translateY(-100%);   /* anchor top-left to click point */
}

.edit-annotation:hover,
.edit-annotation.selected {
    border-color: #ff6a00;
    background: rgba(255,106,0,0.06);
}

.edit-ann-delete {
    display: none;
    background: #ff3d00;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-top: -4px;
}

.edit-annotation:hover .edit-ann-delete,
.edit-annotation.selected .edit-ann-delete {
    display: block;
}

/* Inline typing input */
.edit-inline-input {
    position: absolute;
    background: rgba(255,255,255,0.85);
    border: 1.5px dashed #ff6a00;
    border-radius: 3px;
    outline: none;
    padding: 2px 4px;
    min-width: 80px;
    font-family: inherit;
    line-height: 1.2;
    transform: translateY(-100%);
    z-index: 10;
}

/* Right panel sections */
.edit-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
    margin-bottom: 8px;
}

.edit-tool-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.edit-tool-btn {
    flex: 1;
    padding: 8px;
    border: 1.5px solid #ddd;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.edit-tool-btn.active {
    border-color: #ff6a00;
    background: #fff5f0;
    color: #ff6a00;
    font-weight: 600;
}

.edit-tool-btn:hover:not(.active) {
    border-color: #ccc;
    background: #fafafa;
}

/* Property rows */
.edit-prop-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #444;
}

.edit-prop-row label {
    width: 42px;
    flex-shrink: 0;
    font-size: 13px;
}

.edit-prop-input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.edit-prop-input:focus { border-color: #ff6a00; }

.edit-prop-number { width: 58px; }

.edit-prop-color {
    width: 36px;
    height: 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

.edit-prop-unit {
    font-size: 12px;
    color: #aaa;
}

/* Bold / Italic style buttons */
.edit-style-row {
    display: flex;
    gap: 6px;
}

.edit-style-btn {
    width: 32px;
    height: 30px;
    border: 1.5px solid #ddd;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-family: serif;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-style-btn.active {
    border-color: #ff6a00;
    background: #fff5f0;
    color: #ff6a00;
}

/* Page navigation */
.edit-page-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.edit-nav-btn {
    width: 34px;
    height: 34px;
    border: 1.5px solid #ddd;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #555;
    transition: all 0.15s;
}

.edit-nav-btn:hover {
    border-color: #ff6a00;
    color: #ff6a00;
}

.edit-page-indicator {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Edited (changed) text item — fully opaque so canvas text doesn't bleed through */
.edit-existing-text.changed {
    background: #fffbe6;
    color: #111 !important;
    border-color: rgba(255, 165, 0, 0.7) !important;
}

/* Deleted text item — invisible in preview (still tracked for save) */
.edit-existing-text.deleted {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Move mode — selected items */
.edit-existing-text.selected {
    border-color: rgba(59, 130, 246, 0.85) !important;
    background: rgba(59, 130, 246, 0.13) !important;
    color: transparent !important;
    cursor: grab !important;
}
.edit-existing-text.selected.dragging {
    cursor: grabbing !important;
    opacity: 0.65;
}

/* Rubber-band selection box */
#rubberBand {
    position: absolute;
    border: 1.5px dashed rgba(59, 130, 246, 0.9);
    background: rgba(59, 130, 246, 0.07);
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
}

/* Sticky centering wrapper — floats the nav pill over the PDF canvas.
   Negative margin-top pulls it UP so it overlaps the page rather than
   sitting in empty space below the PDF when the page fits the container. */
.edit-nav-wrapper {
    position: sticky;
    bottom: 16px;
    z-index: 30;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: none;
    margin-top: -56px;
}

/* Page nav bar — frosted pill floating over the canvas */
.edit-page-nav-bar {
    pointer-events: all;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
}

/* Existing text editable overlay */
.edit-existing-text {
    position: absolute;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 2px;
    outline: none;
    cursor: text;
    white-space: pre;
    line-height: 1.2;
    padding: 0 2px;
    font-family: sans-serif;
    color: transparent;        /* invisible until hovered/focused */
    caret-color: #333;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
    min-height: 1em;
}

/* Hover: show border outline only — keep text transparent so canvas text
   doesn't double-render. User sees original canvas text with an orange frame. */
.edit-existing-text:hover {
    border-color: rgba(255, 106, 0, 0.6);
}

/* Editing: fully opaque white background covers canvas text beneath */
.edit-existing-text.editing {
    border-color: #ff6a00;
    background: #fff;
    color: #000;
    box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.2);
    z-index: 10;
}

/* In select mode, existing text is locked */
.edit-existing-text.locked {
    cursor: default;
    pointer-events: none;
}

/* Hint box in right panel */
.edit-hint-box {
    background: #f4f6f8;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    margin-top: 16px;
}
.edit-hint-warn {
    background: #fff7f0;
    border: 1px solid #ffd0a8;
    color: #7a3b00;
}
.edit-hint-warn a { color: #e05a00; }

/* Standard / OCR Edit tab switcher */
.edit-tab-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
}
.edit-tab-btn {
    flex: 1;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    background: #f4f6f8;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.edit-tab-btn:hover { background: #e8eef5; border-color: #bbb; }
.edit-tab-btn.active {
    background: #ff6a00;
    border-color: #ff6a00;
    color: #fff;
}
.pro-badge {
    display: inline-block;
    background: #ffd200;
    color: #7a4f00;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
    letter-spacing: 0.04em;
}

/* Zoom divider & label in nav bar */
.edit-zoom-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

.edit-zoom-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    min-width: 40px;
    text-align: center;
}

/* Edit tool — right panel with pinned save button */
.edit-right-panel {
    padding: 0 !important;
    overflow: hidden !important;
}

.right-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 0;
    min-height: 0;
}

.edit-save-btn {
    margin: 12px 24px 20px;
    flex-shrink: 0;
    width: calc(100% - 48px);
}
.edit-save-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.conv-info-box {
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 12.5px;
    color: #4338ca;
    line-height: 1.5;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.conv-info-box i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* =========================
   REARRANGE TOOL
========================= */
.rearrange-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 4px;
}

.rearrange-page {
    width: 170px;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.09);
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    user-select: none;
}

.rearrange-page:hover {
    border-color: #ffb380;
    transform: translateY(-3px);
}

.rearrange-page.selected {
    border-color: #ff6a00;
    box-shadow: 0 6px 20px rgba(255,106,0,0.25);
}

.rearrange-thumb {
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
}

.rearrange-thumb canvas {
    width: 100%;
    display: block;
    border-radius: 6px;
}

.rearrange-page-num {
    font-size: 12px;
    margin-top: 8px;
    color: #555;
    font-weight: 600;
}

/* HINT TEXT */
.rearrange-hint {
    font-size: 13px;
    color: #888;
    margin: 0 0 12px;
}

/* SELECTED INFO BAR */
.rearrange-selected-info {
    font-size: 13px;
    color: #888;
    background: #f4f6f8;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.rearrange-selected-info.active {
    color: #ff6a00;
    background: #fff5f0;
    font-weight: 600;
}

/* CONTROL GROUPS */
.rearrange-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.rearrange-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
}

.control-row {
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    flex: 1;
    padding: 9px 10px;
    border: 1.5px solid #ddd;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: #333;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ctrl-btn:hover:not(:disabled) {
    background: #fff5f0;
    border-color: #ff6a00;
    color: #ff6a00;
}

.ctrl-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.ctrl-btn-danger {
    color: #e53935;
    border-color: #e5393533;
    width: 100%;
}

.ctrl-btn-danger:hover:not(:disabled) {
    background: #fff0f0;
    border-color: #e53935;
    color: #e53935;
}

/* =========================
   SPLIT OPTIONS
========================= */
.split-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.split-option:has(input:checked) {
    border-color: #ff6a00;
    background: #fff5f0;
}

.split-option input[type="radio"] {
    margin-top: 3px;
    accent-color: #ff6a00;
    flex-shrink: 0;
}

.split-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.split-option-title {
    font-weight: 600;
    font-size: 14px;
    color: #222;
}

.split-option-desc {
    font-size: 12px;
    color: #888;
}

.split-sub-input {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #444;
    flex-wrap: wrap;
}

.split-sub-input input[type="number"],
.split-sub-input input[type="text"] {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.split-sub-input input[type="number"] {
    width: 60px;
}

.split-sub-input input[type="text"] {
    width: 160px;
}

.split-sub-input input:focus {
    border-color: #ff6a00;
}


/* ===== WATERMARK PAGE ===== */

.preview-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

.zoom-controls button {
    margin-left: 5px;
}

#pdfCanvas {
    width: 100%;
    background: white;
    border-radius: 10px;
}

/* 3x3 GRID */
.grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.grid-3x3 div {
    height: 40px;
    border: 1px solid #ddd;
    cursor: pointer;
}

.grid-3x3 div.active {
    background: #ff4d00;
}


/*! Add Page number CSS */

/* Page number preview overlay */
#pageNumberLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.pn-overlay {
    position: absolute;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

/* Style-group tiles — rectangular, smaller text */
#styleGroup .edit-tool-btn {
    flex: none;
    padding: 5px 14px;
    font-size: 11px;
}

/* Font selector */
.pn-select {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    outline: none;
    cursor: pointer;
}
.pn-select:focus { border-color: #6c63ff; }

/* ── Page number: start-page row ── */
.pn-startpage-row {
    display:     flex;
    align-items: center;
    gap:         10px;
    margin-top:  6px;
}
.pn-startpage-label {
    font-size:   13px;
    color:       #374151;
    flex:        1;
}
.pn-startpage-input {
    width:        60px;
    padding:      5px 7px;
    border:       1.5px solid #d1d5db;
    border-radius: 6px;
    font-size:    13px;
    text-align:   center;
    outline:      none;
    flex-shrink:  0;
}
.pn-startpage-input:focus { border-color: #6c63ff; }
.pn-startpage-hint {
    font-size:  11.5px;
    color:      #6b7280;
    margin:     5px 0 0;
    line-height: 1.4;
}

.tile-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.tile {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.tile.active {
    background: #ff5a00;
    color: #fff;
    border-color: #ff5a00;
}

.inline-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
/* =========================
   WATERMARK TOOL
========================= */

/* 3×3 position grid */
.wm-grid {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows:    repeat(3, 30px);
    gap: 5px;
    margin-bottom: 10px;
}

.wm-grid-cell {
    background: #f0f0f2;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s;
}

.wm-grid-cell:hover  { background: #e0e8ff; border-color: #6c63ff; }
.wm-grid-cell.active { background: #6c63ff; border-color: #6c63ff; }

/* Text input */
.wm-text-input {
    width: 100%;
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.wm-text-input:focus { border-color: #6c63ff; }

/* Range inputs */
.wm-range { flex: 1; accent-color: #6c63ff; }

/* Image pick button — smaller than hero upload-btn */
.wm-img-pick {
    font-size: 13px;
    padding: 8px 18px;
}

.wm-img-name {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    word-break: break-all;
}

/* Mosaic checkbox label */
.wm-check-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    margin-top: 6px;
}

/* Layer radio buttons styled like toggle buttons */
.wm-layer-btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.14s;
    user-select: none;
}
.wm-layer-btn:hover  { border-color: #6c63ff; color: #6c63ff; }
.wm-layer-btn.active { border-color: #6c63ff; background: #f0eeff; color: #6c63ff; }

/* Rotation preset buttons */
.wm-rot-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.wm-rot-btn {
    padding: 5px 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    background: white;
    color: #555;
    transition: all 0.14s;
}
.wm-rot-btn:hover  { border-color: #6c63ff; color: #6c63ff; }
.wm-rot-btn.active { border-color: #6c63ff; background: #f0eeff; color: #6c63ff; }
.wm-rot-input {
    width: 56px;
    padding: 5px 8px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    text-align: center;
}
.wm-rot-input:focus { border-color: #6c63ff; }

/* ── Compress tool ────────────────────────────────────────────────────────── */
.compress-file-info {
    font-size: 13px;
    color: #555;
    padding: 6px 0 2px;
    word-break: break-all;
}
.compress-level-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.compress-level-card {
    border: 1.5px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s;
    background: #fff;
}
.compress-level-card:hover {
    border-color: #6c63ff;
}
.compress-level-card.active {
    border-color: #6c63ff;
    background: #f0eeff;
}
.compress-level-name {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
}
.compress-level-desc {
    font-size: 11px;
    color: #777;
    margin-top: 2px;
}
.compress-badge {
    font-size: 10px;
    font-weight: 600;
    color: #6c63ff;
    background: #e8e6ff;
    padding: 1px 7px;
    border-radius: 20px;
    letter-spacing: 0.02em;
}
.compress-result-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 10px;
    font-size: 13px;
    color: #166534;
}
.compress-result-banner i {
    color: #16a34a;
    font-size: 15px;
    flex-shrink: 0;
}

/* ── Lock / Unlock tools ──────────────────────────────────────────────────── */
.lock-field-group {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}
.lock-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.lock-input {
    width: 100%;
    padding: 9px 40px 9px 12px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.14s;
}
.lock-input:focus {
    border-color: #6c63ff;
}
.lock-eye-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 14px;
    padding: 4px;
    transition: color 0.14s;
}
.lock-eye-btn:hover {
    color: #6c63ff;
}
.lock-hint {
    font-size: 12px;
    color: #999;
    margin: 6px 0 0;
    line-height: 1.5;
}
.lock-error {
    margin-top: 12px;
    padding: 9px 14px;
    background: #fff5f5;
    border: 1.5px solid #fca5a5;
    border-radius: 10px;
    font-size: 13px;
    color: #b91c1c;
}

/* Locked PDF placeholder (unlock tool) */
.locked-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #f8f8fb;
    border-radius: 8px;
    color: #888;
}
.locked-placeholder i {
    font-size: 48px;
    color: #c4b5fd;
}
.locked-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* ── Stamp tool ───────────────────────────────────────────────────────────── */
.stamp-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}
.stamp-preset-card {
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    padding: 10px 6px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.14s, background 0.14s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
}
.stamp-preset-card:hover  { border-color: #a5b4fc; }
.stamp-preset-card.active { border-color: #6c63ff; background: #f0eeff; }

/* ── Stamp SVG preset visuals ── */
.stamp-preset-card svg {
    display:    block;
    max-width:  100%;
    height:     auto;
    overflow:   visible;
}

/* =========================
   MOBILE NAV TOGGLE
========================= */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 6px;
    margin-left: auto;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: 0.2s;
}
.mobile-nav {
    display: none;
    background: #fff;
    border-bottom: 2px solid #ff6a00;
    padding: 8px 0;
    flex-direction: column;
}
.mobile-nav a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-bottom: 1px solid #f4f4f4;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mobile-nav a i { color: #ff6a00; width: 16px; }
.mobile-nav a:hover { background: #fff8f4; }
.mobile-nav.open { display: flex; }

/* =========================
   RESPONSIVE — 900px
========================= */
@media (max-width: 900px) {
    .main-layout .sidebar { display: none; }
}

/* =========================
   RESPONSIVE — 768px
========================= */
@media (max-width: 768px) {

    /* Header */
    .header { padding: 12px 16px; }
    .nav { display: none; }
    .hamburger { display: flex; }
    .logo-row { font-size: 17px; }
    .logo-icon { width: 30px; height: 30px; }
    .tagline { font-size: 10px; }

    /* Home layout */
    .main-layout { flex-direction: column; padding: 0 0 16px; gap: 0; }
    .main-layout .sidebar { display: none; }
    .container { padding: 12px; margin: 10px auto; }
    .grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
    .tile { padding: 12px 8px; }
    .tile h3 { font-size: 12px; margin: 6px 0; }
    .tile p { font-size: 10px; }
    .icon { font-size: 26px; margin-bottom: 8px; }

    /* Trust section */
    .trust-section { padding: 40px 14px; }
    .trust-title { font-size: 1.5rem; }
    .trust-grid { grid-template-columns: 1fr; }

    /* Footer */
    .site-footer { padding: 36px 20px 20px; }
    .site-footer-grid { flex-direction: column; gap: 28px; }

    /* Tool hero */
    .tool-hero { margin-top: 40px; padding: 0 16px; }
    .tool-hero h1 { font-size: 22px; }
    .tool-subtitle { font-size: 14px; margin: 12px 0 28px; }
    .upload-btn { padding: 14px 28px; font-size: 15px; width: 100%; box-sizing: border-box; }
    .drop-text { font-size: 13px; }

    /* Workspace — stack vertically on mobile */
    .workspace {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .workspace-left {
        flex: none;
        height: 320px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .workspace-right {
        flex: none;
        height: auto;
        border-left: none;
        border-top: 1px solid #eee;
        overflow: visible;
    }
    .right-panel-scroll {
        overflow-y: visible;
        max-height: none;
        padding: 16px 16px 0;
    }
    .edit-save-btn {
        margin: 10px 16px 14px;
        width: calc(100% - 32px);
    }
    .edit-page-nav-bar { gap: 6px; padding: 6px 10px; }
    .edit-nav-btn { width: 28px; height: 28px; font-size: 11px; }

    /* Rearrange grid */
    .rearrange-grid { grid-template-columns: repeat(2, 1fr) !important; }

    /* Anchor ad */
    #anchorAd ins { width: 320px !important; height: 50px !important; }
}

/* =========================
   RESPONSIVE — 480px
========================= */
@media (max-width: 480px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
    .trust-item { flex-direction: column; gap: 10px; }
    .trust-section { padding: 32px 12px; }
    .trust-title { font-size: 1.3rem; }
    .workspace-left { height: 260px; }
    .site-footer { padding: 28px 14px 16px; }
}
