/* ============================================================
 *  PDF Tools — style.css (Design System & Theme Tokens)
 *  Font: Plus Jakarta Sans
 *  Supports: Light Mode & Dark Mode
 * ============================================================ */

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

/* ==================== THEME TOKENS ==================== */
:root {
    /* Base Color Tokens (Light Mode) */
    --bg-body: #f8fafc;
    --bg-mesh-1: rgba(99, 102, 241, 0.08);
    --bg-mesh-2: rgba(168, 85, 247, 0.06);
    --bg-card: #ffffff;
    --bg-card-hover: #fcfdfe;
    --bg-subtle: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);

    --border-subtle: #e2e8f0;
    --border-card: #e2e8f0;
    --border-focus: #6366f1;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --text-inverse: #ffffff;

    /* Primary Brand Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79, 70, 229, 0.18);

    /* Functional Accents */
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 35px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

    /* Navbar */
    --nav-bg: rgba(255, 255, 255, 0.85);
    --nav-border: rgba(226, 232, 240, 0.8);
    --nav-tab-active-bg: #4f46e5;
    --nav-tab-active-text: #ffffff;
}

[data-theme="dark"] {
    /* Base Color Tokens (Dark Mode) */
    --bg-body: #0b0f19;
    --bg-mesh-1: rgba(99, 102, 241, 0.12);
    --bg-mesh-2: rgba(147, 51, 234, 0.08);
    --bg-card: #111827;
    --bg-card-hover: #162032;
    --bg-subtle: #1e293b;
    --bg-glass: rgba(17, 24, 39, 0.85);

    --border-subtle: #1f293d;
    --border-card: #243048;
    --border-focus: #818cf8;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --text-inverse: #ffffff;

    /* Primary Brand Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-glow: rgba(99, 102, 241, 0.3);

    /* Functional Accents */
    --success: #10b981;
    --success-hover: #34d399;
    --success-light: rgba(16, 185, 129, 0.15);
    --danger: #f87171;
    --danger-hover: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(245, 158, 11, 0.15);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 35px -5px rgba(0, 0, 0, 0.6);

    /* Navbar */
    --nav-bg: rgba(11, 15, 25, 0.85);
    --nav-border: rgba(31, 41, 61, 0.8);
    --nav-tab-active-bg: #6366f1;
    --nav-tab-active-text: #ffffff;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 15% 10%, var(--bg-mesh-1) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, var(--bg-mesh-2) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 48px 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* ==================== UNIVERSAL NAVBAR ==================== */
.site-navbar {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nav-border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    border-radius: 10px;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    margin-left: 4px;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    background: var(--nav-tab-active-bg);
    color: var(--nav-tab-active-text);
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Nav Dropdown (All Tools Mega Menu) */
.nav-dropdown {
    position: relative;
    display: inline-flex;
}

.nav-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-dropdown-btn:hover, .nav-dropdown.open .nav-dropdown-btn {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 540px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 1100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    max-height: 85vh;
    overflow-y: auto;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
    animation: menu-pop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menu-pop {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.mega-category-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-subtle);
    margin-bottom: 6px;
    padding-left: 6px;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.15s ease;
}

.mega-menu-item:hover {
    background: var(--bg-subtle);
    transform: translateX(2px);
}

.mega-menu-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.mega-item-icon {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mega-item-text {
    display: flex;
    flex-direction: column;
}

.mega-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.mega-item-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background: var(--border-subtle);
    transform: translateY(-1px);
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-light);
    padding: 6px 10px;
    border-radius: 8px;
}

/* ==================== MAIN CONTAINER ==================== */
.main-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-wrapper > * {
    width: 100%;
}

.container {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 880px;
    box-shadow: var(--shadow-xl);
    transition: background 0.3s ease, border-color 0.3s ease;
    margin: 0 auto;
}

/* ==================== HEADER ==================== */
.header {
    text-align: center;
    margin-bottom: 28px;
}

.header h1 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.header strong {
    color: var(--text-main);
}

/* ==================== UPLOAD AREA ==================== */
.upload-area {
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-subtle);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
    box-shadow: 0 0 20px var(--primary-glow);
}

.upload-icon {
    font-size: 2.6rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.08));
}

.upload-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.upload-sub {
    color: var(--text-subtle);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.upload-formats {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-subtle);
    margin-top: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
    background: var(--border-subtle);
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}
.btn-success:disabled {
    background: var(--border-subtle);
    color: var(--text-subtle);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    font-size: 0.85rem;
    padding: 6px 14px;
}
.btn-danger-outline:hover {
    background: var(--danger-light);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-secondary-sm {
    background: var(--bg-subtle);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    font-size: 0.8rem;
}
.btn-secondary-sm:hover {
    background: var(--border-subtle);
}

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1.05rem;
}

