/* ============================================================
   PDF Editor – style.css
   H BOOKHOUSE | hbookhouse.com/pdfeditor
   Design: Dark Gold theme matching main site
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-base:          #f7f9ff;
    --bg-surface:       #ffffff;
    --bg-card:          #ffffff;
    --bg-toolbar:       #f8f9fa;
    --text-primary:     #181c20;
    --text-secondary:   #584140;
    --text-dim:         #868e96;
    --accent-gold:      #ae2f34; /* Reusing var name but setting to Coral */
    --accent-gold-glow: rgba(174, 47, 52, 0.25);
    --accent-gold-dim:  rgba(174, 47, 52, 0.12);
    --accent-blue:      #0062a1;
    --accent-green:     #22c55e;
    --accent-red:       #ef4444;
    --accent-yellow:    rgba(255, 235, 59, 0.5);
    --glass-border:     #e9ecef;
    --toolbar-height:   60px;
    --header-height:    64px;
    --radius-lg:        16px;
    --radius-md:        10px;
    --radius-sm:        6px;
    --shadow-gold:      0 8px 32px rgba(174, 47, 52, 0.2);
    --shadow-dark:      0 4px 20px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================================
   Lang Toggle Bar
   ============================================================ */
#lang-toggle-bar {
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 2000;
}
#lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--accent-gold);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s;
}
#lang-btn:hover {
    background: var(--accent-gold-dim);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-gold);
}

/* ============================================================
   Header
   ============================================================ */
.pe-header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 20px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.pe-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}
.pe-logo span { color: var(--accent-gold); }

.pe-header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    cursor: pointer;
}
button.pe-header-center {
    background: transparent;
    border: none;
    font: inherit;
    text-align: left;
}
.pe-header-center:hover {
    background: rgba(212, 175, 55, 0.07);
}
.pe-header-center:hover .pe-title {
    -webkit-text-fill-color: var(--accent-gold);
}
.pe-header-center:hover .pe-logo-icon {
    filter: drop-shadow(0 0 12px var(--accent-gold));
}

.pe-logo-icon {
    font-size: 24px;
    color: var(--accent-gold);
    filter: drop-shadow(0 0 8px var(--accent-gold-glow));
}
.pe-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.pe-badge {
    background: var(--accent-gold-dim);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}

.pe-header-nav {
    display: flex;
    gap: 24px;
    align-items: center;
    padding-right: 90px; /* space for lang button */
}
.pe-nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.3s;
    letter-spacing: 0.5px;
}
.pe-nav-link:hover { color: var(--accent-gold); }

/* ============================================================
   Main Layout
   ============================================================ */
#app-main {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ============================================================
   Upload Section
   ============================================================ */
#upload-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.upload-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#drop-zone {
    border: 2px dashed rgba(212, 175, 55, 0.35);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: var(--bg-card);
    position: relative;
    overflow: hidden;
}
#drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    pointer-events: none;
}
#drop-zone:hover, #drop-zone.drag-over {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.05);
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
}

.drop-icon-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
}
.drop-icon {
    font-size: 64px;
    color: var(--accent-gold);
    position: relative;
    z-index: 1;
    animation: pulse-icon 3s infinite ease-in-out;
}
@keyframes pulse-icon {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4)); }
    50% { filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8)); }
}
.drop-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.2);
    animation: ring-pulse 3s infinite ease-out;
}
@keyframes ring-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

#drop-zone h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
#drop-zone p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 30px;
}

.drop-features {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}
.drop-features span {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.drop-features span i { color: var(--accent-gold); font-size: 14px; }

/* ============================================================
   How It Works
   ============================================================ */
.how-it-works {
    padding: 50px 0 20px;
    text-align: center;
}
.hiw-title {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hiw-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.hiw-step {
    flex: 1;
    min-width: 180px;
    max-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    position: relative;
    transition: all 0.3s;
}
.hiw-step:hover {
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-6px);
    box-shadow: var(--shadow-gold);
}
.hiw-num {
    position: absolute;
    top: -12px; left: 20px;
    background: linear-gradient(135deg, var(--accent-gold), #aa8c2c);
    color: #000;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 1px;
}
.hiw-icon {
    font-size: 32px;
    color: var(--accent-gold);
    margin-bottom: 14px;
    display: block;
}
.hiw-step h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}
.hiw-step p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.hiw-arrow {
    color: rgba(212, 175, 55, 0.4);
    font-size: 20px;
    flex-shrink: 0;
}

/* ============================================================
   Editor Section
   ============================================================ */
#editor-section {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
}

