/* 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 {
    display: flex;
    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;
}

.hidden {
            display: none !important;
        }

        body.selection-active {
            overflow-y: hidden;
        }

        body.download-active {
            height: calc(100vh - 81px);
            overflow-y: visible;
        }

        /* Container */
        .container {
            background-color: transparent;
            box-sizing: border-box;
            padding: 20px;
            border-radius: 16px;
            max-width: 1400px;
            width: 100%;
            margin: 0 auto 10px auto;
            overflow: visible;
        }

        /* Upload Area */
        .upload-area {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 1.5rem;
            gap: 12px;
            flex-wrap: wrap;
        }

        .file-input-label {
            display: inline-block;
            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;
        }

        .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-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;
        }

        .file-input-label:hover .upload-icon {
            opacity: 1;
        }

        .file-input-label:hover .upload-text {
            opacity: 0;
            visibility: hidden;
        }

        input[type="file"] {
            display: none;
        }

        /* Selection Panel */
        .selection-panel {
            margin-top: 0;
            background: transparent;
            border: none;
            padding: 0;
            box-shadow: none;
            position: fixed;
            top: 81px;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: calc(100vh - 81px);
        }

        .selection-content {
            display: flex;
            gap: 0;
            align-items: stretch;
            height: 100%;
            width: 100%;
            overflow: hidden;
            position: relative;
        }

        /* Left side - Pages Preview */
        .pages-preview-section {
            flex: 1;
            background: none;
            padding: 40px;
            display: flex;
            flex-direction: column;
            align-items: center;
            height: 100%;
            overflow-y: auto;
            margin-right: 450px;
            box-sizing: border-box;
        }

        .pages-header {
            margin-bottom: 32px;
            width: 100%;
            text-align: left;
        }

        .pages-header h2 {
            margin: 0 0 8px 0;
            font-size: 1.75rem;
            color: #1f2937;
            font-weight: 700;
        }

        .selection-subtitle {
            margin: 0;
            font-size: 1rem;
            color: #6b7280;
            font-weight: 400;
        }

        /* Preview Panel */
        .preview-panel {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 20px;
            width: 100%;
            margin-bottom: 40px;
        }

        .page-thumbnail-wrapper {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
        }

        .page-thumbnail {
            position: relative;
            border-radius: 12px;
            cursor: pointer;
            width: 100%;
            overflow: hidden;
            transition: all 0.3s ease;
            background: white;
            box-shadow: 0 8px 14px rgba(0, 0, 0, 0.10);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 0;
        }

        .page-thumbnail:hover {
            box-shadow: 0 12px 12px rgba(0, 0, 0, 0.18);
            transform: translateY(-4px);
        }

        .page-thumbnail.selected {
            box-shadow: 0 0 0 3px #ff6154, 0 8px 12px rgba(255, 97, 84, 0.4);
            transform: translateY(-4px);
        }

        .canvas-wrapper {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: visible;
        }

        .page-thumbnail canvas {
            display: block;
            transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
            transform-origin: center center;
        }

        .page-checkbox {
            position: absolute;
            top: 10px;
            left: 10px;
            width: 22px;
            height: 22px;
            cursor: pointer;
            border-radius: 4px;
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            border: 2px solid #d1d5db;
            background: white;
            transition: all 0.2s ease;
            z-index: 15;
        }

        .page-checkbox:checked {
            background: #ff6154;
            border-color: #ff6154;
        }

        .page-checkbox:checked::after {
            content: '';
            position: absolute;
            left: 6px;
            top: 2px;
            width: 5px;
            height: 10px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }

        /* Individual Rotation Controls */
        .rotation-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgb(255 97 84 / 9%);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            opacity: 0;
            transition: opacity 0.2s ease;
            pointer-events: none;
            z-index: 10;
            border-radius: 12px;
        }

        .page-thumbnail:hover .rotation-overlay {
            opacity: 1;
            pointer-events: all;
        }

        .rotate-icon {
            width: 48px;
            height: 48px;
            background: white;
            border: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .rotate-icon:hover {
            background: #ff6154;
            transform: scale(1.1);
        }

        .rotate-icon svg {
            width: 24px;
            height: 24px;
            stroke: #374151;
            transition: stroke 0.2s ease;
        }

        .rotate-icon:hover svg {
            stroke: white;
        }

        .thumbnail-label {
            text-align: center;
            font-size: 0.9rem;
            color: #374151;
            font-weight: 600;
        }

        .page-thumbnail.selected + .thumbnail-label {
            color: #ff6154;
        }

        /* Right side - Controls Panel */
        .controls-panel {
            position: fixed;
            right: 0;
            top: 81px;
            width: 450px;
            box-sizing: border-box;
            padding: 40px;
            height: calc(100vh - 81px);
            background: white;
            border-left: 2px solid #e5e7eb;
            box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
            z-index: 100;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }

        .control-section-bottom {
            margin-top: auto;
            padding-top: 24px;
        }

        .page-count-badge {
            background: none;
            color: #000;
            padding: 0;
            margin-top: 10px;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 24px;
            justify-content: left;
        }

        .page-count-badge svg {
            width: 20px;
            height: 20px;
            stroke: #ff6154;
        }

        /* Control Sections */
        .control-section {
            margin-bottom: 28px;
        }

        .control-section:last-of-type:not(.control-section-bottom) {
            margin-bottom: 0;
        }

        .control-section-title {
            font-size: 0.75rem;
            font-weight: 600;
            color: #9ca3af;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin: 0 0 14px 0;
        }

        .control-group-vertical {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .btn-control-full {
            width: 100%;
            background: white;
            color: #374151;
            border: 1.5px solid #e5e7eb;
            padding: 12px 16px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .btn-control-full:hover {
            background: #fff5f4;
            border-color: #ff6154;
            color: #ff6154;
        }

        .btn-control-full svg {
            width: 16px;
            height: 16px;
            stroke: currentColor;
            flex-shrink: 0;
        }

        /* Rotation Section - Centered */
        .rotation-section {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .rotation-section .control-section-title {
            text-align: center;
            width: 100%;
        }

        /* Rotate Actions - Horizontal */
        .rotate-actions-horizontal {
            display: flex;
            gap: 12px;
            justify-content: center;
            width: 100%;
        }

        .btn-rotate-icon {
            flex: 1;
            max-width: 120px;
            padding: 16px 12px;
            border: 1.5px solid #e5e7eb;
            border-radius: 12px;
            cursor: pointer;
            font-size: 0.8rem;
            font-weight: 500;
            transition: all 0.2s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            background: white;
            color: #374151;
        }

        .btn-rotate-icon:hover:not(:disabled) {
            background: #fff5f4;
            border-color: #ff6154;
            color: #ff6154;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 97, 84, 0.15);
        }

        .btn-rotate-icon:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .btn-rotate-icon svg {
            width: 24px;
            height: 24px;
            stroke: currentColor;
            flex-shrink: 0;
        }

        /* Toggle Option */
        .toggle-option {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 16px;
            background: white;
            border: 1.5px solid #e5e7eb;
            border-radius: 10px;
        }

        .toggle-label {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .toggle-title {
            font-size: 0.9rem;
            font-weight: 500;
            color: #1f2937;
        }

        .toggle-desc {
            font-size: 0.75rem;
            color: #9ca3af;
        }

        .toggle-switch {
            position: relative;
            width: 44px;
            height: 24px;
            flex-shrink: 0;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #d1d5db;
            transition: 0.3s;
            border-radius: 26px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 18px;
            width: 18px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: 0.3s;
            border-radius: 50%;
        }

        .toggle-switch input:checked + .toggle-slider {
            background-color: #ff6154;
        }

        .toggle-switch input:checked + .toggle-slider:before {
            transform: translateX(20px);
        }

        /* Extract Button Style (matching compress) */
        .btn-extract {
            width: 100%;
            padding: 18px 24px;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 16px;
            text-align: left;
        }

        .btn-extract.single {
            background-color: #ff6154;
            color: white;
        }

        .btn-extract:hover:not(:disabled) {
            background: #e5554a;
            box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
            transform: translateY(-2px);
        }

        .btn-extract:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .btn-extract svg {
            width: 24px;
            height: 24px;
            stroke: currentColor;
            flex-shrink: 0;
        }

        /* Spinner - hidden by default, shown on loading */
        .btn-spinner {
            width: 0;
            height: 20px;
            border: 2.5px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            flex-shrink: 0;
            opacity: 0;
            transition: opacity 0.2s ease, width 0.2s ease, margin 0.2s ease;
            margin-right: -16px;
        }

        .btn-extract.btn-loading .btn-spinner {
            width: 20px;
            opacity: 1;
            margin-right: 0;
            animation: spinner 0.6s linear infinite;
        }

        .btn-extract.btn-loading {
            pointer-events: none;
            opacity: 0.8;
        }

        /* Arrow icon on the right */
        .btn-arrow {
            width: 24px;
            height: 24px;
            stroke: white;
            flex-shrink: 0;
            margin-left: auto;
            transition: transform 0.2s ease;
        }

        .btn-extract:hover .btn-arrow {
            transform: translateX(4px);
        }

        .btn-extract.btn-loading .btn-arrow {
            display: none;
        }

        @keyframes spinner {
            to { transform: rotate(360deg); }
        }

        .btn-extract-content {
            display: flex;
            flex-direction: column;
            gap: 4px;
            flex: 1;
        }

        .btn-extract-title {
            font-size: 1rem;
            font-weight: 700;
        }

        .btn-extract-desc {
            font-size: 0.8rem;
            opacity: 0.8;
            font-weight: 400;
        }

        /* Download Screen */
        .download-screen {
            display: none;
            padding: 0;
            max-width: 100%;
            margin: 0;
            min-height: calc(100vh - 81px);
            background: #f8f9fa;
        }

        .download-screen.active.visible {
            display: block;
        }

        .download-content {
            display: flex;
            width: 100%;
            min-height: calc(100vh - 81px);
        }

        /* Left side - PDF Preview */
        .pdf-preview-section {
            flex: 1;
            background: #f8f9fa;
            padding: 40px;
            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%;
            background: transparent;
            border-radius: 0;
            box-shadow: none;
            overflow: visible;
            margin-bottom: 20px;
            max-width: 700px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .preview-page-wrapper {
            background: white;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
            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;
            z-index: 10;
        }

        /* Right side - Actions */
        .download-actions-section {
            position: fixed;
            right: 0;
            top: 81px;
            width: 420px;
            height: calc(100vh - 81px);
            background: white;
            border-left: 2px solid #e5e7eb;
            display: flex;
            flex-direction: column;
            padding: 40px;
            overflow-y: auto;
            box-sizing: border-box;
            box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
        }

        .back-button {
            background: transparent;
            color: #6b7280;
            border: none;
            padding: 12px 20px;
            font-size: 0.95rem;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 24px;
            font-weight: 500;
            position: absolute;
            margin-top: -10px;
            left: 10px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .back-button:hover {
            background: none;
            color: #ff6154;
            box-shadow: none;
            transform: translateX(-2px);
            border-radius: 8px;
        }

        .back-button svg {
            width: 18px;
            height: 18px;
        }

        #download-files-list {
            margin-top: 50px;
            margin-bottom: 24px;
        }

        /* Single File Card */
        .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 {
            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;
        }

        .single-file-info {
            font-size: 0.7rem;
            color: #9ca3af;
        }

        .single-file-name-row {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .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;
        }

        .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;
        }

        /* 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: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
        }

        .download-primary:hover {
            background: #e5554a;
            box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
            transform: translateY(-2px);
        }

        .download-primary svg {
            width: 20px;
            height: 20px;
            stroke: white;
            fill: none;
        }

        /* Another Button */
        .extract-another-btn {
            width: 100%;
            padding: 14px 32px;
            background: transparent;
            color: #ff6154;
            border: 2px solid #ff6154;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-top: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .extract-another-btn:hover {
            background: #fff5f4;
            box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
        }

        .another-btn-text {
            transition: opacity 0.25s ease;
        }

        .another-btn-arrow {
            position: absolute;
            opacity: 0;
            transition: opacity 0.25s ease;
        }

        .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);
        }

        @keyframes sheetSlideUp {
            from { opacity: 0; transform: translateY(100%); }
            to { opacity: 1; transform: translateY(0); }
        }

        .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 modalFadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes modalSlideUp {
            from { opacity: 0; transform: translateY(16px) scale(0.97); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        /* Hide elements */
        .content-hidden {
            display: none !important;
        }

        /* Scrollbars */
        .controls-panel::-webkit-scrollbar,
        .pages-preview-section::-webkit-scrollbar,
        .pdf-preview-section::-webkit-scrollbar,
        .download-actions-section::-webkit-scrollbar {
            width: 6px;
        }

        .controls-panel::-webkit-scrollbar-track,
        .pages-preview-section::-webkit-scrollbar-track,
        .pdf-preview-section::-webkit-scrollbar-track,
        .download-actions-section::-webkit-scrollbar-track {
            background: #f3f4f6;
        }

        .controls-panel::-webkit-scrollbar-thumb,
        .pages-preview-section::-webkit-scrollbar-thumb,
        .pdf-preview-section::-webkit-scrollbar-thumb,
        .download-actions-section::-webkit-scrollbar-thumb {
            background: #d1d5db;
            border-radius: 10px;
        }

        .controls-panel::-webkit-scrollbar-thumb:hover,
        .pages-preview-section::-webkit-scrollbar-thumb:hover,
        .pdf-preview-section::-webkit-scrollbar-thumb:hover,
        .download-actions-section::-webkit-scrollbar-thumb:hover {
            background: #9ca3af;
        }

        /* Responsive */
        @media (max-width: 1200px) {
            .controls-panel,
            .download-actions-section {
                width: 380px;
            }
            
            .pages-preview-section,
            .pdf-preview-section {
                margin-right: 380px;
            }
        }

        @media (max-width: 968px) {
            body.selection-active {
                overflow-y: auto;
            }

            .selection-panel {
                position: relative;
                height: auto;
                min-height: calc(100vh - 81px);
            }

            .selection-content {
                flex-direction: column;
                height: auto;
            }

            .controls-panel {
                position: relative;
                width: 100%;
                height: auto;
                top: 0;
                border-left: none;
                border-bottom: 2px solid #e5e7eb;
                order: 1;
                padding: 20px 24px;
            }

            .pages-preview-section {
                margin-right: 0;
                height: auto;
                order: 2;
                padding: 32px 24px;
                overflow-y: visible;
            }
            
            .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: 2px solid #e5e7eb;
            }
            
            .pdf-preview-section {
                margin-right: 0;
                padding: 100px 20px 20px 20px;
                height: auto;
                min-height: 50vh;
            }
        }

        @media (max-width: 768px) {
            .preview-panel {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                gap: 16px;
            }
            
            .rotate-icon {
                width: 40px;
                height: 40px;
            }
            
            .rotate-icon svg {
                width: 20px;
                height: 20px;
            }
        }