/* ==================== GOOGLE DRIVE BUTTONS ==================== */
.upload-btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn-gdrive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-gdrive:hover {
    background: var(--bg-subtle);
    border-color: var(--border-focus);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-gdrive:active {
    transform: translateY(0);
}

.btn-gdrive svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-gdrive-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.btn-gdrive-save:hover {
    border-color: #4285f4;
    background: rgba(66, 133, 244, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.25);
}

.btn-gdrive-save svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.action-row-split {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-top: 16px;
}

@media (max-width: 640px) {
    .action-row-split {
        grid-template-columns: 1fr;
    }
}

/* ==================== FILE SECTION ==================== */
.file-section {
    margin-top: 28px;
}

.file-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.file-section-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.drag-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ==================== FILE LIST ==================== */
#fileList {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#fileList li {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

#fileList li:hover {
    border-color: var(--border-focus);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

#fileList li.dragging {
    opacity: 0.4;
    border: 2px dashed var(--primary);
}

.drag-handle {
    color: var(--text-subtle);
    font-size: 1.1rem;
    cursor: grab;
    user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.pdf-thumb {
    width: 44px;
    height: 58px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    flex-shrink: 0;
}

.pdf-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

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

.page-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 7px;
    border-radius: 6px;
}

.page-badge-partial {
    color: var(--warning);
    background: var(--warning-light);
}

.page-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}
.page-btn-active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-subtle);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}
.remove-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ==================== PAGE PANEL ==================== */
.page-panel {
    background: var(--bg-subtle) !important;
    border: 1px solid var(--border-subtle) !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
    margin-top: -8px;
    margin-bottom: 4px;
    padding: 12px 16px !important;
}

.page-panel-inner {
    width: 100%;
}

.page-panel-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.page-panel-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.page-panel-hint code {
    background: var(--bg-card);
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--primary);
}

.page-panel-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-card);
    outline: none;
    transition: border-color 0.2s;
}
.page-input:focus { border-color: var(--border-focus); }

.page-status {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 8px;
}

.page-status-warn {
    color: var(--warning);
}

/* ==================== IMAGE GRID GALLERY (IMAGE TO PDF) ==================== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.image-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.image-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

.image-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--primary);
}

.image-badge-num {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    box-shadow: 0 2px 6px var(--primary-glow);
    z-index: 2;
}

.image-card-thumb-wrap {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.03);
    padding: 8px;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .image-card-thumb-wrap {
    background: rgba(0, 0, 0, 0.25);
}

.image-card-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-card-info {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.image-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.image-card-actions {
    display: flex;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.image-btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.image-btn-action:first-child {
    border-right: 1px solid var(--border-subtle);
}

.image-btn-action:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.image-btn-action.delete-action:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* ==================== SETTINGS & OUTPUT ==================== */
.output-section {
    margin-top: 24px;
    padding: 16px 18px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
}

.output-section label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.output-input-row {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-card);
    overflow: hidden;
    transition: border-color 0.2s;
}
.output-input-row:focus-within { border-color: var(--border-focus); }

.output-input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
    background: transparent;
}

.output-ext {
    padding: 10px 14px 10px 0;
    font-size: 0.92rem;
    color: var(--text-subtle);
    font-weight: 700;
    user-select: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.setting-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.setting-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.setting-select:focus { border-color: var(--border-focus); }

/* ==================== ACTION ROW ==================== */
.action-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ==================== PROGRESS & STATUS ==================== */
.progress-bar-track {
    background: var(--bg-subtle);
    border-radius: 99px;
    height: 10px;
    margin-top: 20px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
}

.status-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
}

.status-box.success {
    background: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.status-box.error {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* ==================== FOOTER ==================== */
.footer {
    text-align: center;
    margin-top: 28px;
    font-size: 0.82rem;
    color: var(--text-subtle);
}

/* Utility */
.hidden { display: none !important; }

/* ==================== GDRIVE OVERLAYS & MODALS ==================== */
.gdrive-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.gdrive-loading-box {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 28px 36px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 90%;
    text-align: center;
}

.gdrive-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border-subtle);
    border-top-color: #4285f4;
    border-right-color: #34a853;
    border-bottom-color: #fbbc05;
    border-left-color: #ea4335;
    border-radius: 50%;
    animation: gdrive-spin 0.9s linear infinite;
}

@keyframes gdrive-spin {
    to { transform: rotate(360deg); }
}

.gdrive-loading-box p {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
}