/* ============================================================
   Editor Toolbar
   ============================================================ */
#editor-toolbar {
    position: sticky;
    top: var(--header-height);
    z-index: 900;
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    background: var(--bg-toolbar);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
}
.toolbar-left  { display: flex; align-items: center; gap: 6px; flex: 1; }
.toolbar-center { flex: 1; display: flex; justify-content: center; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }

.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tb-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.tb-btn.active { background: var(--accent-gold-dim); color: var(--accent-gold); border-color: rgba(212,175,55,0.3); }

.tb-btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #aa8c2c 100%);
    color: #000 !important;
    border-color: transparent !important;
    font-weight: 700;
}
.tb-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px var(--accent-gold-glow); }

.tb-btn-edit {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa !important;
    border: 1px solid rgba(37, 99, 235, 0.3) !important;
    font-weight: 700;
}
.tb-btn-edit:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: rgba(37, 99, 235, 0.6) !important;
}
.tb-btn-edit.active {
    background: rgba(37, 99, 235, 0.3);
    color: #93c5fd !important;
    border-color: rgba(37, 99, 235, 0.7) !important;
}

.tb-btn-ghost { border-color: var(--glass-border); }
.tb-btn-ghost:hover { border-color: rgba(255,255,255,0.15); }

.tb-btn-save {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff !important;
    border-color: transparent !important;
    font-weight: 700;
}
.tb-btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(34,197,94,0.3); }

.tb-divider {
    width: 1px;
    height: 28px;
    background: var(--glass-border);
    margin: 0 4px;
}

.file-name-display {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
}
#zoom-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 42px;
    text-align: center;
}
.zoom-controls .tb-btn { padding: 4px 8px; border: none; }

/* ============================================================
   Text Style Bar
   ============================================================ */
#text-style-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(212, 175, 55, 0.05);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
#text-style-bar label { white-space: nowrap; }
#font-size-select, #text-color-pick {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
}
#text-color-pick { width: 40px; height: 32px; padding: 2px; }

/* ============================================================
   PDF Canvas Area
   ============================================================ */
#pdf-canvas-wrapper {
    display: flex;
    flex: 1;
    gap: 0;
    overflow: auto;
    background: #e9ecef;
}

#pdf-canvas-area {
    flex: 1;
    overflow: auto;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Page Container */
#page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pdf-page-wrapper {
    position: relative;
    display: inline-block;
    box-shadow: 0 8px 40px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: visible;
    cursor: crosshair;
    transition: box-shadow 0.3s;
}
.pdf-page-wrapper:hover {
    box-shadow: 0 12px 50px rgba(0,0,0,0.9), 0 0 0 1px rgba(212,175,55,0.1);
}

.pdf-page-wrapper canvas {
    display: block;
    border-radius: 4px;
}

/* Annotation overlay positioned on top of canvas */
.page-annotation-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

/* Individual annotation elements */
.annotation-box {
    position: absolute;
    pointer-events: all;
    cursor: move;
    user-select: none;
    transition: box-shadow 0.15s;
}
.annotation-box:hover { box-shadow: 0 0 0 2px rgba(212,175,55,0.6) !important; }
.annotation-box.selected { box-shadow: 0 0 0 2px var(--accent-gold) !important; }

.annotation-text {
    font-family: 'Arial', sans-serif;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 2px 4px;
    min-width: 20px;
    min-height: 20px;
    outline: none;
}

.annotation-delete-btn {
    position: absolute;
    top: -20px;
    right: 0px;
    width: 20px;
    height: 20px;
    background: var(--accent-red);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}
.annotation-box:hover .annotation-delete-btn,
.annotation-box.selected .annotation-delete-btn {
    display: flex;
}

/* Whiteout block */
.annotation-whiteout {
    background: #ffffff;
    cursor: nwse-resize;
    min-width: 20px;
    min-height: 10px;
    border: 1px dashed rgba(0,0,0,0.2);
}

