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

:root {
    --primary: #dc2626;         /* PDF Red theme */
    --primary-hover: #b91c1c;
    --primary-light: #fef2f2;
    --secondary: #4f46e5;
    --accent: #0ea5e9;
    --success: #16a34a;
    --success-hover: #15803d;
    --warning: #f59e0b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Header */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.brand-icon {
    font-size: 1.8rem;
    background: var(--primary-light);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-info h1 {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1e293b;
}

.brand-badge {
    background: var(--primary);
    color: #ffffff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

.brand-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.header-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link-btn:hover {
    background: #e2e8f0;
    color: var(--primary);
}

.nav-link-btn.primary {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.nav-link-btn.primary:hover {
    background: var(--primary-hover);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
    flex: 1;
}

/* Hero Title */
.suite-hero {
    text-align: center;
    margin-bottom: 2.25rem;
}

.suite-hero h2 {
    font-size: 2.1rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.suite-hero p {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 720px;
    margin: 0 auto;
}

/* Search & Category Filter Toolbar */
.toolbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-box-wrapper {
    position: relative;
    flex: 1;
    min-width: 280px;
    max-width: 440px;
}

/* Recently Used Tools Bar */
.recent-tools-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 0.84rem;
    flex-wrap: wrap;
}

.recent-label {
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.recent-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.recent-pill:hover {
    border-color: #3b82f6;
    color: #2563eb;
    background: #eff6ff;
}

/* View Mode Toggles */
.view-mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
}

.view-btn {
    padding: 0.45rem 0.85rem;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--text-main);
}

.view-btn.active {
    background: #2563eb;
    color: #ffffff;
}

/* Categorized View Section */
.category-section-block {
    margin-bottom: 2rem;
}

.category-section-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #e2e8f0;
}

.search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 30px;
    font-size: 0.92rem;
    background: #ffffff;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-muted);
}

.category-pills {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.category-pill {
    padding: 0.45rem 0.95rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.category-pill:hover {
    border-color: #3b82f6;
    color: #1e293b;
}

.category-pill.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* Tools Selector Grid - Compact Cards Style */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 1300px) {
    .tools-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 680px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tool-card {
    background: #f8fbff;
    border: 1.5px solid #cce3fc;
    border-radius: 12px;
    padding: 1rem 0.6rem 0.85rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    position: relative;
    min-height: 112px;
    user-select: none;
}

.tool-card:hover {
    border-color: #3b82f6;
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.tool-card.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px #2563eb;
}

.star-favorite {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 1rem;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.star-favorite:hover, .star-favorite.starred {
    color: #f59e0b;
    transform: scale(1.15);
}

.tool-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: transparent;
    transition: transform 0.2s;
}

.tool-card:hover .tool-icon-wrapper {
    transform: scale(1.1);
}

.tool-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.25;
}

.tool-desc {
    display: none;
}

/* Active Tool Workspace */
.workspace-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.workspace-title-area {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.workspace-title-icon {
    font-size: 2rem;
}

.workspace-title-text h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
}

.workspace-title-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dropzone */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: #fdfdfd;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 1.5rem;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: #fff5f5;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.dropzone-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.3rem;
}

.dropzone-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* Options Bar */
.tool-options-panel {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.option-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
}

.option-group select, .option-group input[type="text"] {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    background: #ffffff;
    outline: none;
}

.option-group select:focus, .option-group input[type="text"]:focus {
    border-color: var(--primary);
}

/* File Queue Table */
.file-queue {
    margin-bottom: 1.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.file-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}

.file-item-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Action Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background: var(--success-hover);
}

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
}

.btn-danger-sm {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.78rem;
    cursor: pointer;
}

/* Progress & Result Screen */
.progress-container {
    display: none;
    margin: 1.5rem 0;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    border-radius: 5px;
    transition: width 0.3s;
}

.result-card {
    display: none;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 1.75rem;
    text-align: center;
    margin-top: 1.5rem;
}