/* GDrive Config Modal */
.gdrive-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.gdrive-modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 20px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
}

.gdrive-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.gdrive-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.gdrive-modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-subtle);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 6px;
    transition: color 0.2s;
}
.gdrive-modal-close:hover { color: var(--danger); }

.gdrive-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gdrive-guide-banner {
    background: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--success);
    line-height: 1.5;
}

.gdrive-guide-banner ol {
    margin-top: 8px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gdrive-guide-banner a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.gdrive-guide-banner code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
}

.gdrive-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gdrive-field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.gdrive-field .req { color: var(--danger); }

.gdrive-field input {
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
    background: var(--bg-subtle);
    outline: none;
    transition: border-color 0.2s;
    font-family: monospace;
}
.gdrive-field input:focus {
    border-color: var(--border-focus);
    background: var(--bg-card);
}

.gdrive-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-subtle);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* GDrive Destination Selection Cards */
.gdrive-dest-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gdrive-dest-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-subtle);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
}

.gdrive-dest-card:hover {
    border-color: #4285f4;
    background: rgba(66, 133, 244, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.18);
}

/* ==================== NEW TOOL UI COMPONENTS ==================== */
/* Mode Selector Cards */
.mode-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.mode-card {
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.mode-card:hover {
    border-color: var(--border-focus);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.mode-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 12px var(--primary-glow);
}

.mode-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-card-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* 3x2 Position Matrix (Page Number & Watermark) */
.position-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    max-width: 240px;
    margin: 8px 0 14px;
}

.pos-btn {
    padding: 10px 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.pos-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pos-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px var(--primary-glow);
}

/* OCR Result Container */
.ocr-result-wrap {
    margin-top: 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px;
}

.ocr-textarea {
    width: 100%;
    height: 220px;
    padding: 12px 14px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    margin-top: 10px;
}
.ocr-textarea:focus { border-color: var(--border-focus); }

/* Document Thumb Grid for Organize & Split */
.doc-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.doc-page-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
}

.doc-page-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doc-page-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 10px var(--primary-glow);
}

.doc-page-thumb-wrap {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.02);
    padding: 6px;
    position: relative;
}

.doc-page-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.doc-page-footer {
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
}

.doc-page-actions {
    display: flex;
    gap: 4px;
}

.doc-mini-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: all 0.15s;
}
.doc-mini-btn:hover { color: var(--primary); background: var(--border-subtle); }
.doc-mini-btn.del-btn:hover { color: var(--danger); background: var(--danger-light); }

/* ==================== TOOLS HUB DASHBOARD ==================== */
.tools-hub-hero {
    text-align: center;
    margin-bottom: 36px;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--primary-light);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.tools-hub-title {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    line-height: 1.25;
}

.tools-hub-title .gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tools-hub-desc {
    color: var(--text-subtle);
    font-size: 1.05rem;
    max-width: 650px;
    margin: 0 auto 26px auto;
    line-height: 1.6;
}

/* Search Bar */
.search-bar-wrap {
    position: relative;
    max-width: 640px;
    width: 100%;
    margin: 0 auto 24px auto;
    display: flex;
    align-items: center;
}

.search-input-field {
    width: 100%;
    padding: 16px 52px 16px 50px;
    border-radius: 18px;
    border: 1.5px solid var(--border-card);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    box-shadow: var(--shadow-md);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-lg);
    background: var(--bg-card);
}

.search-input-field::placeholder {
    color: var(--text-muted);
    font-size: 0.94rem;
}

.search-icon-left {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-key-badge {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    font-family: monospace;
    pointer-events: none;
    line-height: 1;
}

.search-clear-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.search-clear-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

/* Value Props Grid */
.features-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto 48px auto;
}

.value-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px 20px;
    text-align: left;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.value-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.value-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.value-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.value-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Category Sections */
.category-section {
    margin-bottom: 44px;
    scroll-margin-top: 80px;
}

.cat-sec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-subtle);
}

.cat-sec-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-sec-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-sec-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.tag-organize { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.tag-convert  { background: rgba(16, 185, 129, 0.15); color: #059669; }
.tag-edit     { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.tag-security { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

.cat-sec-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
}

/* Quick Action Tags under Search */
.quick-tags-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: -12px;
    margin-bottom: 28px;
}

.quick-tag-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}

.quick-tag-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-subtle);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.quick-tag-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* Sticky Category Filter Tabs */
.category-filter-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 36px;
    position: sticky;
    top: 70px;
    z-index: 50;
    padding: 8px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 30px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-subtle);
    color: var(--text-subtle);
    font-size: 0.86rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-decoration: none;
}