/* Highlight block */
.annotation-highlight {
    background: rgba(255, 235, 59, 0.5);
    cursor: move;
    min-width: 20px;
    min-height: 10px;
    mix-blend-mode: multiply;
    pointer-events: all;
}

/* ============================================================
   Page Navigation
   ============================================================ */
#page-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    padding: 16px;
    background: var(--bg-toolbar);
    border-top: 1px solid var(--glass-border);
    position: sticky;
    bottom: 0;
    z-index: 500;
}
#page-info {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
    text-align: center;
}

/* ============================================================
   Ad Slots
   ============================================================ */
.ad-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ad-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.ad-placeholder {
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
}
.ad-slot-top {
    width: 100%;
    padding: 0;
}
.ad-slot-top .ad-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 0 auto;
}
.ad-slot-side {
    width: 160px;
    flex-shrink: 0;
    padding: 30px 10px;
}
.ad-placeholder-side {
    width: 160px;
    height: 600px;
    position: sticky;
    top: calc(var(--header-height) + var(--toolbar-height) + 30px);
}
.ad-slot-bottom {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}
.ad-slot-bottom .ad-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 0 auto;
}

/* ============================================================
   Toast Notification
   ============================================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 18, 25, 0.95);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 9000;
    backdrop-filter: blur(20px);
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: rgba(34, 197, 94, 0.5); color: #4ade80; }
.toast.error   { border-color: rgba(239, 68, 68, 0.5); color: #f87171; }
.toast.info    { border-color: var(--accent-gold-glow); color: var(--accent-gold); }

/* ============================================================
   Loading Overlay
   ============================================================ */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 7, 10, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px 60px;
}
.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

/* ============================================================
   Text Popup
   ============================================================ */
#text-popup {
    position: fixed;
    inset: 0;
    background: rgba(7, 7, 10, 0.7);
    backdrop-filter: blur(10px);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.text-popup-inner {
    background: rgba(15, 15, 22, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    overflow: hidden;
}
.text-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
}
.text-popup-header button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.2s;
}
.text-popup-header button:hover { color: var(--accent-red); }
#text-popup-input {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: none;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    padding: 20px;
    resize: none;
    outline: none;
    line-height: 1.6;
}
#text-popup-input:focus { background: rgba(255,255,255,0.05); }
.text-popup-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 20px;
}

/* ============================================================
   Footer
   ============================================================ */
.pe-footer {
    background: rgba(7, 7, 10, 0.95);
    border-top: 1px solid var(--glass-border);
    padding: 40px 24px;
}
.pe-footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}
.pe-footer-brand p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}
.pe-footer-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
}
.pe-footer-logo span { color: var(--accent-gold); }
.pe-footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}
.pe-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
}
.pe-footer-links a:hover { color: var(--accent-gold); }
.pe-footer-copy {
    color: var(--text-dim);
    font-size: 12px;
}

/* ============================================================
   Mode Cursors
   ============================================================ */
.pdf-page-wrapper.mode-text      { cursor: text; }
.pdf-page-wrapper.mode-highlight  { cursor: crosshair; }
.pdf-page-wrapper.mode-whiteout   { cursor: cell; }
.pdf-page-wrapper.mode-edittext   { cursor: default; }

/* ============================================================
   Text Edit Layer
   ============================================================ */
.text-edit-layer {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;   /* off by default; enabled per-item */
    z-index: 15;
    display: none;
}
.text-edit-item {
    position: absolute;
    pointer-events: all;
    cursor: text;
    border-radius: 2px;
    border: 1px dashed rgba(100, 100, 100, 0.6);
    transition: background 0.15s, outline 0.15s, border-color 0.15s;
    box-sizing: border-box;
}
.text-edit-item:hover {
    background: rgba(37, 99, 235, 0.18);
    border-color: transparent;
    outline: 1px solid rgba(96, 165, 250, 0.9);
    outline-offset: 1px;
}

/* ============================================================
   Inline Text Editor (appears directly over PDF text)
   ============================================================ */
