:root {
    --primary-grad: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    --primary-solid: #0284c7;
    --secondary-bg: #f8fafc;
    --text-main: #0f172a; 
    --text-muted: #475569; 
    --bg-color: #0c1e3b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    min-height: 100vh;
    color: var(--text-main);
    display: flex; flex-direction: column;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hidden-input, .hidden-element { display: none !important; }

/* GLOBAL LOADING SPINNER */
#globalSpinner {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(8px);
    z-index: 20000; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: white; font-weight: 700; gap: 15px; transition: opacity 0.2s ease;
}
#globalSpinner.hidden-spinner { opacity: 0; pointer-events: none; }
.spinner-core { width: 50px; height: 50px; border: 5px solid rgba(255,255,255,0.2); border-radius: 50%; border-top-color: #0ea5e9; animation: spinAxis 0.8s infinite linear; }
@keyframes spinAxis { to { transform: rotate(360deg); } }

/* SITE BANNER NAVIGATION */
.navbar { background: white; padding: 14px 24px; border-bottom: 1px solid #e2e8f0; }
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; text-decoration: none; display: flex; align-items: center; gap: 8px; background: var(--primary-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.pro-badge { font-size: 0.6rem; background: #0f172a; color: #fff; padding: 3px 8px; border-radius: 50px; font-weight: 800; -webkit-text-fill-color: initial; }

.page-content-wrapper { background: transparent; min-height: 100vh; width: 100%; display: flex; flex-direction: column; flex: 1; }

/* HERO SECTIONS AREA MAP */
.hero { padding: 120px 24px 60px; text-align: center; }
.hero h1 { font-size: 3.5rem; font-weight: 800; margin-bottom: 16px; color: white; }
.hero p { color: #cbd5e1; font-size: 1.3rem; margin-bottom: 40px; }
.upload-box { border: 3px dashed #38bdf8; background: rgba(255,255,255,0.03); border-radius: 24px; padding: 80px 40px; text-align: center; cursor: pointer; max-width: 750px; margin: 0 auto; backdrop-filter: blur(10px); }
.upload-icon-wrapper i { font-size: 3.5rem; color: #38bdf8; margin-bottom: 16px; }
.upload-box h3 { color: white; font-size: 1.5rem; margin-bottom: 8px; }
.upload-subtext { color: #94a3b8; }
.btn-grad-landing { background: var(--primary-grad); color: white; border: none; padding: 14px 36px; border-radius: 50px; font-weight: 700; cursor: pointer; margin-top: 24px; font-size: 1rem; }

/* THE NATIVE SAVE PDF PILL PATTERN */
.btn-grad { 
    background: #22c55e; color: white; border: none; padding: 10px 24px; 
    border-radius: 50px; font-weight: 700; cursor: pointer; display: inline-flex; 
    align-items: center; gap: 8px; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); width: auto; height: auto;
}
.btn-grad:hover { background: #16a34a; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35); }

/* SEJDA WRAPPING PANEL NAVBAR SYSTEM */
.master-top-bar { background: #0c1e3b; padding: 12px 24px; border-bottom: 1px solid #020617; display: flex; justify-content: center; align-items: center; position: relative; min-height: 64px; width: 100%; }
.se-toolbar-container { display: flex; gap: 8px; flex-wrap: wrap; background: transparent; padding: 0; border: none; align-items: center; }

/* UNIFIED TOP BUTTONS */
.pro-tool-btn { 
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2); 
    padding: 10px 20px; font-size: 0.9rem; font-weight: 600; color: white; cursor: pointer; 
    border-radius: 50px; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s ease; width: auto; height: auto;
}
.pro-tool-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.5); transform: translateY(-1px); }
.pro-tool-btn.active { background: white; color: #0c1e3b; border-color: white; font-weight: 700; box-shadow: 0 4px 14px rgba(255,255,255,0.25); }
.btn-undo-override { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }

.save-pdf-button { position: absolute; right: 24px; }

/* CONTAINED DROPDOWN PANEL OVERLAYS */
.dropdown-wrapper { position: relative; display: inline-block; }
.dropdown-panel { 
    display: none; position: absolute; top: 100%; left: 0; margin-top: 8px;
    background: #0f172a; border: 1px solid #1e293b; min-width: 240px; 
    border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); padding: 8px 0; z-index: 9999;
}
.dropdown-wrapper:hover .dropdown-panel { display: block; }
.dropdown-section-title { font-size: 0.7rem; font-weight: 800; color: #64748b; padding: 6px 14px; background: #020617; }
.dropdown-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 0.85rem; font-weight: 600; color: #cbd5e1; cursor: pointer; text-align: left; }
.dropdown-row:hover { background: #1e293b; color: #0ea5e9; }

/* TRACK CONTROLS BAR */
.page-action-divider-bar { display: flex; align-items: center; justify-content: center; gap: 16px; background: #f1f5f9; padding: 10px 24px; border-bottom: 1px solid #cbd5e1; width: 100%; }
.page-number-indicator { font-size: 1.6rem; font-weight: 700; color: #2563eb; margin-right: 4px; }
.page-action-group { display: flex; gap: 8px; }

.pro-action-btn { background: white; border: 1px solid #cbd5e1; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: #475569; cursor: pointer; font-size: 0.95rem; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.05); transition: all 0.2s ease; }
.pro-action-btn:hover { background: #f8fafc; border-color: #94a3b8; transform: translateY(-1px); }
.pro-action-btn.delete-btn { color: #ef4444; border-color: #fca5a5; background: #fff5f5; }

.insert-page-pill-btn { background: white; border: 1px solid #cbd5e1; padding: 10px 20px; border-radius: 50px; font-size: 0.85rem; font-weight: 700; color: #334155; cursor: pointer; display: flex; align-items: center; gap: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }

/* CANVAS VIEWPORTS */
.editor-container { display: flex; flex-direction: column; height: 100vh; background: #cbd5e1; width: 100%; }
.canvas-area { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 32px; width: 100%; }
.workspace-scroll-scaffolding { display: flex; flex-direction: column; align-items: center; gap: 24px; }

#canvasWrapper { position: relative; transform-origin: top center; background: white; box-shadow: 0 15px 40px rgba(15, 23, 42, 0.15); border-radius: 4px; }
#pdfCanvas { display: block; border-radius: 4px; }
#textLayer { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: auto; }

/* BOTTOM TRIGGER PILL BAR */
.editor-bottom-upload-trigger {
    background: white; border: 2px dashed #94a3b8; padding: 16px 32px;
    border-radius: 12px; font-weight: 700; color: #475569; font-size: 0.95rem;
    cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02); margin-bottom: 20px;
}
.editor-bottom-upload-trigger:hover {
    background: #f0f9ff; border-color: #0ea5e9; color: #0ea5e9;
    transform: translateY(-1px); box-shadow: 0 6px 14px rgba(14,165,233,0.1);
}

.floating-context-menu { position: fixed; display: flex; align-items: center; gap: 4px; background: #ffffff; border: 1px solid #94a3b8; border-radius: 50px; padding: 4px 8px; box-shadow: 0 10px 30px -5px rgba(0,0,0,0.2); z-index: 9999; pointer-events: auto; width: auto; height: auto; }
.menu-btn { background: transparent; border: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #334155; cursor: pointer; font-size: 0.9rem; aspect-ratio: 1/1; }
.menu-btn:hover { background: #f1f5f9; color: black; }
.menu-divider { width: 1px; height: 20px; background: #cbd5e1; margin: 0 6px; }
.context-select { border: 1px solid #cbd5e1; padding: 4px 10px; border-radius: 50px; outline: none; font-size: 0.85rem; font-weight: 700; cursor: pointer; height: 34px; background: white; width: auto; }

/* TEXT TRACK SELECTIONS BOXES RULES (Sejda Matches) */
.text-wrapper { position: absolute; pointer-events: auto; border: 1px solid transparent; padding: 1px 2px; cursor: text; display: inline-block; mix-blend-mode: multiply; }
.text-wrapper:hover { border: 1px dashed #2563eb; background: rgba(37, 99, 235, 0.08); }
.text-wrapper.selected-element, .text-wrapper:focus-within { border: 1px solid #2563eb; background: rgba(37, 99, 235, 0.15) !important; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); border-radius: 2px; }
.text-content { white-space: pre-wrap; outline: none; background: transparent; line-height: 1.25; min-width: 10px; min-height: 15px; color: #000; font-family: Arial, sans-serif; }
.text-content.is-bold { font-weight: bold; }
.text-content.is-italic { font-style: italic; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 30000; }
.modal-card { background: white; padding: 24px; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); width: 500px; text-align: center; }
#signatureCanvas { background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 6px; cursor: crosshair; display: block; margin: 0 auto 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-btn { padding: 8px 16px; border: none; border-radius: 6px; font-weight: 700; cursor: pointer; }
.modal-btn.primary { background: #0ea5e9; color: white; }
.modal-btn.secondary { background: #e2e8f0; color: #334155; }

.injected-vector-shape-node { position: absolute; box-sizing: border-box; pointer-events: auto; cursor: move; }
.shape-rect-core { border: 2px solid #0ea5e9; background: rgba(14, 165, 233, 0.1); width: 100%; height: 100%; }
.shape-circle-core { border: 2px solid #0ea5e9; background: rgba(14, 165, 233, 0.1); width: 100%; height: 100%; border-radius: 50%; }

.pdf-hyperlink-overlay { position: absolute; border: 1px dashed #2563eb; background: rgba(37, 99, 235, 0.1); cursor: pointer; z-index: 10; }
.pdf-whiteout-overlay { position: absolute; background: white; border: 1px dotted #a1a1aa; cursor: move; z-index: 9; }
.pdf-image-stamp-wrapper { position: absolute; cursor: move; z-index: 11; }
.pdf-image-stamp-wrapper img { width: 100%; height: 100%; display: block; pointer-events: none; }

.navigation-footer-toolbar { background: white; border-top: 1px solid #cbd5e1; display: flex; justify-content: center; gap: 20px; padding: 6px; height: 44px; width: 100%; }
.icon-btn { background: #f1f5f9; border: 1px solid #cbd5e1; width: 32px; height: 32px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #475569; }
.page-count-display { font-weight: 700; color: #475569; font-size: 0.9rem; display: flex; align-items: center; }