.category-pill:hover {
    border-color: var(--primary);
    color: var(--text-main);
    transform: translateY(-1px);
}

.category-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.category-pill.pill-organize.active { background: #2563eb; border-color: #2563eb; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
.category-pill.pill-convert.active  { background: #059669; border-color: #059669; box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3); }
.category-pill.pill-edit.active     { background: #7c3aed; border-color: #7c3aed; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3); }
.category-pill.pill-security.active { background: #dc2626; border-color: #dc2626; box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3); }

/* Tools Cards Grid */
.tools-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.hub-tool-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    min-height: 180px;
}

.hub-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.09);
}

/* Category Color Coding on Cards */
.card-cat-organize:hover { border-color: #3b82f6; box-shadow: 0 12px 28px rgba(59, 130, 246, 0.18); }
.card-cat-convert:hover  { border-color: #10b981; box-shadow: 0 12px 28px rgba(16, 185, 129, 0.18); }
.card-cat-edit:hover     { border-color: #8b5cf6; box-shadow: 0 12px 28px rgba(139, 92, 246, 0.18); }
.card-cat-security:hover { border-color: #ef4444; box-shadow: 0 12px 28px rgba(239, 68, 68, 0.18); }

.hub-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.hub-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    transition: transform 0.2s ease;
}

.icon-organize { background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.25); color: #2563eb; }
.icon-convert  { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.25); color: #059669; }
.icon-edit     { background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.25); color: #7c3aed; }
.icon-security { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.25); color: #dc2626; }

.hub-tool-card:hover .hub-card-icon {
    transform: scale(1.12) rotate(4deg);
}

.hub-card-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-new { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-pro { background: rgba(99, 102, 241, 0.15); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-ai  { background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(168, 85, 247, 0.2)); color: #d946ef; border: 1px solid rgba(236, 72, 153, 0.3); }

.hub-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.hub-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hub-card-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
}

.card-cat-organize .hub-card-footer { color: #2563eb; }
.card-cat-convert .hub-card-footer  { color: #059669; }
.card-cat-edit .hub-card-footer     { color: #7c3aed; }
.card-cat-security .hub-card-footer { color: #dc2626; }

.hub-card-footer span {
    transition: transform 0.2s;
}

.hub-tool-card:hover .hub-card-footer span {
    transform: translateX(4px);
}

.tools-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

/* Section Divider */
.hub-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 40px 0 28px 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hub-divider::before, .hub-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

/* ==================== RESPONSIVE (MOBILE & TABLET) ==================== */
@media (max-width: 768px) {
    /* Navbar Mobile (Clean 1-Row Header) */
    .site-navbar {
        padding: 0;
    }

    .nav-container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        padding: 8px 12px;
        gap: 6px;
    }

    .nav-brand {
        order: 1;
        font-size: 0.95rem;
        gap: 6px;
        flex-shrink: 0;
    }

    .brand-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        border-radius: 7px;
    }

    .brand-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    .nav-actions {
        order: 2;
        display: flex;
        align-items: center;
        gap: 6px;
        margin-left: auto;
        flex-shrink: 0;
    }

    .security-badge {
        display: none;
    }

    .nav-dropdown-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
        gap: 4px;
        border-radius: 7px;
        white-space: nowrap;
    }

    .theme-toggle-btn {
        padding: 5px 8px;
        font-size: 0.8rem;
        border-radius: 7px;
        white-space: nowrap;
        min-width: 32px;
        justify-content: center;
    }

    .theme-toggle-btn .theme-label {
        display: none; /* Hide text label on mobile, showing only clean moon/sun icon */
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        margin-top: 4px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        padding: 3px;
        gap: 4px;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .nav-dropdown-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .nav-dropdown-menu {
        width: min(calc(100vw - 24px), 360px);
        right: -8px;
        padding: 12px;
        max-height: 75vh;
    }

    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .mega-menu-item {
        padding: 6px 8px;
    }

    /* Main Container Mobile */
    .main-wrapper {
        padding: 16px 12px 48px 12px;
    }

    .container {
        padding: 20px 16px;
        border-radius: 16px;
    }

    /* Hero Section Mobile */
    .tools-hub-hero {
        margin-bottom: 18px;
    }

    .hero-badge-pill {
        font-size: 0.72rem;
        padding: 4px 12px;
        margin-bottom: 10px;
        gap: 6px;
    }

    .tools-hub-title {
        font-size: 1.45rem;
        letter-spacing: -0.02em;
        line-height: 1.25;
        margin-bottom: 8px;
    }

    .tools-hub-desc {
        font-size: 0.84rem;
        line-height: 1.5;
        margin: 0 auto 16px auto;
        padding: 0 6px;
    }

    /* Search Bar Mobile */
    .search-bar-wrap {
        margin-bottom: 14px;
    }

    .search-input-field {
        padding: 12px 44px 12px 42px;
        font-size: 0.88rem;
        border-radius: 14px;
    }

    .search-icon-left {
        left: 14px;
        font-size: 1.05rem;
    }

    .search-key-badge {
        display: none; /* Keyboard shortcut not needed on touch screens */
    }

    /* Quick Tags Mobile */
    .quick-tags-wrap {
        gap: 6px;
        margin-top: -6px;
        margin-bottom: 18px;
    }

    .quick-tag-label {
        display: none;
    }

    .quick-tag-btn {
        padding: 4px 10px;
        font-size: 0.74rem;
        border-radius: 16px;
    }

    /* Value Props Mobile (Compact 2x2 Mini Grid - Dramatically Reduces Scroll) */
    .features-value-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 20px;
    }

    .value-card {
        padding: 10px 12px;
        border-radius: 12px;
        gap: 8px;
        align-items: center;
    }

    .value-icon {
        font-size: 1.3rem;
        margin-top: 0;
    }

    .value-title {
        font-size: 0.78rem;
        margin-bottom: 0;
        line-height: 1.25;
    }

    .value-desc {
        display: none; /* Hide verbose text on mobile so tools are visible immediately */
    }

    /* Sticky Category Nav Mobile (Single Horizontal Swipe Bar, No Wrapping/Overlapping) */
    .category-filter-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        gap: 6px;
        padding: 6px 8px;
        margin-bottom: 22px;
        top: 56px;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 14px;
        background: var(--bg-glass);
    }

    .category-filter-nav::-webkit-scrollbar {
        display: none;
    }

    .category-pill {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 0.78rem;
        border-radius: 14px;
    }

    /* Category Section Headers Mobile */
    .category-section {
        margin-bottom: 28px;
        scroll-margin-top: 100px;
    }

    .cat-sec-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
        gap: 8px;
    }

    .cat-sec-title {
        font-size: 1.12rem;
        gap: 6px;
    }

    .cat-sec-tag {
        font-size: 0.68rem;
        padding: 2px 7px;
    }

    .cat-sec-desc {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    /* Tools Grid Mobile (2-Column Compact Layout for Fast Scanning) */
    .tools-hub-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .hub-tool-card {
        padding: 12px 12px 14px 12px;
        border-radius: 14px;
        min-height: 135px;
    }

    .hub-card-header {
        margin-bottom: 8px;
    }

    .hub-card-icon {
        width: 34px;
        height: 34px;
        font-size: 1.15rem;
        border-radius: 9px;
    }

    .hub-card-badge {
        font-size: 0.58rem;
        padding: 2px 5px;
    }

    .hub-card-title {
        font-size: 0.88rem;
        margin-bottom: 4px;
        line-height: 1.25;
    }

    .hub-card-desc {
        font-size: 0.72rem;
        line-height: 1.35;
        margin-bottom: 8px;
        -webkit-line-clamp: 2;
    }

    .hub-card-footer {
        font-size: 0.74rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== ADVANCED PDF EDITOR STYLES ==================== */
.editor-main-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 14px;
}

.editor-toolbar-box {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== iLovePDF UI & Toolbar Redesign ==================== */
.ilove-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 4px;
    flex-wrap: wrap;
}

/* Left Group: File Info & Back */
.ilove-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.ilove-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ilove-btn-back:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.ilove-doc-info {
    display: flex;
    flex-direction: column;
    max-width: 170px;
    overflow: hidden;
}

.ilove-doc-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ilove-doc-meta {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Center Tools: The 4 Core Tools (iLovePDF Clean Tabs) */
.ilove-center-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    padding: 4px 6px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.ilove-tool-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 68px;
    padding: 6px 12px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.ilove-tool-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.ilove-tool-name {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.ilove-tool-btn:hover {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-subtle);
    transform: translateY(-1px);
}

.ilove-tool-btn.active {
    background: #ffffff;
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .ilove-tool-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--primary);
}

/* Right Group: Undo, Zoom, Page Nav & iLovePDF Red CTA */
.ilove-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ilove-history-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-subtle);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.ilove-ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ilove-ctrl-btn:hover:not(:disabled) {
    background: var(--bg-card);
    color: var(--primary);
}

.ilove-ctrl-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ilove-zoom-pill,
.ilove-page-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--bg-subtle);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.ilove-zoom-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ilove-zoom-btn:hover {
    background: var(--bg-card);
    color: var(--primary);
}

.ilove-zoom-btn.fit-btn {
    width: auto;
    padding: 0 6px;
    font-size: 0.72rem;
}

.ilove-zoom-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 44px;
    text-align: center;
    cursor: pointer;
}

.ilove-page-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 48px;
    text-align: center;
}

/* Big Red iLovePDF Signature Action Button */
.ilove-red-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #e5322d;
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(229, 50, 45, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
}

.ilove-red-btn:hover {
    background: #c62828;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(229, 50, 45, 0.45);
}

.ilove-red-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(229, 50, 45, 0.3);
}

.ilove-red-btn:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.editor-toolbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.editor-tool-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.editor-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.editor-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.editor-btn-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Dynamic Property Bar */
.editor-props-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-radius: 10px;
    border: 1px dashed var(--border-subtle);
    font-size: 0.84rem;
}