.inline-editor-wrap {
    position: absolute;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: all;
    filter: drop-shadow(0 4px 16px rgba(37, 99, 235, 0.5));
}
.inline-text-editor {
    display: block;
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid #3b82f6;
    border-radius: 3px 3px 0 0;
    color: #000000;
    padding: 1px 4px;
    outline: none;
    box-sizing: border-box;
    white-space: nowrap;
    line-height: 1.3;
    /* width set by JS, do NOT use width:100% */
    min-width: 60px;
    max-width: 400px;
    letter-spacing: 0.01em;
}
.inline-text-editor:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.25);
}
/* Mini action bar */
.inline-editor-bar {
    display: flex;
    gap: 2px;
    background: #1e3a8a;
    border: 2px solid #3b82f6;
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 3px 4px;
    /* bar matches the input width, not full page width */
    box-sizing: border-box;
    width: 100%;
    max-width: 400px;
}
.inline-editor-bar button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}
.inline-editor-bar button:active { transform: scale(0.95); }
.ieb-apply  { background: #22c55e; color: #fff; flex: 1; justify-content: center; }
.ieb-apply:hover  { background: #16a34a; }
.ieb-delete { background: rgba(239,68,68,0.85); color: #fff; }
.ieb-delete:hover { background: #dc2626; }
.ieb-cancel { background: rgba(255,255,255,0.15); color: #fff; }
.ieb-cancel:hover { background: rgba(255,255,255,0.25); }

/* Edit popup – original text display */
.edit-original-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 20px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--glass-border);
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.edit-original-value {
    color: var(--text-primary);
    font-style: italic;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

/* ============================================================
   Acrobat Annotation Overlays
   ============================================================ */
.acrobat-annot {
    position: absolute;
    z-index: 10;
    cursor: pointer;
    transition: box-shadow 0.15s, outline 0.15s;
    box-sizing: border-box;
}
.acrobat-annot:hover {
    outline: 2px solid rgba(212, 175, 55, 0.7);
    outline-offset: 1px;
    z-index: 20;
}

/* Delete button – only visible on hover */
.acrobat-delete-btn {
    position: absolute;
    top: -11px;
    right: -11px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: #fff;
    border: 2px solid rgba(15,15,20,0.8);
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}
.acrobat-delete-btn:hover {
    background: #b91c1c;
    transform: scale(1.15);
}
.acrobat-annot:hover .acrobat-delete-btn {
    display: flex;
}

/* Popup tooltip for sticky notes / text annotations */
.acrobat-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    max-width: 320px;
    background: rgba(15, 15, 22, 0.97);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
}
.acrobat-annot:hover .acrobat-popup {
    display: block;
}
.acrobat-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(212, 175, 55, 0.08);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    gap: 10px;
}
.acrobat-popup-type {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}
.acrobat-popup-author {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.acrobat-popup-body {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 160px;
    overflow-y: auto;
}
.acrobat-popup-body::-webkit-scrollbar { width: 4px; }
.acrobat-popup-body::-webkit-scrollbar-track { background: transparent; }
.acrobat-popup-body::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.3); border-radius: 2px; }

/* Annotation info bar that appears at the top of editor (count badge) */
.annot-count-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: rgba(212, 175, 55, 0.05);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}
.annot-count-badge {
    background: var(--accent-gold-dim);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
}
.annot-count-bar i {
    color: var(--accent-gold);
    font-size: 13px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .pe-header-center { position: static; transform: none; }
    .pe-logo { display: none; }
    .pe-header-nav { display: none; }
    .pe-header { justify-content: center; }
    #lang-toggle-bar { top: 14px; right: 10px; }
    .ad-slot-side, .ad-slot-side-right { display: none; }
    .hiw-arrow { display: none; }
    .hiw-steps { flex-direction: column; align-items: center; }
    #editor-toolbar .tb-btn span { display: none; }
    .file-name-display { display: none; }
}
@media (max-width: 600px) {
    #drop-zone { padding: 40px 20px; }
    #drop-zone h2 { font-size: 20px; }
    .drop-features { gap: 12px; }
    #editor-toolbar { gap: 4px; padding: 0 8px; }
}

/* ============================================================
   Resize Handles
   ============================================================ */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    z-index: 20;
    pointer-events: all;
    display: none;
    box-sizing: border-box;
}
.annotation-box:hover .resize-handle,
.annotation-box.selected .resize-handle,
.text-edit-item:hover .resize-handle,
.text-edit-item[data-was-dragged="true"] .resize-handle {
    display: block;
}
.resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
