@property --arc {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

.hidden {
            display: none !important;
        }
        
        svg {
             fill: none;
        }
        
        body {
            overflow-x: hidden;
        }
        
        body.download-active {
            height: calc(100vh - 81px);
            overflow-y: visible;
        }

        /* Loading Screen */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: white;
            z-index: 9999;
            display: none;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 20px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .loading-screen.active {
            opacity: 1;
            pointer-events: all;
        }

        .loading-bar-container {
            width: 300px;
            height: 4px;
            background: #e0e0e0;
            border-radius: 2px;
            overflow: hidden;
            position: relative;
        }

        .loading-bar {
            position: absolute;
            height: 100%;
            background: #ff6154;
            border-radius: 2px;
            width: 40%;
            will-change: transform;
            animation: loading 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
        }

        @keyframes loading {
            0% {
                transform: translateX(-100%);
            }
            50% {
                transform: translateX(200%);
            }
            100% {
                transform: translateX(500%);
            }
        }

        .loading-text {
            font-size: 15px;
            color: #666;
            font-weight: 500;
        }

        .container {
            background-color: transparent;
            box-sizing: border-box;
            padding: 20px;
            border-radius: 16px;
            max-width: 1900px;              
            width: 100%;
            margin: 0 auto 10px auto;     
            overflow: visible;             
        }
        
        /* Add spinner styles */
        .button-spinner {
            display: inline-block;
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255, 255, 255, 0.7);
            border-radius: 50%;
            border-top-color: #ff6154;
            animation: spin 0.6s linear infinite;
            margin-right: 8px;
            vertical-align: middle;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        #progress-container {
            display: none !important;
        }
        
        .drag-scroll-indicator {
            position: fixed;
            left: 0;
            right: 0;
            height: 100px;
            display: flex;
            justify-content: center;
            gap: 6px;
            font-size: 0.75rem;
            font-weight: 600;
            color: #374151;
            white-space: nowrap;
            opacity: 0;
            transition: opacity 0.15s ease;
            pointer-events: none;
            z-index: 99999;
        }
        .drag-scroll-indicator svg {
            display: block;
            flex-shrink: 0;
        }
        .drag-scroll-indicator .drag-scroll-inner {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .drag-scroll-indicator.active {
            opacity: 1;
        }
        .drag-scroll-top {
            top: 0;
            background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
            align-items: flex-end;
            padding-bottom: 12px;
        }
        .drag-scroll-bottom {
            bottom: 0;
            background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
            align-items: flex-start;
            padding-top: 12px;
        }
        
/* Download result screen */
.download-screen {
    display: none;
    padding: 0;
    max-width: 100%;
    margin: 0;
    min-height: calc(100vh - 81px);
    background: #f5f6f8;
}

.download-screen.active {
    display: block;
}

/* Download content layout */
.download-content {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 81px);
}

/* Left side - PDF Preview (scrollable) */
.pdf-preview-section {
    flex: 1;
    background: #f5f6f8;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    margin-right: 420px;
    height: calc(100vh - 81px);
    box-sizing: border-box;
}

.preview-canvas-container {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.preview-page-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
}

.preview-page-wrapper canvas {
    width: 100%;
    height: auto;
    display: block;
}

.page-number-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: normal;
    z-index: 10;
}

#download-preview-canvas {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

.preview-controls {
    display: none;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .preview-canvas-container {
        gap: 0;
    }

    .preview-page-wrapper {
        display: none;
    }

    .preview-page-wrapper.active {
        display: block;
    }

    .page-number-badge {
        display: none;
    }

    .preview-controls {
        display: flex;
    }
}

.preview-controls button {
    padding: 10px 18px;
    font-size: 0.9rem;
    background: white;
    border: 2px solid #e5e7eb;
    color: #374151;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.preview-controls button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.preview-controls button:hover:not(:disabled) {
    border-color: #ff6154;
    background: #fff5f4;
    color: #ff6154;
}

.preview-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #e5e7eb;
    background: #f9fafb;
}

.preview-page-info {
    color: #374151;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Right side - Actions (Fixed Panel) */
.download-actions-section {
    position: fixed;
    right: 0;
    top: 81px;
    width: 420px;
    height: calc(100vh - 81px);
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
    box-sizing: border-box;
}

#download-files-list {
    margin-top: 50px;
    margin-bottom: 24px;
}