.prop-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.prop-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.prop-select {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.prop-color-input {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1.5px solid var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    overflow: hidden;
}

.prop-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}
.prop-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.color-palette-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.color-dot:hover {
    transform: scale(1.18);
}

.color-dot.active {
    border-color: var(--text-main);
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--primary);
}

.editor-toggle-btn {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.editor-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.editor-toggle-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Viewport Container for Pinned Bottom Overlay */
.editor-viewport-container {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 75vh;
    max-height: 75vh;
    min-height: 600px;
    overflow: hidden;
}

/* Canvas Viewport: Neutral Clean Desk Background */
.editor-viewport-wrapper {
    background: #eaebef;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 32px 20px 80px 20px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
    overflow: auto;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

[data-theme="dark"] .editor-viewport-wrapper {
    background: #181c27;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Floating In-Preview Navigation Pill (Pinned to Viewport Bottom Center) */
.preview-floating-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 95;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 7px 16px;
    border-radius: 30px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: auto;
    user-select: none;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease;
}

.preview-floating-nav:hover {
    transform: translateX(-50%) scale(1.03);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

.floating-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.floating-nav-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.floating-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: scale(1.1);
}

.floating-nav-btn.fit-btn {
    width: auto;
    border-radius: 12px;
    padding: 0 8px;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.1);
}

.floating-nav-btn.fit-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.floating-nav-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f8fafc;
    min-width: 48px;
    text-align: center;
    cursor: pointer;
}