.result-icon {
    font-size: 2.75rem;
    margin-bottom: 0.5rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #15803d;
    margin-bottom: 0.25rem;
}

.result-desc {
    font-size: 0.9rem;
    color: #166534;
    margin-bottom: 1.25rem;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

/* Footer */
.app-footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
}

.footer-features {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* =========================================================
   PDF Interactive Visual Editor
   ========================================================= */

.pdf-editor-container {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-top: 1.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Sticky Editor Toolbar */
.editor-toolbar {
    background: #1e293b;
    color: #ffffff;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    border-bottom: 2px solid #0f172a;
    position: sticky;
    top: 0;
    z-index: 40;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.editor-btn {
    background: #334155;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
    user-select: none;
}

.editor-btn:hover {
    background: #475569;
    border-color: #64748b;
    color: #ffffff;
}

.editor-btn.active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.editor-btn.btn-save-edit {
    background: #16a34a;
    border-color: #22c55e;
    color: #ffffff;
    font-weight: 700;
}

.editor-btn.btn-save-edit:hover {
    background: #15803d;
}

.editor-btn.btn-close-edit {
    background: #dc2626;
    border-color: #ef4444;
}

.editor-btn.btn-close-edit:hover {
    background: #b91c1c;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #475569;
    margin: 0 0.35rem;
}

/* Color & Stroke Controls */
.editor-color-picker {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid #ffffff;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.editor-select {
    background: #334155;
    color: #ffffff;
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.editor-select option {
    background: #1e293b;
    color: #ffffff;
}

/* Page Navigation & Zoom */
.page-nav-badge {
    background: #0f172a;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    white-space: nowrap;
}

.page-nav-btn {
    background: #334155;
    color: #ffffff;
    border: 1px solid #475569;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.15s;
}

.page-nav-btn:hover:not(:disabled) {
    background: #475569;
}

.page-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Editor Canvas Viewport */
.pdf-canvas-viewport {
    background: #475569;
    padding: 2rem 1rem;
    min-height: 600px;
    max-height: 75vh;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.pdf-page-wrapper {
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    background: #ffffff;
    border-radius: 2px;
    user-select: none;
}

#basePdfCanvas {
    display: block;
    max-width: 100%;
}

#annotationCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
}

#interactiveOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

/* Movable & Editable Text Boxes */
.pdf-textbox-item {
    position: absolute;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    border: 1.5px dashed #3b82f6;
    border-radius: 4px;
    padding: 4px 6px;
    min-width: 80px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    flex-direction: column;
    z-index: 25;
}

.pdf-textbox-item:hover, .pdf-textbox-item.active {
    border-style: solid;
    border-color: #2563eb;
}

.textbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    padding: 2px 4px;
    margin: -4px -6px 4px -6px;
    cursor: move;
    font-size: 0.7rem;
    color: #1e40af;
    user-select: none;
}

.textbox-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    resize: none;
    overflow: hidden;
    line-height: 1.3;
    padding: 0;
    margin: 0;
}

.textbox-del-btn {
    border: none;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    padding: 0 2px;
}

.textbox-del-btn:hover {
    color: #b91c1c;
}

/* Stamp / Signature Placed Item */
.pdf-stamp-item {
    position: absolute;
    pointer-events: auto;
    border: 1.5px dashed #10b981;
    border-radius: 4px;
    cursor: move;
    user-select: none;
    z-index: 25;
}

.pdf-stamp-item img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Signature Capture Modal */
.sig-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.sig-modal-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 1.75rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.sig-canvas-box {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    margin: 1rem 0;
    position: relative;
}

#signaturePad {
    display: block;
    width: 100%;
    height: 180px;
    cursor: crosshair;
}

.sig-helper-line {
    position: absolute;
    bottom: 40px;
    left: 20px;
    right: 20px;
    border-bottom: 1px solid #cbd5e1;
    pointer-events: none;
}

.sig-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