.single-file-card {
    background: none;
    border: none;
    border-radius: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.single-file-thumb {
    width: 68px;
    height: 82px;
    background: white;
    border-radius: 6px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.single-file-thumb canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.single-file-details {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.single-file-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.single-file-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background: #f9f9f9;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.single-file-name:hover {
    background: #f0f1f3;
}

.single-file-name-base {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.single-file-name-ext {
    white-space: nowrap;
    flex-shrink: 0;
    color: #9ca3af;
    margin-left: auto;
}

.file-more-btn {
    background: #f9f9f9;
    border: none;
    border-radius: 8px;
    padding: 8px 6px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.file-more-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.single-file-info {
    font-size: 0.7rem;
    color: #9ca3af;
}

.done-button {
    background: #10b981;
    color: white;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 3px;
}

.done-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: white;
}

/* Primary download button */
.download-primary {
    width: 100%;
    padding: 18px 32px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #ff6154;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.download-primary:hover {
    background: #e5554a;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.35);
    transform: translateY(-1px);
}

.download-primary svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
}

/* Convert To tab on file-more modal group */
.file-more-tab-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
}

.file-more-tab-wrapper .file-more-group {
    width: 100%;
    border-radius: 16px 0 16px 16px;
}

.file-more-section-tab {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 0;
    background: white;
    padding: 6px 24px;
    border-radius: 10px 10px 0 0;
    line-height: 1;
}

/* Merge Another button */
.extract-another-btn {
    width: 100%;
    padding: 13px 32px;
    margin-top: 12px;
    background: transparent;
    color: #ff6154;
    border: 1.5px solid #ff6154;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.another-btn-text,
.another-btn-arrow {
    transition: opacity 0.25s ease;
}

.another-btn-arrow {
    position: absolute;
    opacity: 0;
}

.extract-another-btn:hover {
    background: #fff5f4;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
}

.extract-another-btn:hover .another-btn-text {
    opacity: 0;
}

.extract-another-btn:hover .another-btn-arrow {
    opacity: 1;
}

/* File More Modal */
.file-more-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    animation: modalFadeIn 0.15s ease;
}

.file-more-overlay.hidden {
    display: none !important;
}

.file-more-sheet {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: sheetSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.file-more-group {
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.file-more-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}

.file-more-action:hover {
    background: #f9fafb;
}

.file-more-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-more-action-icon svg {
    color: #374151;
}

.file-more-action-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.file-more-action-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1f2937;
}

.file-more-action-desc {
    font-size: 0.75rem;
    color: #9ca3af;
}

.file-more-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 0 18px;
}

.file-more-cancel {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    background: white;
    color: #6b7280;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.file-more-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

/* Rename Modal */
.popup-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.15s ease;
}

.popup-modal-overlay.hidden {
    display: none !important;
}

.rename-modal-card {
    background: #f5f6f8;
    border-radius: 24px;
    padding: 24px;
    width: 320px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: modalSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.rename-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 16px;
}

.rename-modal-input-wrap {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.rename-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    color: #1f2937;
    outline: none;
    min-width: 0;
}

.rename-modal-ext {
    padding: 12px 14px 12px 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #9ca3af;
    flex-shrink: 0;
}

.rename-modal-actions {
    display: flex;
    gap: 8px;
}

.rename-modal-cancel {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: white;
    color: #6b7280;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rename-modal-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

.rename-modal-save {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 14px;
    background: #1f2937;
    color: white;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.rename-modal-save:hover {
    background: #374151;
}

@keyframes sheetSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hide elements when showing download screen */
.content-hidden {
    display: none !important;
}

/* Add Files Modal */
.add-files-modal {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-files-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 25, 0.4);
    backdrop-filter: blur(1.4px);
    -webkit-backdrop-filter: blur(1.4px);
    animation: addFilesBackdropIn 0.18s ease;
}

@keyframes addFilesBackdropIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.add-files-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 24px 64px rgba(0,0,0,0.14);
    padding: 18px;
    width: 380px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    animation: addFilesDialogIn 0.24s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.add-files-dialog.wide {
    width: 720px;
}

.add-files-staged-list.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

@keyframes addFilesDialogIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.add-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 2px;
}

.add-files-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

#add-files-dismiss {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px;
    min-height: 30px;
    border: none !important;
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    border-radius: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 !important;
    box-shadow: none !important;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

#add-files-dismiss:hover {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    box-shadow: none !important;
    transform: none !important;
}

#add-files-dismiss svg {
    display: block;
    flex-shrink: 0;
}

.add-files-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #f9fafb;
    border: 1.5px dashed #d1d5db;
    border-radius: 16px;
    padding: 44px 28px 36px;
    cursor: default;
    transition: border-color 0.18s ease, background 0.18s ease;
    text-align: center;
}