.floating-nav-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
}

/* Genuine Paper Document Appearance with Authentic Depth & Crisp Edges */
.editor-canvas-stage {
    position: relative;
    display: inline-block;
    background: #ffffff;
    border-radius: 2px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.2);
    transform-origin: top center;
    transition: transform 0.15s ease-out;
}

#pdfBgCanvas {
    display: block;
    border-radius: 2px;
    background: #ffffff;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Interactive Text Layer for Detecting & Replacing Existing PDF Text */
.pdf-text-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none !important;
    z-index: 5;
}

.pdf-text-layer.active {
    pointer-events: none !important;
    z-index: 5 !important;
}

.pdf-text-item {
    position: absolute;
    color: transparent;
    cursor: text;
    user-select: none;
    border-radius: 2px;
    background: transparent;
    pointer-events: none;
    transition: background 0.12s, outline 0.12s;
    z-index: 5;
}

.pdf-text-layer.active .pdf-text-item {
    pointer-events: auto !important;
}

.pdf-text-layer.active .pdf-text-item:hover {
    background: rgba(59, 130, 246, 0.25) !important;
    outline: 1.5px dashed #2563eb !important;
    box-shadow: 0 0 6px rgba(37, 99, 235, 0.3);
}

#drawingCanvas {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    border-radius: 4px;
    z-index: 8;
}

#drawingCanvas.active-draw {
    pointer-events: auto !important;
    cursor: crosshair !important;
    z-index: 30 !important;
}

#annotationOverlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20; /* Higher than text layer so boxes are always selectable and on top */
}

/* Overlay Elements & Selection Handles */
.anno-element {
    position: absolute;
    pointer-events: auto !important;
    cursor: move !important;
    user-select: none;
    box-sizing: border-box;
    z-index: 20;
}

.anno-element.selected {
    z-index: 100 !important;
    outline: 2px solid #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.editable-text-content {
    outline: none;
    min-width: 8px;
    min-height: 12px;
    cursor: move !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    white-space: pre; /* Keep single line by default to prevent wrapping original text into 2 lines */
    word-break: normal;
    overflow: visible;
    line-height: 1.15;
    padding: 0;
    margin: 0;
}

.editable-text-content.is-multiline {
    white-space: pre-wrap;
    word-break: break-word;
}

