/* One PDF Editor - Professional Enterprise Styling */

/* ==================
   Bundled Fonts (Cross-Platform)
   These fonts are served from backend/fonts/ and work on both macOS and Linux VPS
   ================== */

/* Arimo - Metric-compatible with Arial/Helvetica */
@font-face {
    font-family: 'Arimo-Regular';
    src: url('/api/bundled-fonts/Arimo-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Arimo-Bold';
    src: url('/api/bundled-fonts/Arimo-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Arimo-Italic';
    src: url('/api/bundled-fonts/Arimo-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Arimo-BoldItalic';
    src: url('/api/bundled-fonts/Arimo-BoldItalic.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

/* Tinos - Metric-compatible with Times New Roman */
@font-face {
    font-family: 'Tinos-Regular';
    src: url('/api/bundled-fonts/Tinos-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Tinos-Bold';
    src: url('/api/bundled-fonts/Tinos-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Tinos-Italic';
    src: url('/api/bundled-fonts/Tinos-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Tinos-BoldItalic';
    src: url('/api/bundled-fonts/Tinos-BoldItalic.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

/* Cousine - Metric-compatible with Courier New */
@font-face {
    font-family: 'Cousine-Regular';
    src: url('/api/bundled-fonts/Cousine-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Cousine-Bold';
    src: url('/api/bundled-fonts/Cousine-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Cousine-Italic';
    src: url('/api/bundled-fonts/Cousine-Italic.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Cousine-BoldItalic';
    src: url('/api/bundled-fonts/Cousine-BoldItalic.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

:root {
    /* Global Variables - Professional Blue/Orange Theme */
    /* Primary Colors - Blue */
    --primary: #2563eb;
    /* Professional Blue */
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-light: #dbeafe;

    /* Accent Colors - Orange */
    --accent: #f97316;
    /* Vibrant Orange for CTAs */
    --accent-hover: #ea580c;
    --accent-light: #ffedd5;

    /* Secondary */
    --secondary: #1e293b;
    /* Dark Slate for Headings */

    /* UI Colors */
    --bg-body: #f8fafc;
    /* Clean slate-tinted white */
    --bg-surface: #ffffff;
    --bg-toolbar: #ffffff;

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;

    /* Borders & Shadows */
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-float: 0 20px 40px rgba(0, 0, 0, 0.12);

    /* Spacing */
    --nav-height: 64px;
    --toolbar-height: 50px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================
   Rich Navigation Bar
   ================== */
.navbar {
    height: var(--nav-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary);
    text-decoration: none;
}

.brand-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-login {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 8px 16px;
}

.btn-trial {
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-trial:hover {
    background: var(--primary-hover);
}

/* ==================
   Mega Menu / Dropdown
   ================== */
.n-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.n-dropdown-menu {
    position: absolute;
    top: 50px;
    /* Reduced from 60px to be closer to text */
    left: -100px;
    /* Adjust alignment */
    width: 960px;
    /* Mega menu width */
    max-width: 90vw;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    /* Stronger shadow */
    padding: 30px;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 30px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    visibility: hidden;
    /* Use visibility for transition */
}

/* Invisible bridge to prevent menu from closing when moving mouse */
.n-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -30px;
    /* Covers the gap */
    left: 0;
    width: 100%;
    height: 40px;
    background: transparent;
    z-index: -1;
}

/* Hover State */
.n-dropdown:hover .n-dropdown-menu {
    display: grid;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.n-menu-category h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.n-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.n-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 0;
    transition: all 0.2s ease;
}

.n-menu-item:hover {
    color: #2563eb;
}

.n-menu-item i {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.n-menu-item:hover i {
    transform: scale(1.1);
}

/* Colorful icons for desktop dropdown by category */
/* Column 1: Merge & PDF Editor - Purple */
.n-dropdown-menu .n-menu-category:nth-child(1) .n-menu-item i {
    color: #7c3aed;
    background: #f3e8ff;
}

/* Column 2: Split & Edit/Sign - Orange for Split, Teal for Edit */
.n-dropdown-menu .n-menu-category:nth-child(2) .n-menu-list:first-of-type .n-menu-item i {
    color: #ea580c;
    background: #fff7ed;
}

/* Edit & Sign under column 2 - Teal */
.n-dropdown-menu .n-menu-category:nth-child(2) .n-menu-list:last-of-type .n-menu-item i {
    color: #0d9488;
    background: #f0fdfa;
}

/* Column 3: Convert From PDF - Blue */
.n-dropdown-menu .n-menu-category:nth-child(3) .n-menu-item i {
    color: #2563eb;
    background: #eff6ff;
}

/* Column 4: Convert To PDF - Green */
.n-dropdown-menu .n-menu-category:nth-child(4) .n-menu-item i {
    color: #16a34a;
    background: #f0fdf4;
}

/* Column 5: Security & Others - Red/Amber mix */
.n-dropdown-menu .n-menu-category:nth-child(5) .n-menu-item i {
    color: #dc2626;
    background: #fef2f2;
}

/* Specific colors for certain tool types */
.n-menu-item i.fa-lock,
.n-menu-item i.fa-unlock {
    color: #dc2626 !important;
    background: #fef2f2 !important;
}

.n-menu-item i.fa-crop,
.n-menu-item i.fa-rotate,
.n-menu-item i.fa-wand-magic-sparkles {
    color: #d97706 !important;
    background: #fffbeb !important;
}

.n-menu-item i.fa-pen-to-square,
.n-menu-item i.fa-signature,
.n-menu-item i.fa-trash-can {
    color: #0d9488 !important;
    background: #f0fdfa !important;
}

.n-menu-item i.fa-file-word,
.n-menu-item i.fa-file-excel,
.n-menu-item i.fa-file-powerpoint,
.n-menu-item i.fa-file-image,
.n-menu-item i.fa-file-lines {
    color: #2563eb !important;
    background: #eff6ff !important;
}

.n-menu-item i.fa-images,
.n-menu-item i.fa-html5 {
    color: #16a34a !important;
    background: #f0fdf4 !important;
}

.n-menu-item i.fa-layer-group,
.n-menu-item i.fa-object-group,
.n-menu-item i.fa-compress-arrows-alt {
    color: #7c3aed !important;
    background: #f3e8ff !important;
}

.n-menu-item i.fa-scissors,
.n-menu-item i.fa-file-export,
.n-menu-item i.fa-book-bookmark {
    color: #ea580c !important;
    background: #fff7ed !important;
}

.n-badge-new {
    font-size: 0.65rem;
    background: #ecfdf5;
    color: #059669;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: auto;
    border: 1px solid #a7f3d0;
}

/* ==================
   Pro Upload Section - Clean Minimal Design/* Upload Container - Clean Sejda Style with Background Pattern */
.upload-container {
    min-height: auto;
    padding: 40px 20px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    /* Clean light background */
    background: #faf8f3;
    position: relative;
    text-align: center;
    overflow: hidden;
}

/* Background Pattern - Sejda Style */
.upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/assets/bg-pattern-editor-sejda.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 0.7;
    pointer-events: none;
    z-index: 0;
}

.upload-card-wrapper {
    width: 100%;
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 2;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: #2563eb;
    margin-bottom: 40px;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    font-weight: 400;
}

.upload-box {
    background: white;
    padding: 50px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary);
}

.upload-icon-circle {
    width: 60px;
    height: 60px;
    background: #eff6ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--primary);
    font-size: 1.8rem;
}

.btn-upload-lg {
    background: var(--primary);
    color: white;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-upload-lg:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.upload-helper-text {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-top: 16px;
    margin-bottom: 8px;
}

.upload-privacy-text {
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.upload-policy-links {
    font-size: 0.8rem;
    color: #a0aec0;
}

.upload-policy-links a {
    color: var(--primary);
    text-decoration: underline;
}

/* Feature Grid (Trust Signals) */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 60px;
    max-width: 1000px;
    padding: 0 20px;
}

.feature-item {
    text-align: center;
}

.feature-icon {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 12px;
    background: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.feature-title {
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 8px;
}

.feature-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================
   Wave Separator (Sejda Style)
   ================== */
.wave-separator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    z-index: 1;
}

.wave-separator img {
    width: 100%;
    height: 120px;
    display: block;
}

/* ==================
   SEO Content Section (Premium Professional)
   ================== */
/* ==================
   SEO Content Section - Professional Light Design
   ================== */

.seo-content {
    background: linear-gradient(135deg, #faf8f3 0%, #f8fafc 50%, #fef6e8 100%);
    padding: 100px 20px 120px;
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern */
.seo-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(251, 191, 36, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.seo-container {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.seo-container h2 {
    font-size: 2.5rem;
    color: #1e293b;
    margin-bottom: 24px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.seo-intro {
    font-size: 1.2rem;
    color: #475569;
    line-height: 1.8;
    margin-bottom: 60px;
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* SEO H1 Title */
.seo-h1 {
    font-size: 2.8rem;
    color: #1e293b;
    margin-bottom: 24px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* SEO Features Grid */
.seo-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.seo-feature {
    background: white;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.1);
    transition: all 0.3s ease;
}

.seo-feature:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.seo-feature h3 {
    color: #1e293b;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.seo-feature p {
    color: #64748b;
    line-height: 1.7;
    margin: 0;
}

/* SEO Steps */
.seo-steps {
    background: #f0f9ff;
    padding: 32px 40px;
    border-radius: 16px;
    margin-bottom: 50px;
    border-left: 4px solid #2563eb;
}

.seo-steps li {
    padding: 12px 0;
    color: #334155;
    line-height: 1.6;
}

.seo-steps li strong {
    color: #1e293b;
}

/* SEO FAQ */
.seo-faq {
    margin-top: 24px;
}

.faq-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.faq-item summary {
    padding: 20px 24px;
    cursor: pointer;
    font-weight: 600;
    color: #1e293b;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    color: #2563eb;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 24px 20px;
    color: #64748b;
    line-height: 1.7;
    margin: 0;
}

/* ==================
   Premium How-To Steps - Soft Blue Theme
   ================== */

.howto-steps {
    background: linear-gradient(135deg, #f1f5fb 0%, #eff6ff 100%);
    border-radius: 24px;
    padding: 50px;
    margin-bottom: 80px;
    box-shadow: 0 10px 40px rgba(37, 99, 235, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.1);
    position: relative;
    overflow: hidden;
}

/* Decorative corner accent */
.howto-steps::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.howto-steps h3 {
    font-size: 1.8rem;
    color: #1e293b;
    margin-bottom: 40px;
    font-weight: 800;
    padding-bottom: 20px;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, transparent 100%);
    border-image-slice: 1;
    position: relative;
}

.howto-steps ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 24px;
    counter-reset: step-counter;
}

.howto-steps li {
    position: relative;
    padding: 28px 28px 28px 80px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-left: 4px solid #2563eb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.howto-steps li:hover {
    transform: translateX(8px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
    border-left-color: #3b82f6;
}

/* Gradient Number Badges */
.howto-steps li::before {
    content: counter(step-counter);
    counter-increment: step-counter;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 48px;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.howto-steps li strong {
    color: #1e293b;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ==================
   Premium Feature Cards - Warm Cream Theme
   ================== */

.features-detailed {
    margin-bottom: 80px;
    padding: 60px 40px;
    background: linear-gradient(135deg, #fef6e8 0%, #fef3c7 100%);
    border-radius: 24px;
    position: relative;
}

.features-detailed::before {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.features-detailed h3 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 40px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 60%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-detailed ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
    padding: 0;
}

.features-detailed li {
    padding: 36px 32px;
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(37, 99, 235, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.features-detailed li:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(251, 191, 36, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

/* Gradient top accent */
.features-detailed li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #fbbf24 100%);
    border-radius: 20px 20px 0 0;
}

/* Icon accent circle */
.features-detailed li::after {
    content: '✦';
    position: absolute;
    top: -12px;
    right: 24px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #2563eb 0%, #fbbf24 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    line-height: 32px;
    text-align: center;
}

.features-detailed li strong {
    color: #1e293b;
    display: block;
    margin-bottom: 14px;
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-detailed li {
    color: #475569;
    line-height: 1.7;
    font-size: 1rem;
}

/* ==================
   Premium FAQ Accordion - Light Blue Theme
   ================== */

.faq-section {
    margin-top: 60px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 60px 40px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.1);
}

.faq-section h3 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 40px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.faq-section details {
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 20px;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-left: 4px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.faq-section details:hover {
    border-left-color: #2563eb;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.1);
}

.faq-section details[open] {
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    border-color: #2563eb;
    border-left-color: #2563eb;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
}

.faq-section summary {
    cursor: pointer;
    font-weight: 700;
    color: #1e293b;
    font-size: 1.15rem;
    user-select: none;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}

.faq-section summary:hover {
    color: #2563eb;
}

.faq-section summary::-webkit-details-marker {
    display: none;
}

/* Custom Plus/Minus Icon */
.faq-section summary::after {
    content: '+';
    width: 32px;
    height: 32px;
    font-size: 1.8rem;
    color: white;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
    line-height: 32px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    text-align: center;
}

.faq-section details[open] summary::after {
    transform: rotate(135deg);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.faq-section details[open] summary {
    margin-bottom: 20px;
    color: #2563eb;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(37, 99, 235, 0.2);
}

.faq-section details p {
    color: #475569;
    line-height: 1.8;
    margin: 0;
    font-size: 1.05rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .howto-steps {
        padding: 32px 24px;
    }

    .howto-steps li {
        padding: 24px 24px 24px 70px;
    }

    .howto-steps li::before {
        width: 40px;
        height: 40px;
        line-height: 40px;
        left: 16px;
        font-size: 1rem;
    }

    .features-detailed {
        padding: 40px 24px;
    }

    .features-detailed ul {
        grid-template-columns: 1fr;
    }

    .faq-section {
        padding: 40px 24px;
    }

    .seo-container h2 {
        font-size: 2rem;
    }

    .features-detailed h3,
    .faq-section h3 {
        font-size: 1.6rem;
    }
}

@media (max-width: 768px) {
    .upload-container::before {
        width: 250px;
        height: 250px;
        opacity: 0.4;
    }

    .seo-container h2 {
        font-size: 1.6rem;
    }

    .features-detailed ul {
        grid-template-columns: 1fr;
    }
}

/* ==================
   App Footer
   ================== */
/* ==================
   App Footer
   ================== */
.site-footer {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding-top: 80px;
    padding-bottom: 40px;
    position: relative;
    z-index: 10;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 60px;
}

.footer-col h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-col a {
    display: block;
    color: #64748b;
    margin-bottom: 12px;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: #2563eb;
}

.brand-area .brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    margin-bottom: 20px;
}

.brand-desc {
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 24px;
    font-size: 0.95rem;
    max-width: 300px;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.2s;
    margin-bottom: 0;
}

.social-links a:hover {
    background: #2563eb;
    color: white;
    transform: translateY(-2px);
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 40px 0;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Responsive Footer */
@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .brand-area {
        align-items: center;
    }

    .brand-desc {
        margin: 0 auto 24px;
    }

    .social-links {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
}

/* ==================
   Editor Workspace
   ================== */
/* Editor Workspace */
.editor-workspace {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
    background: #e5e7eb;
    /* Lighter clean gray instead of dark */
}

/* Robust Toolbar */
.toolbar {
    background: var(--bg-toolbar);
    height: var(--toolbar-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    padding: 0 24px;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.toolbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    margin-right: 8px;
    border-right: 1px solid #dde1e6;
    height: 32px;
}

.toolbar-group:last-child {
    border-right: none;
}

.tool-btn {
    height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #4a5568;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.1s;
}

.tool-btn:hover {
    background: #e9ecef;
    color: var(--text-primary);
}

.tool-btn.active {
    background: #e6f4ea;
    color: var(--primary);
    border-color: #bce3cd;
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    color: #a0aec0;
}

.tool-btn:disabled:hover {
    background: transparent;
    color: #a0aec0;
}

/* Editor Main (Canvas) */
.main-content {
    flex: 1;
    overflow: hidden;
    /* Canvas container handles scroll */
    position: relative;
}

.canvas-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    background-color: #f5f5f5 !important;
    /* Light gray background */
    background-image: none !important;
    /* Remove any pattern */
}

/* PDF Page Wrapper (Paper look) */
.pdf-page-wrapper {
    position: relative;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    /* Deep shadow */
    margin-bottom: 40px;
}

/* Floating Controls */
.page-controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    backdrop-filter: blur(8px);
    padding: 8px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 500;
}

.page-controls button {
    background: none;
    border: none;
    color: #cbd5e0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 1rem;
}

.page-controls button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.page-meta {
    font-variant-numeric: tabular-nums;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Action Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    box-shadow: none;
}

/* Overlays */
.text-layer,
.edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Allow clicks to pass through to canvas if needed, but text items capture them */
}

.text-item {
    position: absolute;
    cursor: text;
    border: 1px solid transparent;
    /* Highlight on hover */
    pointer-events: auto;
}

.text-item:hover {
    background: rgba(0, 156, 77, 0.05);
    border-color: rgba(0, 156, 77, 0.3);
}

.edit-input {
    position: absolute;
    /* Vital */
    border: 1px solid var(--accent);
    background: white;
    padding: 0;
    outline: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    pointer-events: auto;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

/* Green Scanning Animation - Centered, always visible */
.scan-animation {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 120vh;
    background: linear-gradient(to bottom,
            transparent 0%,
            transparent 46%,
            rgba(16, 185, 129, 0.15) 47%,
            rgba(16, 185, 129, 0.35) 48.5%,
            rgba(16, 185, 129, 0.7) 50%,
            rgba(16, 185, 129, 0.35) 51.5%,
            rgba(16, 185, 129, 0.15) 53%,
            transparent 54%,
            transparent 100%);
    animation: scanDown 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.6));
}

@keyframes scanDown {
    0% {
        top: -20%;
    }

    100% {
        top: 120%;
    }
}

/* Premium Loader Container - Semi-transparent */
.premium-loader {
    text-align: center;
    max-width: 500px;
    padding: 50px 40px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    border: 2px solid rgba(37, 99, 235, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 100;
}

/* Animated Loader Text - Uiverse.io Wave Style */
.loader-text {
    width: fit-content;
    font-weight: bold;
    font-family: monospace;
    font-size: 36px;
    margin: 0 auto 30px;
    background: radial-gradient(circle closest-side, #1e293b 94%, transparent) right/calc(200% - 1em) 100%;
    animation: loaderWave 1s infinite alternate linear;
}

.loader-text::before {
    content: attr(data-text);
    line-height: 1em;
    color: transparent;
    background: inherit;
    background-image: radial-gradient(circle closest-side, #3b82f6 94%, #1e293b);
    -webkit-background-clip: text;
    background-clip: text;
}

@keyframes loaderWave {
    100% {
        background-position: left;
    }
}

/* Progress Bar Container - Light Theme */
.loader-progress {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Animated Progress Bar - Light Theme */
.loader-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6, #8b5cf6, #ec4899, #f59e0b);
    background-size: 200% 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease-out;
    animation: shimmer 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Loader Details Text - Light Theme */
.loader-details {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    animation: pulse 2s ease-in-out infinite;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Highlight Animation for Editable Elements */
@keyframes highlightBlink {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        background-color: rgba(59, 130, 246, 0);
    }

    50% {
        box-shadow: 0 0 12px 4px rgba(59, 130, 246, 0.4);
        background-color: rgba(59, 130, 246, 0.15);
    }
}

.highlight-editable {
    animation: highlightBlink 0.6s ease-in-out 3;
    transition: all 0.3s ease-out;
}

/* ===================
   Sejda-Style Inline Editing
   =================== */

/* Text Span - Seamless Inline Text */
.text-span {
    position: absolute;
    cursor: text;
    white-space: pre;
    outline: none;
    border: none;
    background: transparent;
    color: transparent;
    /* Hidden by default - overlays PDF canvas */
    transition: background 0.1s, box-shadow 0.1s;
    /* Zero padding ensures exact fit to maintain PDF layout fidelity */
    padding: 0;
    margin: 0;
    border-radius: 0;
    line-height: 1.0;
    pointer-events: auto;
    box-sizing: border-box;
    /* CRITICAL: Enable mouse interaction */
}

.text-span:hover {
    background: rgba(0, 156, 77, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 156, 77, 0.15);
    color: transparent;
    /* Still hidden on hover */
}

.text-span.editing {
    /* Color is set by JavaScript from textRun.color */
    background-color: #ffffff;
    /* Opaque white background to completely hide PDF text underneath */
    box-shadow: 0 0 0 1px rgba(46, 129, 206, 0.5);
    /* Thinner focus ring */
    z-index: 100;
    padding: 0;
    margin: 0;
}

.text-span.edited {
    /* Edited text stays visible with background to hide PDF text underneath */
    /* NOTE: Do NOT use !important here - JavaScript sets the actual background color */
    /* based on the PDF page color (could be white, teal, salmon, etc.) */
    background: white;
    /* Color is set by JavaScript to preserve original text color */
    /* If no JS color set, use black as fallback */
    color: inherit;
    padding: 0;
    margin: 0;
}

/* Floating Toolbar - Sejda Style */
.floating-toolbar {
    position: absolute;
    background: linear-gradient(180deg, #4a5568 0%, #3d4654 100%);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 2px;
    z-index: 2000;
    pointer-events: auto;
}

.floating-toolbar::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #3d4654 transparent transparent transparent;
}

.toolbar-item {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #e2e8f0;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.12s;
}

.toolbar-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.toolbar-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.toolbar-item.delete-btn:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Remove old edit-input styles - replaced by inline editing */
.edit-input {
    display: none !important;
}

/* ==================
   Mobile Responsiveness & Touch Optimization
   ================== */

/* Mobile-First Breakpoints */
@media (max-width: 1024px) {
    .toolbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .toolbar-group {
        flex-wrap: wrap;
    }

    .page-controls {
        width: 100%;
        justify-content: center;
        order: -1;
        margin-bottom: 12px;
    }
}

/* Medium Mobile Screens (Tablets & Large Phones) */
@media (max-width: 768px) and (min-width: 481px) {
    .toolbar {
        height: auto;
        min-height: var(--toolbar-height);
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .toolbar-tools {
        flex-wrap: wrap;
        gap: 6px;
    }

    .toolbar-group {
        gap: 4px;
        padding-right: 8px;
        margin-right: 4px;
    }

    .tool-btn {
        height: 38px;
        padding: 0 10px;
        font-size: 0.85rem;
        gap: 6px;
    }

    .tool-btn i {
        font-size: 1rem;
    }

    /* Hide text labels on smaller buttons to save space */
    .toolbar-group:first-child .tool-btn {
        padding: 0 8px;
    }

    #statusIndicator {
        font-size: 0.8rem !important;
        margin-right: 8px !important;
    }

    .btn-primary {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}



@media (max-width: 768px) {

    /* Navigation */
    .nav-menu {
        display: none;
        /* Hide menu on mobile, can add hamburger menu later */
    }

    .nav-actions {
        gap: 8px;
    }

    .btn-login,
    .btn-trial {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Upload Container */
    .upload-container {
        padding: 40px 20px;
    }

    .upload-box h2 {
        font-size: 1.5rem;
    }


    /* Zoom controls - easier touch */
    .zoom-display {
        min-width: 70px;
        font-size: 0.9rem;
    }

    /* Editor Container */
    .editor-container {
        padding: 16px;
    }

    #canvasContainer {
        margin: 16px auto;
    }

    /* Text Layer - Better touch selection */
    .text-layer span {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 156, 77, 0.2);
    }

    .text-layer span.editing {
        min-width: 100px;
        /* Ensure enough space for typing on mobile */
    }

    /* Floating Toolbar - Optimize for mobile */
    #floatingToolbar {
        flex-wrap: wrap;
        max-width: 95vw;
        padding: 8px;
        gap: 6px;
    }

    #floatingToolbar button {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    /* Font Dropdown */
    #fontFamilySelect {
        max-width: 140px;
        font-size: 0.85rem;
    }

    /* Page Navigation */
    .pagination-info {
        font-size: 0.9rem;
    }

    /* Canvas Container - Reduced padding for full horizontal scroll */
    .canvas-container {
        padding: 16px;
        justify-content: flex-start;
        /* Override center alignment to allow left scroll */
    }

    /* Apply Button - Sticky on mobile */
    .actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
    }

    .btn-apply {
        width: 100%;
        font-size: 1rem;
        padding: 14px;
    }
}

@media (max-width: 480px) {

    /* Extra small screens */
    .navbar {
        padding: 12px 16px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .brand-icon {
        font-size: 1.3rem;
    }

    .nav-actions .btn-trial {
        display: none;
        /* Hide trial button on very small screens */
    }

    /* Upload */
    .upload-box {
        padding: 32px 16px;
    }

    .upload-box h2 {
        font-size: 1.25rem;
    }

    .upload-box p {
        font-size: 0.9rem;
    }

    .file-input-btn {
        font-size: 0.9rem;
        padding: 12px 24px;
    }

    /* Toolbar - Touch Friendly & Compact */
    .toolbar {
        padding: 8px;
        gap: 6px;
        height: auto;
        min-height: var(--toolbar-height);
    }

    .tool-btn,
    .control-btn {
        min-width: 42px;
        min-height: 42px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .tool-btn i {
        font-size: 1rem;
    }

    /* Toolbar - Scrollable on mobile */
    .toolbar-tools {
        overflow-x: auto;
        padding-bottom: 4px;
        /* Scrollbar space */
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }

    .toolbar-group {
        flex-shrink: 0;
    }

    .page-controls {
        gap: 8px;
    }

    .control-btn {
        min-width: 40px;
        padding: 8px;
    }

    /* Zoom */
    .zoom-display {
        min-width: 60px;
        padding: 6px;
        font-size: 0.85rem;
    }

    /* Canvas - Full width on mobile */
    #canvasContainer {
        max-width: 100%;
    }

    /* Canvas Container - Minimal padding for maximum scroll on small screens */
    .canvas-container {
        padding: 8px;
        justify-content: flex-start;
        /* Override center alignment to allow left scroll */
    }

    /* Floating Toolbar - Compact and Centered for Mobile */
    #floatingToolbar {
        /* Restore absolute positioning so JS controls 'top' */
        position: absolute !important;

        /* Remove vertical stretching constraints */
        bottom: auto !important;
        top: auto;
        /* Allow JS to set top, but ensure no CSS override conflicts */

        /* Keep it horizontally centered on mobile to prevent clipping */
        left: 50% !important;
        transform: translateX(-50%) !important;

        /* Layout fixes */
        max-width: 95vw;
        gap: 2px;
        padding: 4px;

        flex-wrap: nowrap !important;
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        display: flex;
        z-index: 2000;
        max-height: 48px;
        /* Allow slightly more height for scrollbars if needed */
        background: #334155;
    }

    #floatingToolbar .toolbar-item {
        min-width: 28px !important;
        width: 28px !important;
        min-height: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        /* Remove padding to fit icon */
        font-size: 0.8rem !important;
        flex-shrink: 0;
        /* Prevent squishing */
    }

    .toolbar-divider {
        height: 16px;
        margin: 0 2px;
    }
}

/* Touch-Specific Enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Targeting touch devices specifically */

    .text-layer span:hover {
        background-color: rgba(0, 156, 77, 0.1);
        /* Less aggressive hover on touch */
    }

    .tool-btn:active,
    .control-btn:active {
        transform: scale(0.95);
        /* Visual feedback on tap */
    }

    /* Larger minimum touch targets */
    button,
    .tool-btn,
    .control-btn,
    .nav-link {
        min-width: 44px;
        min-height: 44px;
    }

    /* Prevent double-tap zoom on buttons */
    button,
    .tool-btn,
    .control-btn {
        touch-action: manipulation;
    }

    /* Better selection visibility on touch */
    .text-layer span.editing {
        outline: 3px solid var(--primary);
        outline-offset: 2px;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 896px) and (orientation: landscape) {
    .upload-container {
        padding: 24px 20px;
    }

    .toolbar {
        padding: 8px 12px;
    }

    .editor-container {
        padding: 12px;
    }

    /* Make better use of horizontal space */
    #canvasContainer {
        max-height: calc(100vh - 200px);
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* =============================================================================
   Draggable Objects (Images & Signatures)
   ============================================================================= */

.draggable-object {
    position: absolute;
    cursor: move;
    border: 2px dashed #3498db;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.1);
    user-select: none;
    z-index: 100;
    pointer-events: auto;
    /* CRITICAL: Override parent's pointer-events: none */
}

.draggable-object:hover {
    border-color: #2980b9;
}

.draggable-object.dragging {
    opacity: 0.7;
    cursor: grabbing;
}

.draggable-object img {
    display: block;
}

/* Delete button */
.object-delete-btn {
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 24px;
    height: 24px;
    background: #e74c3c;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    z-index: 101;
    transition: background 0.2s;
}

.object-delete-btn:hover {
    background: #c0392b;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #3498db;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 102;
}

.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* Mobile responsive handles */
@media (max-width: 768px) {
    .resize-handle {
        width: 20px;
        height: 20px;
    }

    .resize-handle.nw {
        top: -10px;
        left: -10px;
    }

    .resize-handle.ne {
        top: -10px;
        right: -10px;
    }

    .resize-handle.sw {
        bottom: -10px;
        left: -10px;
    }

    .resize-handle.se {
        bottom: -10px;
        right: -10px;
    }

    .object-delete-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
        line-height: 28px;
    }
}

/* Signature Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-content.signature-modal {
    width: 600px;
    max-width: 95%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    background: #f8f9fa;
}

.signature-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.signature-canvas-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    cursor: crosshair;
    margin-bottom: 12px;
    height: 200px;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    font-size: 1.5rem;
    pointer-events: none;
    user-select: none;
}

.signature-canvas-container canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
}

.canvas-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.color-picker-simple {
    display: flex;
    gap: 8px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-dot.active {
    border-color: #ddd;
    transform: scale(1.1);
    box-shadow: 0 0 0 1px var(--primary);
}

.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.upload-area i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: white;
}

@media (max-width: 600px) {
    .modal-content.signature-modal {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        width: 100%;
    }

    .modal-body {
        flex: 1;
    }
}

/* ==============================================================================
   PDF Image Overlays (NEW)
   ============================================================================== */

/* PDF Image overlay with blue dashed border */
.pdf-image-overlay {
    position: absolute;
    border: 2px dashed #3b82f6;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    background: transparent;
    pointer-events: auto;
    z-index: 15;
}

.pdf-image-overlay:hover {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.pdf-image-overlay.selected {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
    border-width: 3px;
}

/* Deleted image state */
.pdf-image-overlay.deleted {
    border-color: #ef4444;
    border-style: solid;
    background: rgba(239, 68, 68, 0.1);
    pointer-events: none;
}

.pdf-image-overlay.deleted::after {
    content: '✖';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: #ef4444;
    font-weight: bold;
}

/* Badge showing "PDF Image" */
.image-badge {
    position: absolute;
    top: -10px;
    left: -2px;
    background: #3b82f6;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

/* Floating Image Toolbar */
.image-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 2000;
}

.image-toolbar .toolbar-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: #f3f4f6;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-toolbar .toolbar-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.image-toolbar .toolbar-btn:active {
    transform: translateY(0);
}

/* ==================
   Resizable & Draggable Text Boxes
   ================== */

/* Text box selection container */
.text-box-container {
    position: absolute;
    cursor: move;
    z-index: 20;
}

/* Selected text box */
.text-box-container.selected {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Edited text with resizable state - preserve background from JS */
.text-span.resizable-selected {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px;
    cursor: move;
    /* Do NOT force white background - use the color set by JavaScript */
    /* background: inherit; allows inline style from app.js to show */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    /* Allow inline styles to override dimensions */
    width: auto !important;
    min-width: auto !important;
    max-width: none !important;
}

/* When actively resizing, allow constrained dimensions */
.text-span.resizing-active {
    display: inline-block !important;
    overflow: hidden !important;
}

/* Resize handles container - must not affect text layout */
.resize-handles,
.resize-handles-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    box-sizing: border-box;
}

/* Individual resize handle */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #2563eb;
    border: 2px solid white;
    border-radius: 2px;
    pointer-events: all;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 25;
}

/* Corner handles */
.resize-handle.nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.resize-handle.ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.resize-handle.sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.resize-handle.se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

/* Edge handles */
.resize-handle.n {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-handle.s {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.resize-handle.w {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.resize-handle.e {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    cursor: ew-resize;
}

/* Text box mode toggle (wrap/stretch) */
.textbox-mode-toggle {
    position: absolute;
    top: -30px;
    right: 0;
    display: flex;
    gap: 4px;
    background: white;
    border-radius: 4px;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 30;
}

.textbox-mode-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    background: transparent;
    color: #64748b;
    transition: all 0.15s;
}

.textbox-mode-btn:hover {
    background: #f1f5f9;
}

.textbox-mode-btn.active {
    background: #2563eb;
    color: white;
}

/* Drag ghost preview */
.text-box-ghost {
    position: absolute;
    border: 2px dashed #2563eb;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
    pointer-events: none;
    z-index: 50;
}

/* Resize preview */
.resize-preview {
    position: absolute;
    border: 2px dashed #10b981;
    background: rgba(16, 185, 129, 0.1);
    pointer-events: none;
    z-index: 50;
}

/* Text wrapping indicator */
.text-span.wrap-mode {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.text-span.stretch-mode {
    white-space: nowrap !important;
}

/* Editing text within resizable box */
.text-span.resizable-editing {
    outline: 2px solid #10b981 !important;
    background: rgba(16, 185, 129, 0.05);
}

/* Move mode - grab cursor, preserve background from JS */
.text-span.move-mode {
    cursor: grab !important;
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px;
    /* Do NOT force white background - use the color set by JavaScript */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.text-span.move-mode:active {
    cursor: grabbing !important;
}

/* Mode indicator animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================
   Sejda-Style Mobile All Tools Overlay
   ================== */

.mobile-tools-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-tools-overlay.active {
    display: block;
}

.mobile-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.mobile-tools-header span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-overlay {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.close-overlay:hover {
    color: var(--text-primary);
}

.mobile-tools-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
}

.mobile-tools-column {
    border-right: 1px solid var(--border);
}

.mobile-tools-column:last-child {
    border-right: none;
}

.mobile-category {
    padding: 0;
}

.mobile-category h4 {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 14px 16px 10px;
    margin: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.mobile-category a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.mobile-category a:hover,
.mobile-category a:active {
    background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
    color: #2563eb;
}

.mobile-category a i {
    width: 22px;
    height: 22px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Colorful icons for each category */
/* MERGE category - Purple */
.mobile-category:nth-child(1) a i,
.mobile-tools-column:first-child .mobile-category:first-child a i {
    color: #7c3aed;
    background: #f3e8ff;
}

/* SPLIT category - Orange */
.mobile-tools-column:first-child .mobile-category:nth-child(2) a i {
    color: #ea580c;
    background: #fff7ed;
}

/* CONVERT FROM PDF - Blue */
.mobile-tools-column:first-child .mobile-category:nth-child(3) a i {
    color: #2563eb;
    background: #eff6ff;
}

/* CONVERT TO PDF - Green */
.mobile-tools-column:first-child .mobile-category:nth-child(4) a i {
    color: #16a34a;
    background: #f0fdf4;
}

/* EDIT & SIGN - Teal */
.mobile-tools-column:last-child .mobile-category:first-child a i {
    color: #0d9488;
    background: #f0fdfa;
}

/* COMPRESS - Pink */
.mobile-tools-column:last-child .mobile-category:nth-child(2) a i {
    color: #db2777;
    background: #fdf2f8;
}

/* SECURITY - Red */
.mobile-tools-column:last-child .mobile-category:nth-child(3) a i {
    color: #dc2626;
    background: #fef2f2;
}

/* OTHER - Amber */
.mobile-tools-column:last-child .mobile-category:nth-child(4) a i {
    color: #d97706;
    background: #fffbeb;
}

/* Mobile viewport: Hide hamburger, show only All Tools */
@media (max-width: 768px) {

    /* Hide hamburger - we use All Tools dropdown instead */
    .hamburger-menu {
        display: none;
    }

    /* Navbar adjustments for Sejda style */
    .navbar {
        padding: 0 12px;
        height: 52px;
    }

    .brand {
        font-size: 1rem;
    }

    .brand svg {
        width: 28px;
        height: 28px;
    }

    .brand div span {
        font-size: 1rem !important;
    }

    /* Show only All Tools dropdown on mobile */
    .nav-menu {
        display: flex;
        gap: 0;
        flex: 1;
        justify-content: flex-start;
        margin-left: 8px;
    }

    /* Hide all nav links except All Tools dropdown */
    .nav-menu>a.nav-link {
        display: none;
    }

    .nav-menu .n-dropdown {
        display: block;
    }

    .nav-menu .n-dropdown .nav-link {
        font-size: 0.95rem;
        padding: 4px 0;
    }

    /* Hide the mega dropdown menu on mobile (we use overlay instead) */
    .n-dropdown:hover .n-dropdown-menu {
        display: none;
    }

    /* Simple nav-actions on mobile */
    .nav-actions {
        display: flex;
        gap: 8px;
    }

    .nav-actions .btn-login {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .nav-actions .btn-trial {
        display: none;
    }

    /* Hero Section adjustments */
    .hero-title {
        font-size: 1.6rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }

    .upload-box {
        padding: 24px 16px;
    }

    .btn-upload-lg {
        padding: 12px 20px;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 32px;
    }

    /* Footer Mobile */
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 0 16px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 0 16px;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .mobile-tools-content {
        grid-template-columns: 1fr;
    }

    .mobile-tools-column {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .mobile-tools-column:last-child {
        border-bottom: none;
    }

    .brand div span {
        font-size: 0.9rem !important;
    }

    .nav-actions .btn-login {
        font-size: 0.85rem;
        padding: 5px 8px;
    }
}

/* End of styles */