.add-files-dropzone.drag-over {
    border-color: #ff6154;
    background: #fff8f7;
}

.add-files-icon-wrap {
    width: 52px;
    height: 52px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: #6b7280;
    transition: color 0.18s ease, box-shadow 0.18s ease;
}

.add-files-dropzone.drag-over .add-files-icon-wrap {
    color: #ff6154;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(255,97,84,0.2);
}

.add-files-dropzone-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.add-files-dropzone-sub {
    font-size: 0.78rem;
    color: #9ca3af;
    margin: 0;
}

.add-files-browse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 8px 20px;
    background: #111827;
    color: #fff;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    letter-spacing: 0.01em;
}

.add-files-browse-btn:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

.add-files-dropzone.has-files {
    padding: 16px 20px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    text-align: left;
}

.add-files-dropzone.has-files .add-files-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.add-files-dropzone.has-files .add-files-icon-wrap svg {
    width: 16px;
    height: 16px;
}

.add-files-dropzone.has-files .add-files-dropzone-title {
    font-size: 0.82rem;
}

.add-files-dropzone.has-files .add-files-dropzone-sub {
    font-size: 0.74rem;
}

.add-files-dropzone.has-files .add-files-browse-btn {
    display: none;
}

.add-files-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.add-files-dropzone-add-more {
    font-size: 0.78rem;
    font-weight: 600;
    color: #ff6154;
    cursor: pointer;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 8px;
    background: #fff5f4;
    border: none;
    transition: background 0.15s;
    flex-shrink: 0;
}

.add-files-dropzone-add-more:hover {
    background: #fee2e0;
}

.add-files-staged {
    margin-top: 10px;
}

.add-files-staged-scroll {
    max-height: 220px;
    overflow-y: auto;
    margin: 0 0 10px;
}

.add-files-staged-scroll::-webkit-scrollbar {
    display: none;
}

.add-files-staged-scroll {
    scrollbar-width: none;
}

.add-files-staged-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-files-staged-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: #f9fafb;
    border-radius: 10px;
    transition: background 0.12s;
}

.add-files-staged-item:hover {
    background: #f3f4f6;
}

.add-files-staged-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.add-files-staged-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-files-staged-meta {
    font-size: 0.71rem;
    color: #9ca3af;
    white-space: nowrap;
}

.add-files-staged-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #c4c9d4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.add-files-staged-remove:hover {
    background: #fee2e2;
    color: #ef4444;
}

.add-files-confirm-btn {
    width: 100%;
    padding: 11px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    letter-spacing: 0.01em;
}

.add-files-confirm-btn:hover {
    background: #1f2937;
    transform: translateY(-1px);
}


/* Back button */
.back-button {
    background: none;
    color: #8e96a7;
    border: none;
    padding: 0;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    position: absolute;
    margin-top: -10px;
    left: 40px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.back-button:hover {
    background: none;
    color: #374151;
    box-shadow: none;
    transform: none;
}

.back-button svg {
    width: 18px;
    height: 18px;
    background: #f9f9f9;
    padding: 6px;
    border-radius: 8px;
    box-sizing: content-box;
    transition: background 0.15s ease;
}

.back-button:hover svg {
    background: #f0f0f0;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .download-actions-section {
        width: 380px;
        padding: 32px 24px;
    }

    .pdf-preview-section {
        margin-right: 380px;
    }
}

@media (max-width: 968px) {
    .download-screen {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-content {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 81px);
    }

    .download-actions-section {
        position: relative;
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid #e5e7eb;
    }

    .pdf-preview-section {
        margin-right: 0;
        padding: 100px 20px 20px 20px;
        height: auto;
        min-height: 50vh;
    }

    .back-button {
        top: 20px;
        left: 20px;
    }
}