.anno-element.is-editing .editable-text-content {
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
}

.anno-element.anno-text {
    padding: 0;
    margin: 0;
    border: 1.5px dashed rgba(59, 130, 246, 0.4);
    border-radius: 2px;
    background: transparent;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.anno-element.anno-text:hover {
    border-color: rgba(59, 130, 246, 0.85);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.anno-element.anno-text.selected {
    border: 1.5px solid #3b82f6 !important;
    background: rgba(59, 130, 246, 0.04);
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.anno-element.anno-text.has-bg {
    background: #ffffff !important;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.anno-element.anno-whiteout {
    background: #ffffff !important;
    border: 1px dashed #94a3b8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.anno-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border: 2px solid #ffffff;
    border-radius: 3px;
    display: none;
    z-index: 110 !important;
    pointer-events: auto !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.1s;
}

.anno-handle:hover {
    transform: scale(1.25);
    background: #2563eb;
}

.anno-element.selected .anno-handle {
    display: block;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Floating Action Card (iLovePDF Style: [Edit | Delete]) */
.anno-action-card {
    position: absolute;
    z-index: 125;
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 3px 5px;
    gap: 3px;
    pointer-events: auto;
    user-select: none;
    transform: translateX(-50%);
    transition: opacity 0.15s ease;
}

[data-theme="dark"] .anno-action-card {
    background: #1e2433;
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}

.anno-action-card.hidden {
    display: none !important;
}

.action-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main, #334155);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.action-card-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .action-card-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.action-card-btn.action-edit-btn {
    color: #2563eb;
}

.action-card-btn.action-edit-btn:hover {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.action-card-btn.action-delete-btn {
    color: #ef4444;
}

.action-card-btn.action-delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.action-card-divider {
    width: 1px;
    height: 18px;
    background: var(--border-subtle, rgba(0, 0, 0, 0.12));
}

.anno-delete-btn {
    display: none !important;
}

/* Floating Zoom Control */
.editor-zoom-pill {
    display: inline-flex;
    align-items: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 2px 4px;
    gap: 4px;
}

.zoom-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.zoom-btn:hover {
    background: var(--border-subtle);
    color: var(--primary);
}

.zoom-label {
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
    color: var(--text-main);
}

/* Crop PDF Interactive Handles & Overlays */
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #3b82f6;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    z-index: 20;
    touch-action: none;
    box-sizing: border-box;
}
.crop-handle.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle.handle-n  { top: -5px; left: calc(50% - 7px); cursor: ns-resize; border-radius: 3px; width: 14px; height: 8px; }
.crop-handle.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle.handle-e  { top: calc(50% - 7px); right: -5px; cursor: ew-resize; border-radius: 3px; width: 8px; height: 14px; }
.crop-handle.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle.handle-s  { bottom: -5px; left: calc(50% - 7px); cursor: ns-resize; border-radius: 3px; width: 14px; height: 8px; }
.crop-handle.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle.handle-w  { top: calc(50% - 7px); left: -5px; cursor: ew-resize; border-radius: 3px; width: 8px; height: 14px; }

/* Merge PDF Password Unlock Badge */
.encrypted-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #fca5a5;
}
.encrypted-badge.unlocked {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}
.inline-unlock-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}
.inline-unlock-input {
    padding: 4px 8px;
    border: 1.5px solid #f87171;
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--bg-subtle);
    color: var(--text-main);
    width: 140px;
}

/* TrueEdit Vector Engine Badge & Indicator */
.badge-trueedit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #ffffff !important;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.35);
    user-select: none;
    animation: trueEditPulse 2.5s infinite;
}

@keyframes trueEditPulse {
    0%, 100% {
        box-shadow: 0 1px 4px rgba(14, 165, 233, 0.35);
    }
    50% {
        box-shadow: 0 1px 10px rgba(99, 102, 241, 0.65);
    }
}

.anno-text.is-trueedit {
    outline: 1.5px dashed #0ea5e9 !important;
}

.anno-text.is-trueedit::after {
    content: '⚡ TrueEdit';
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 0.62rem;
    font-weight: 800;
    background: #0ea5e9;
    color: #ffffff;
    padding: 1px 5px;
    border-radius: 4px;
    pointer-events: none;
    line-height: 1.2;
    z-index: 20;
    white-space: nowrap;
}

/* ============================================================
   iLovePDF-Grade Sidebar & Workspace Layout
   ============================================================ */
