.hidden {
            display: none !important;
        }

        body.selection-active {
            overflow-y: hidden;
        }

        body.download-active {
            height: calc(100vh - 81px);
            overflow-y: visible;
        }

        /* Hero */
        .hero {
            text-align: center;
            padding: 60px 20px 40px;
            background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
        }

        .hero h1 {
            font-size: 2.5rem;
            font-weight: 700;
            color: #1f2937;
            margin-bottom: 16px;
        }

        .hero p {
            font-size: 1.1rem;
            color: #6b7280;
            max-width: 600px;
            margin: 0 auto;
        }

        /* 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-text {
            font-size: 1.1rem;
            font-weight: 600;
            color: white;
            margin: 0;
        }

        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: 10px;
            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;
            max-width: 700px;
            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;
            max-width: 700px;
            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: inline-block;
            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);
        }

        .page-thumbnail canvas {
            width: 100%;
            height: auto;
            display: block;
            justify-self: center;
            transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .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.2);
        }

        .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;
            padding-top: 20px;
            padding-bottom: 0;
            height: calc(100vh - 81px);
            background: white;
            border-left: 2px solid #e5e7eb;
            box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
            overflow-y: auto;
            z-index: 100;
        }

        .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: 24px;
        }

        .control-section-title {
            font-size: 1rem;
            font-weight: 700;
            color: #1f2937;
            margin: 0 0 12px 0;
        }

        .control-group-vertical {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .btn-control-full {
            width: 100%;
            background: #f7f8f9;
            color: #374151;
            border: 2px solid #e5e7eb;
            padding: 14px 20px;
            border-radius: 12px;
            cursor: pointer;
            font-size: 0.95rem;
            font-weight: 600;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .btn-control-full:hover {
            background: #fff5f4;
            border-color: #ff6154;
            color: #ff6154;
        }

        .btn-control-full svg {
            width: 18px;
            height: 18px;
            stroke: currentColor;
            flex-shrink: 0;
        }

        .controls-divider {
            height: 2px;
            background: linear-gradient(to right, #e5e7eb 0%, #e5e7eb 50%, transparent 50%);
            background-size: 8px 2px;
            margin: 24px 0;
        }

        /* Rotate Actions */
        .rotate-actions-vertical {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .btn-rotate {
            width: 100%;
            padding: 16px 20px;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 14px;
            text-align: left;
            background-color: #ff6154;
            color: white;
        }

        .btn-rotate:hover:not(:disabled) {
            background: #e5554a;
            box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
            transform: translateY(-2px);
        }

        .btn-rotate:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .btn-rotate svg {
            width: 24px;
            height: 24px;
            stroke: currentColor;
            flex-shrink: 0;
        }

        .btn-rotate-content {
            display: flex;
            flex-direction: column;
            gap: 4px;
            flex: 1;
        }

        .btn-rotate-title {
            font-size: 1rem;
            font-weight: 700;
        }

        .btn-rotate-desc {
            font-size: 0.8rem;
            opacity: 0.8;
            font-weight: 400;
        }

        /* Apply Button - Make it stand out */
        #process-btn {
            background: #10b981;
            padding: 22px 24px;
            margin-top: 8px;
            box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
        }

        #process-btn:hover:not(:disabled) {
            background: #059669;
            box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
            transform: translateY(-2px);
        }

        #process-btn .btn-rotate-title {
            font-size: 1.1rem;
        }

        #process-btn svg {
            width: 28px;
            height: 28px;
        }

        /* Loading State */
        .loading-preview {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 60px 40px;
            color: #6b7280;
            grid-column: 1 / -1;
        }

        .loading-spinner {
            width: 48px;
            height: 48px;
            border: 4px solid #e5e7eb;
            border-radius: 50%;
            border-top-color: #ff6154;
            animation: spin 0.8s linear infinite;
            margin-bottom: 20px;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .loading-preview p {
            font-size: 1rem;
            font-weight: 500;
        }

        /* Download Screen */
        .download-screen {
            display: none;
            padding: 0;
            max-width: 100%;
            margin: 0;
            min-height: calc(100vh - 81px);
            background: #f8f9fa;
        }

        .download-screen.active {
            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: 450px;
            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: 450px;
            height: calc(100vh - 81px);
            background: white;
            border-left: 2px solid #e5e7eb;
            display: flex;
            flex-direction: column;
            padding: 40px 32px;
            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;
        }

        /* Single File Card */
        .single-file-card {
            background: #f8f9fa;
            border: 2px solid #e5e7eb;
            border-radius: 16px;
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 16px;
            margin-top: 50px;
            margin-bottom: 24px;
        }

        .single-file-icon {
            width: 48px;
            height: 48px;
            background: white;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
        }

        .single-file-icon svg {
            width: 28px;
            height: 28px;
            stroke: #ff6154;
            fill: none;
        }

        .single-file-details {
            flex: 1;
            text-align: left;
            min-width: 0;
        }

        .single-file-name {
            font-size: 1rem;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .single-file-info {
            font-size: 0.875rem;
            color: #6b7280;
        }

        .done-button {
            background: #10b981;
            color: white;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 0.875rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .done-button svg {
            width: 16px;
            height: 16px;
            stroke: white;
            fill: none;
        }

        /* Download Button */
        .download-button-wrapper {
            position: relative;
            margin-bottom: 16px;
        }

        .download-primary {
            width: 100%;
            padding: 16px 32px;
            font-size: 1.1rem;
            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;
        }

        .download-primary svg {
            width: 20px;
            height: 20px;
            stroke: white;
            fill: none;
        }

        /* Action buttons */
        .action-buttons-grid {
            display: flex;
            gap: 10px;
            justify-content: flex-start;
            margin-top: -6px;
            margin-bottom: 10px;
        }

        .action-button {
            background: #f7f8f9;
            border: none;
            color: #374151;
            padding: 12px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
            width: 48px;
            height: 48px;
            flex: 1;
        }

        #share-action {
            flex: 2;
        }

        .action-button:hover {
            border-color: #ff6154;
            background: #fff5f4;
        }

        .action-button svg {
            width: 24px;
            height: 24px;
            fill: none;
            stroke: #6b7280;
        }

        .action-button:hover svg {
            stroke: #ff6154;
        }

        /* Rotate Another Button */
        .rotate-another {
            background: transparent;
            color: #ff6154;
            border: 2px solid #ff6154;
            width: 100%;
            padding: 14px 32px;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .rotate-another:hover {
            background: #fff5f4;
            box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
        }

        /* 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;
            }
            
            .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;
            }
        }