@media (max-width: 768px) {
    .pdf-preview-section {
        padding: 80px 16px 16px 16px;
    }

    .download-actions-section {
        padding: 24px 16px;
    }

    .back-button {
        font-size: 0.9rem;
    }
}


        .upload-area {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 1.5rem;
            gap: 12px;
            flex-wrap: wrap;
        }

        .file-input-label {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 16px 48px;
            background-color: #ff6154;
            color: white;
            border-radius: 12px;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: 600;
            transition: all 0.3s ease;
            border: none;
            text-align: center;
            flex-shrink: 0;
            position: relative;
        }

        .file-input-label:hover {
            background: #e5554a;
            box-shadow: 0 4px 12px rgba(255, 97, 84, 0.4);
            transform: translateY(-1px);
        }

        #upload-label.drag-over {
            background-color: #e5554a;
            transform: scale(1.05);
        }

        #upload-label {
           outline: none;
        }

        .upload-content {
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .upload-icon {
            position: absolute;
            width: 24px;
            height: 24px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .upload-text {
            font-size: 1.1rem;
            font-weight: 600;
            color: white;
            margin: 0;
            transition: opacity 0.3s ease;
            visibility: visible;
        }
        
        /* Show + icon on hover for "Add more" state */
        .file-input-label:hover .upload-icon {
            opacity: 1;
        }
        
        .file-input-label:hover .upload-text {
            opacity: 0;
            visibility: hidden;
        }

        .upload-subtext {
            display: none;
        }

        .upload-label-hidden {
            display: none !important;
        }

        /* Reset label styles inside fab */
        .fab-secondary[for="pdf-files"] {
            padding: 0;
            background: #f5f6f8;
            border: none;
            margin: 0;
            font-size: 0;
            cursor: pointer;
        }

        input[type="file"] {
            display: none;
        }
        
        #file-list {
            margin-top: 1.5rem;
            margin-bottom: 80px;
            width: 100%;
            justify-self: center;
            max-width: 100%;
            display: grid;
            gap: 12px;
            box-sizing: border-box;        
        }


        #file-list.columns-1 {
            grid-template-columns: 1fr;
            max-width: 600px;
            margin: 1.5rem auto 1rem auto;  
        }

        #file-list.columns-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));  
            max-width: 1100px;
            margin: 1.5rem auto 1rem auto;
            padding: 0 20px;                
        }

        #file-list.columns-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            max-width: 1100px;
            margin: 1.5rem auto 1rem auto;
            padding: 0 20px;
        }

        #file-list.columns-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            max-width: 1900px;
            margin: 1.5rem auto 1rem auto;
            padding: 0 20px;
        }

        #file-list.columns-single {
            grid-template-columns: 1fr;
            max-width: 600px;
            margin: 1.5rem auto 1rem auto;
        }

        #file-list.columns-grid {
            grid-template-columns: repeat(auto-fill, minmax(160px, 200px));
            max-width: 1200px;
            margin: 1.5rem auto 1rem auto;
            padding: 0 20px;
            gap: clamp(16px, 3vw, 40px);
        }

        /* Grid thumbnail item */
        .file-item.grid-thumb {
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 0;
            border: none;
            border-radius: 0;
            min-height: auto;
            background: transparent;
            box-shadow: none;
            gap: 6px;
            overflow: visible;
            transition: none;
            align-self: center;
        }

        .file-item.grid-thumb:hover {
            box-shadow: none;
            transform: none;
        }

        /* The PDF thumbnail card */
        .grid-thumb-card {
            position: relative;
            width: 100%;
            border-radius: 10px;
            background: #f8f9fa;
            border: 1.5px solid #e5e7eb;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
            transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
            padding: 8px;
        }

        .file-item.grid-thumb:hover .grid-thumb-card {
            border-color: #ff6154;
            box-shadow: 0 4px 12px rgba(255, 97, 84, 0.15);
            transform: translateY(-2px);
        }

        .grid-thumb-card .pdf-preview {
            width: 100%;
            height: auto;
            margin: 0;
            display: block;
            border-radius: 6px;
        }

        /* Name pill below thumbnail */
        .grid-thumb-name {
            font-size: 0.72rem;
            font-weight: 600;
            color: #374151;
            text-align: center;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding: 4px 10px;
            background: #f3f4f6;
            border-radius: 6px;
        }

        /* Grid thumb hover actions — bottom strip */
        .grid-thumb-actions {
            position: absolute;
            bottom: 8px;
            left: 8px;
            right: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            height: 0;
            overflow: hidden;
            border-radius: 0 0 6px 6px;
            background: rgba(255, 255, 255, 0.92);
            backdrop-filter: blur(4px);
            transition: height 0.18s ease;
            z-index: 2;
        }

        .file-item.grid-thumb:hover .grid-thumb-actions {
            height: 40px;
        }

        body.dragging .grid-thumb-actions {
            height: 0 !important;
            pointer-events: none !important;
        }

        .grid-thumb-actions .preview-button,
        .grid-thumb-actions .remove-file {
            width: 30px;
            height: 30px;
            padding: 0;
            border: none;
            border-radius: 8px;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            margin: 0;
            opacity: 1;
            pointer-events: auto;
            transition: background 0.15s ease;
            box-shadow: none;
        }

        .grid-thumb-actions .preview-button:hover {
            background: rgba(0, 0, 0, 0.06);
            transform: none;
        }

        .grid-thumb-actions .remove-file:hover {
            background: rgba(239, 68, 68, 0.1);
        }

        .grid-thumb-actions .preview-button svg,
        .grid-thumb-actions .remove-file svg {
            width: 15px;
            height: 15px;
            stroke: #6b7280;
            fill: none;
            transition: stroke 0.15s ease;
        }

        .grid-thumb-actions .preview-button:hover svg {
            stroke: #374151;
        }

        .grid-thumb-actions .remove-file:hover svg {
            stroke: #ef4444;
        }

        .grid-thumb-actions .file-actions-divider {
            display: block;
            width: 1px;
            height: 16px;
            background: #e5e7eb;
            flex-shrink: 0;
        }

        .file-item {
            display: flex;
            user-select: none;
            justify-content: space-between;
            padding: 6px;
            background-color: transparent;
            border: 3px solid;
            border-color: #ff6154;
            border-radius: 18px;
            cursor: grab;
            transition: box-shadow 0.3s ease;
            min-height: 80px;
            box-sizing: border-box;        
            overflow: hidden;              
            min-width: 0;                  
        }

        /* Responsive adjustments for grid */
        @media (max-width: 1400px) {
            #file-list.columns-4 {
                grid-template-columns: repeat(3, 1fr);
                max-width: 1200px;
            }
        }

        @media (max-width: 1100px) {
            #file-list.columns-3,
            #file-list.columns-4 {
                grid-template-columns: repeat(2, 1fr);
                max-width: 1000px;
            }
        }

        @media (max-width: 768px) {
            #file-list.columns-2,
            #file-list.columns-3,
            #file-list.columns-4 {
                grid-template-columns: 1fr;
                max-width: 600px;
            }
        }

        .file-item:hover {
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        #file-list {
            transition: opacity 0.3s ease;
        }

        #file-list.list-locked {
            opacity: 0.5;
            pointer-events: none;
        }

        .label-disabled {
            opacity: 0.4;
            pointer-events: none;
            cursor: not-allowed;
            transition: opacity 0.3s ease;
        }

        .fab-secondary,
        .file-input-label {
            transition: opacity 0.3s ease;
        }

        .file-info {
            display: flex;
            vertical-align: middle;
            overflow: hidden;
            flex: 1;                       
            min-width: 0;                  
        }

        .file-number {
            vertical-align: middle;
            margin-right: 8px;
            flex-shrink: 0;
            font-size: 20px;
            align-content: center;
            text-align: center;
            width: 24px;
            margin-left: 8px;
            color: #1f2937;
            font-weight: bold;
        }

        .file-details {
            display: flex;
            flex-direction: column;
            justify-content: center;
            flex: 1;                       
            min-width: 0;                  
            overflow: hidden;              
        }

        .file-name {
            font-size: 16px;
            white-space: nowrap;           
            overflow: hidden;              
            text-overflow: ellipsis;       
            max-width: 100%;               
            display: block;
            margin-right: 10px;
        }

        .file-size {
            font-size: 0.8rem;
            opacity: 0.5;
        }

        /* List mode action button wrapper */
        .file-actions {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-right: 8px;
            flex-shrink: 0;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.18s ease;
        }

        .file-item:hover .file-actions,
        .file-actions:has(.preview-button.loading) {
            opacity: 1;
            pointer-events: auto;
        }

        body.dragging .file-actions {
            opacity: 0 !important;
            pointer-events: none !important;
        }

        .preview-button,
        .remove-file {
            width: 34px;
            height: 34px;
            padding: 0;
            border: none;
            border-radius: 10px;
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 1;
            pointer-events: auto;
            transition: background 0.15s ease;
            flex-shrink: 0;
        }

        .preview-icon,
        .remove-icon {
            width: 16px;
            height: 16px;
            stroke: #9ca3af;
            flex-shrink: 0;
            transition: stroke 0.15s ease;
        }

        .preview-button:hover {
            background: rgba(0, 0, 0, 0.05);
            transform: none;
            box-shadow: none;
        }

        .preview-button:disabled,
        .remove-file:disabled {
            opacity: 0.35;
            cursor: not-allowed;
            pointer-events: none;
        }

        .preview-button:hover .preview-icon {
            stroke: #374151;
        }

        /* Preview button circular arc loading state */
        .preview-button.loading {
            pointer-events: none;
            position: relative;
            background: rgba(0, 0, 0, 0.05);
        }
        .preview-button.loading svg {
            opacity: 0;
        }
        /* Track ring */
        .preview-button.loading::before {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: conic-gradient(#e5e7eb 0deg, #e5e7eb 360deg);
            -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
        }
        /* Fill arc */
        .preview-button.loading::after {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: conic-gradient(#ff6154 0deg, #ff6154 var(--arc), transparent var(--arc));
            -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2.5px));
            animation: circularFillTo70 3s cubic-bezier(0.4, 0, 0.05, 1) forwards;
        }
        .preview-button.loading.ready::after {
            animation: circularFillTo100 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .grid-thumb-actions .preview-button.loading::before,
        .grid-thumb-actions .preview-button.loading::after {
            width: 13px;
            height: 13px;
        }
        @keyframes circularFillTo70 {
            0%   { --arc: 0deg; }
            40%  { --arc: 160deg; }
            70%  { --arc: 220deg; }
            100% { --arc: 252deg; }
        }
        @keyframes circularFillTo80 {
            0%   { --arc: 252deg; }
            100% { --arc: 288deg; }
        }
        @keyframes circularFillTo100 {
            0%   { --arc: 288deg; }
            100% { --arc: 360deg; }
        }

        .remove-file:hover {
            background: rgba(239, 68, 68, 0.08);
        }

        .remove-file:hover .remove-icon {
            stroke: #ef4444;
        }

        .file-actions-divider {
            width: 1px;
            height: 18px;
            background: #e5e7eb;
            flex-shrink: 0;
        }

        /* Preview modal styles */
        .preview-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: #f0f1f3;
            background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
            background-size: 22px 22px;
            z-index: 1000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 14px;
        }
        .preview-modal[style*="block"] {
            display: flex !important;
        }

        /* Top-right controls row */
        .modal-top-controls {
            position: fixed;
            top: 16px;
            right: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
            background: white;
            padding: 6px 8px 6px 12px;
            border-radius: 12px;
            box-shadow: 0 1px 6px rgba(0,0,0,0.10);
            z-index: 10;
        }

        .modal-preview-mode-label {
            font-size: 0.78rem;
            font-weight: 500;
            color: #6b7280;
            white-space: nowrap;
        }

        /* Toggle switch */
        .modal-toggle-switch {
            position: relative;
            width: 44px;
            height: 24px;
            background: #d1d5db;
            border-radius: 12px;
            cursor: pointer;
            transition: background 0.25s ease;
            flex-shrink: 0;
        }
        .modal-toggle-switch.active {
            background: #ff6154;
        }
        .modal-toggle-slider {
            position: absolute;
            top: 3px;
            left: 3px;
            width: 18px;
            height: 18px;
            background: white;
            border-radius: 50%;
            transition: transform 0.25s ease;
        }
        .modal-toggle-switch.active .modal-toggle-slider {
            transform: translateX(20px);
        }

        /* Divider between toggle and close */
        .modal-top-controls-sep {
            width: 1px;
            height: 18px;
            background: #e5e7eb;
            flex-shrink: 0;
        }

        /* Close button */
        .modal-close-btn {
            width: 30px;
            height: 30px;
            padding: 0;
            border: none;
            border-radius: 8px;
            background: #f3f4f6;
            color: #6b7280;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: none;
            transition: background 0.15s, color 0.15s;
            flex-shrink: 0;
        }
        .modal-close-btn:hover {
            background: #fee2e2;
            color: #ef4444;
            box-shadow: none;
            transform: none;
        }

        /* Scroll container */
        .pdf-preview-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            width: 100%;
            height: 100%;
            overflow-y: auto;
            padding: 48px 24px 40px;
            box-sizing: border-box;
        }

        /* Floating nav pill */
        .modal-nav-pill {
            display: flex;
            align-items: center;
            gap: 8px;
            background: white;
            border-radius: 10px;
            padding: 6px 8px;
            box-shadow: 0 1px 4px rgba(0,0,0,0.08);
            flex-shrink: 0;
            position: sticky;
            top: 0;
            z-index: 5;
        }

        .modal-nav-btn {
            width: 32px;
            height: 32px;
            padding: 0;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: #6b7280;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.2s, color 0.2s;
            box-shadow: none;
        }
        .modal-nav-btn:hover:not(:disabled) {
            background: #f3f4f6;
            color: #ff6154;
            box-shadow: none;
            transform: none;
        }
        .modal-nav-btn:disabled {
            opacity: 0.25;
            cursor: not-allowed;
        }
        .modal-nav-btn:disabled:hover {
            background: transparent;
            color: #6b7280;
            box-shadow: none;
            transform: none;
        }

        .modal-page-indicator {
            font-size: 0.85rem;
            font-weight: 600;
            color: #6b7280;
            min-width: 100px;
            text-align: center;
            font-variant-numeric: tabular-nums;
        }

        /* Canvas card */
        .modal-canvas-wrapper {
            background: white;
            border-radius: 6px;
            box-shadow: 0 2px 16px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
            overflow: hidden;
            line-height: 0;
            flex-shrink: 0;
        }

        #pdf-preview-canvas {
            display: block;
            max-width: min(640px, 90vw);
            max-height: calc(100vh - 180px);
            width: auto;
            height: auto;
        }

        /* Full mode: all pages stacked */
        .modal-full-area {
            justify-content: flex-start;
        }
        .modal-full-area.hidden { display: none !important; }

        .modal-full-page-wrapper {
            position: relative;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 16px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
            overflow: hidden;
            line-height: 0;
            flex-shrink: 0;
            width: min(640px, 90vw);
        }
        .modal-full-page-wrapper canvas {
            display: block;
            width: 100%;
            height: auto;
        }

        /* Button styles */
        button {
            padding: 12px 20px;
            background-color: #ff6154;
            color: white;
            border: none;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        button:hover {
            background: #e5554a;
            box-shadow: none;
            transform: none;
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            
        }

        
        /* Floating Action Bar */
        .floating-action-bar {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 90;
            display: flex;
            flex-direction: column;
            align-items: center;
            animation: fabSlideUp 0.4s cubic-bezier(0.32, 0.72, 0, 1) both;
        }

        @keyframes fabSlideUp {
            from { opacity: 0; transform: translateX(-50%) translateY(20px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }

        .fab-bar-row {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .fab-settings {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
            border: 1px solid rgba(0, 0, 0, 0.06);
        }

        .fab-inner {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
            border: 1px solid rgba(0, 0, 0, 0.06);
        }

        /* Segmented switch toggle */
        .fab-switch {
            display: inline-flex;
            background: #e5e7eb;
            border-radius: 9px;
            padding: 2px;
            gap: 2px;
        }

        .fab-switch-opt {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 34px;
            height: 34px;
            padding: 0;
            border: none;
            border-radius: 7px;
            background: transparent;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .fab-switch-opt svg {
            stroke: #9ca3af;
            transition: stroke 0.2s ease;
        }

        .fab-switch-opt.active {
            background: white;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        }

        .fab-switch-opt.active svg {
            stroke: #374151;
        }

        .fab-switch-opt:not(.active):hover svg {
            stroke: #6b7280;
        }

        .fab-switch-opt:hover {
            background: transparent;
        }

        .fab-switch-opt.active:hover {
            background: white;
        }

        .fab-switch.disabled {
            opacity: 0.4;
            pointer-events: none;
        }

        .fab-secondary {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 44px;
            height: 44px;
            padding: 0;
            background: #f5f6f8;
            color: #6b7280;
            border: none;
            border-radius: 11px;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .fab-secondary svg {
            stroke: #9ca3af;
            transition: all 0.2s;
        }

        .fab-secondary:hover {
            background: #eef0f3;
        }

        .fab-secondary:hover svg {
            stroke: #374151;
        }

        .fab-secondary:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

        .fab-secondary.loading {
            pointer-events: none;
            position: relative;
        }
        .fab-secondary.loading svg {
            opacity: 0;
        }
        /* Track ring */
        .fab-secondary.loading::before {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: conic-gradient(#e5e7eb 0deg, #e5e7eb 360deg);
            -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
        }
        /* Fill arc */
        .fab-secondary.loading::after {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: conic-gradient(#ff6154 0deg, #ff6154 var(--arc), transparent var(--arc));
            -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
            animation: circularFillTo70 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        .fab-secondary.loading.creeping::after {
            animation: circularFillTo80 2s ease-in-out forwards;
        }
        .fab-secondary.loading.ready::after {
            animation: circularFillTo100 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }

        .fab-primary {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 12px 20px;
            height: 44px;
            background: #ff6154;
            color: white;
            border: none;
            border-radius: 11px;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
            white-space: nowrap;
            letter-spacing: 0.01em;
            position: relative;
            overflow: hidden;
            flex-shrink: 0;
        }

        .fab-primary-arrow {
            stroke: white;
            transition: transform 0.2s ease;
            flex-shrink: 0;
        }

        .fab-primary:hover:not(:disabled) .fab-primary-arrow {
            transform: translateX(3px);
        }

        .fab-primary.loading {
            pointer-events: none;
            position: relative;
            background-color: #f3f4f6;
            box-shadow: none;
            transform: none;
        }
        .fab-primary.loading .fab-primary-text,
        .fab-primary.loading .fab-primary-arrow {
            visibility: hidden;
        }
        .fab-primary.loading::after {
            content: '';
            position: absolute;
            left: 20%;
            width: 60%;
            height: 3px;
            background: #e5e7eb;
            border-radius: 3px;
        }
        .fab-primary.loading::before {
            content: '';
            position: absolute;
            left: 20%;
            width: 0%;
            height: 3px;
            background: #ff6154;
            z-index: 1;
            border-radius: 3px;
            animation: fabLoadingFill 2s ease-out forwards;
        }
        @keyframes fabLoadingFill {
            0%   { width: 0%; }
            30%  { width: 30%; }
            50%  { width: 42%; }
            70%  { width: 50%; }
            85%  { width: 55%; }
            100% { width: 60%; }
        }

        .fab-divider {
            width: 1px;
            height: 24px;
            background: #d1d5db;
            flex-shrink: 0;
            margin: 0 4px;
        }

        .fab-primary:hover:not(:disabled) {
            background: #e5554a;
            box-shadow: 0 4px 16px rgba(255, 97, 84, 0.4);
        }

        .fab-primary:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        /* Progress bar styles */
        #progress-container {
            margin-top: 1.5rem;
            width: 100%;
            max-width: 510px;
            justify-self: center;
        }

        .progress-bar {
            width: 100%;
            height: 12px;
            background-color: transparent;
            border-radius: 20px;
            overflow: hidden;
        }

        #progress-bar {
            width: 0;
            height: 100%;
            background-color: #ff6154;
            transition: width 0.3s ease;
        }

        #progress-text {
            text-align: center;
            margin-top: 8px;
            font-size: 0.875rem;
            color: #6b7280;
        }

        /* Loading indicator for full preview */
        .loading-indicator {
            text-align: center;
            color: #000;
            margin: 20px 0;
        }

        /* Utility classes */
        .hidden {
            display: none;
        }

        /* Custom scrollbar styles */
        /* Custom scrollbar for PDF preview section (download screen) */
        .pdf-preview-section::-webkit-scrollbar {
            width: 6px;
        }

        .pdf-preview-section::-webkit-scrollbar-track {
            background: #f3f4f6;
        }

        .pdf-preview-section::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 10px;
        }

        .pdf-preview-section::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        /* Custom scrollbar for download actions section */
        .download-actions-section::-webkit-scrollbar {
            width: 6px;
        }

        .download-actions-section::-webkit-scrollbar-track {
            background: #f3f4f6;
        }

        .download-actions-section::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 10px;
        }

        .download-actions-section::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        /* Custom scrollbar for PDF preview container */
        .pdf-preview-container::-webkit-scrollbar {
            width: 6px;
        }

        .pdf-preview-container::-webkit-scrollbar-track {
            background: #f3f4f6;
        }

        .pdf-preview-container::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 10px;
        }

        .pdf-preview-container::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        /* Responsive adjustments */
        @media (max-width: 640px) {
            .container {
                padding: 20px;
            }

            h1 {
                font-size: 1.5rem;
            }

            .file-input-label {
                
            }

            .upload-icon {
                width: 32px;
                height: 32px;
            }

            .upload-text {
                font-size: 1.15rem;
            }

            .upload-subtext {
                font-size: 0.675rem;
            }

            .floating-action-bar {
                padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
            }

            .floating-action-bar {
                bottom: 16px;
            }

            .fab-primary {
                padding: 12px 24px;
                font-size: 0.88rem;
            }
        }

        /* Sortable ghost class */
        .ghost {
            opacity: 0.7;
            border: 2px dashed #ccc;
            color: #ccc;
            background: transparent;
        }

        .ghost .preview-button,
        .ghost .remove-file {
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* In grid thumb mode: suppress hover/active state on the ghost placeholder */
        #file-list.columns-grid .ghost .grid-thumb-card {
            border-color: transparent !important;
            box-shadow: none !important;
            transform: none !important;
        }

        #file-list.columns-grid .ghost .grid-thumb-actions {
            height: 0 !important;
        }

        /* Dragged element in grid thumb mode */
        #file-list.columns-grid .sortable-dragging .grid-thumb-card {
            border: 2px dashed #9ca3af !important;
            box-shadow: none !important;
            background: #f3f4f6 !important;
        }

        .pdf-preview {
            width: 50px;
            height: auto;
            margin-right: 10px;
        }

        .file-input-label.drag-over {
            border-color: #ff6154;
            background-color: #ff615405;
        }