.editor-workspace-body {
    display: flex;
    gap: 0;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    min-height: 600px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

/* Left Pages Sidebar */
.editor-sidebar-pages {
    width: 170px;
    min-width: 170px;
    background: var(--bg-subtle);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-pages-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-pages-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 720px;
}

.sidebar-pages-list::-webkit-scrollbar {
    width: 5px;
}
.sidebar-pages-list::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

/* Page Thumbnail Card */
.sidebar-page-card {
    background: var(--bg-card);
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.sidebar-page-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sidebar-page-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light, rgba(99, 102, 241, 0.2));
    background: var(--bg-subtle);
}

.sidebar-page-thumb {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    background: #ffffff;
}

.sidebar-page-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 4px;
}

.sidebar-page-card.active .sidebar-page-badge {
    color: var(--primary);
    background: var(--primary-light, rgba(99, 102, 241, 0.1));
}

/* Viewport Adjustments inside Workspace Body */
.editor-workspace-body .editor-viewport-container {
    flex: 1;
    min-height: 600px;
}

.editor-workspace-body .editor-viewport-wrapper {
    flex: 1;
    border: none;
    border-radius: 0;
    background: var(--bg-subtle);
    min-height: 100%;
}

/* Segmented Button Group (Text Alignment) */
.btn-group-segmented {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.btn-group-segmented .editor-toggle-btn {
    border: none;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.8rem;
    min-width: 28px;
    text-align: center;
}

.btn-group-segmented .editor-toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
}

/* Lifted Original Document Image */
.anno-element.anno-image.is-original {
    outline: 1px dashed rgba(59, 130, 246, 0.4);
    cursor: move;
}

.anno-element.anno-image.is-original:hover,
.anno-element.anno-image.is-original.selected {
    outline: 2px solid #3b82f6 !important;
}

.anno-element.anno-image.is-original::after {
    content: '🖼️ Gambar Asli';
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.65rem;
    font-weight: 800;
    background: #3b82f6;
    color: #ffffff;
    padding: 1px 6px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.anno-element.anno-image.is-original:hover::after,
.anno-element.anno-image.is-original.selected::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .editor-sidebar-pages {
        display: none;
    }
    .preview-floating-nav {
        bottom: 12px;
        padding: 5px 10px;
        gap: 4px;
        max-width: calc(100% - 24px);
    }
    .preview-floating-nav .floating-nav-btn {
        width: 26px;
        height: 26px;
    }
}

/* ============================================================
   Right Tools & Action Sidebar (iLovePDF Style)
   ============================================================ */
.editor-sidebar-right {
    width: 260px;
    min-width: 260px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.03);
}

.right-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 600px;
}

.right-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.right-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.right-sidebar-icon {
    font-size: 1.1rem;
}

.right-sidebar-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.01em;
}

.right-sidebar-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: #ffffff;
    background: #e5322d;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

.right-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Auto-Detect Card */
.right-info-card {
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    padding: 12px;
}

.right-info-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.right-info-icon {
    font-size: 0.9rem;
}

.right-info-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #2563eb;
}

[data-theme="dark"] .right-info-title {
    color: #60a5fa;
}

.right-info-desc {
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--text-muted);
    margin: 0;
}

/* Layers & Elements Section */
.right-layers-section {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.layers-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.layers-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-main);
}

.btn-clear-edits {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-clear-edits:hover {
    background: rgba(239, 68, 68, 0.1);
}

.right-layers-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.layers-empty-state {
    text-align: center;
    padding: 12px 8px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.right-layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.right-layer-item:hover, .right-layer-item.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.layer-item-title {
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.layer-item-del {
    color: #ef4444;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
}

.layer-item-del:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Output Name Group */
.right-output-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.right-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.right-output-box .output-input-row {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    padding: 0 8px;
}

.right-output-box .output-input {
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 0.8rem;
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.right-output-box .output-ext {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Right Sidebar Footer with Big Red iLovePDF-style Process Button */
.right-sidebar-footer {
    padding: 14px 14px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-red-ilovepdf {
    width: 100%;
    background: #e5322d !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 13px 18px !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(229, 50, 45, 0.35);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-red-ilovepdf:hover {
    background: #cc2420 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 50, 45, 0.45);
}

.btn-red-ilovepdf:active {
    transform: translateY(0);
}

.btn-process-arrow {
    font-size: 1.1rem;
    transition: transform 0.15s ease;
}

.btn-red-ilovepdf:hover .btn-process-arrow {
    transform: translateX(4px);
}

.btn-gdrive-sidebar {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.btn-gdrive-sidebar:hover {
    background: var(--bg-subtle);
    border-color: var(--primary);
}

@media (max-width: 960px) {
    .editor-sidebar-right {
        display: none;
    }
}

