/* View Toggle Group */
.view-toggle-group {
    display: flex;
    gap: 8px;
    background: #f7f8f9;
    padding: 4px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
}

.view-toggle-btn {
    flex: 1;
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.view-toggle-btn:hover {
    color: #374151;
}

.view-toggle-btn.active {
    background: white;
    color: #ff6154;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sort Options - Primary Actions */
.primary-sort-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.primary-sort-btn {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}

.primary-sort-btn:hover {
    border-color: #ff6154;
    background: linear-gradient(135deg, #fff5f4 0%, #fff 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 97, 84, 0.12);
}

.sort-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sort-icon-wrapper.ascending {
    background: linear-gradient(135deg, #ff6154a6 0%, #ff6154 100%)
}

.sort-icon-wrapper.descending {
    background: linear-gradient(135deg, #ff6154 0%, #ff6154a6 100%);
}

.sort-icon-wrapper svg {
    width: 22px;
    height: 22px;
    stroke: white;
}

.primary-sort-btn:hover .sort-icon-wrapper {
    transform: scale(1.1);
}

.sort-btn-content {
    flex: 1;
    text-align: left;
}

.sort-btn-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px;
}

.sort-btn-desc {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.arrow-svg {
    width: 14px;
    height: 14px;
    stroke: #9ca3af;
    flex-shrink: 0;
}

/* Secondary Sort Options */
.secondary-sort-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.secondary-sort-btn {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 75px;
}

.secondary-sort-btn svg {
    width: 20px;
    height: 20px;
    stroke: #6b7280;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.secondary-sort-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s ease;
}

.secondary-sort-btn:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.secondary-sort-btn:hover svg {
    stroke: #374151;
}

.secondary-sort-btn:hover span {
    color: #374151;
}

.secondary-sort-btn.reset-btn:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.secondary-sort-btn.reset-btn:hover svg {
    stroke: #ff6154;
}

.secondary-sort-btn.reset-btn:hover span {
    color: #ff6154;
}.hidden {
    display: none !important;
}

svg {
    fill: none;
}

body {
    overflow-x: hidden;
}

body.download-active {
    height: calc(100vh - 81px);
    overflow-y: visible;
}

body.reorder-active {
    overflow-y: hidden;
}

.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-label {
    outline: none;
}

.upload-content {
    text-align: center;
}

.upload-icon {
    display: none;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

input[type="file"] {
    display: none;
}

/* 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;
}

/* Reorder Panel - Split View Layout */
.reorder-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);
}

.reorder-content {
    display: flex;
    gap: 0;
    align-items: stretch;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* Left side - Pages */
.pages-reorder-section {
    flex: 1;
    background: none;
    padding: 45px;
    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;
}

.reorder-subtitle {
    margin: 0;
    font-size: 1rem;
    color: #6b7280;
    font-weight: 400;
}

/* Page Count Badge */
.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;
}

/* Pages Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    width: 100%;
    margin-bottom: 40px;
}

/* Dynamic sizing for fewer pages */
.pages-grid[data-page-count="1"] {
    grid-template-columns: repeat(1, minmax(220px, 300px));
    justify-content: center;
}

.pages-grid[data-page-count="2"] {
    grid-template-columns: repeat(2, minmax(200px, 280px));
    justify-content: center;
}

.pages-grid[data-page-count="3"] {
    grid-template-columns: repeat(3, minmax(180px, 240px));
    justify-content: center;
}

.pages-grid[data-page-count="4"] {
    grid-template-columns: repeat(4, minmax(170px, 220px));
    justify-content: center;
}

.pages-grid.list-view {
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Page Thumbnail Wrapper (Contains buttons + card + label) */
.page-thumbnail-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.page-thumbnail-wrapper.sortable-chosen .page-item {
    box-shadow: 0 0 0 3px #ff6154, 0 8px 12px rgba(255, 97, 84, 0.4);
    transform: translateY(-4px);
}

.page-thumbnail-wrapper.sortable-ghost {
    opacity: 0.4;
}

/* Buttons Container - Positioned outside on the top */
.page-buttons-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.page-thumbnail-wrapper:hover .page-buttons-container {
    opacity: 1;
}

/* Hide buttons when dragging - on dragged item and all other items */
.sortable-chosen .page-buttons-container,
.sortable-ghost .page-buttons-container,
.dragging .page-buttons-container {
    opacity: 0 !important;
}

/* Hide all buttons when any drag is happening */
.pages-grid.sortable-drag .page-buttons-container {
    opacity: 0 !important;
}

/* Page Item */
.page-item {
    position: relative;
    border-radius: 12px;
    cursor: grab;
    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;
    flex-direction: column;
    align-items: center;
}

.page-item:active {
    cursor: grabbing;
}

.page-item:hover {
    box-shadow: 0 12px 12px rgba(0, 0, 0, 0.18);
    transform: translateY(-4px);
}

.page-item canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Drag Handle */
.drag-handle {
    width: 36px;
    height: 36px;
    background: #ff6154;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.2s ease;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

.drag-handle:hover {
    background: #e5554a;
    transform: scale(1.1);
}

/* Delete Button */
.delete-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.delete-btn svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

.delete-btn:hover {
    background: #ff3b30;
    transform: scale(1.1);
}

/* Page Label - Pill Badge (Outside the card) */
.page-label {
    padding: 6px 16px;
    text-align: center;
    font-size: 0.85rem;
    color: #374151;
    font-weight: 600;
    background: #f3f4f6;
    border-radius: 20px;
    border: none;
    display: inline-block;
}

/* List View Styles */
.pages-grid.list-view .page-thumbnail-wrapper {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.pages-grid.list-view .page-buttons-container {
    position: relative;
    left: 0;
    top: 0;
    flex-direction: row;
    gap: 8px;
    order: -1;
}

.pages-grid.list-view .page-thumbnail-wrapper:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: #e5e7eb;
}

.pages-grid.list-view .page-thumbnail-wrapper.sortable-chosen {
    border-color: #ff6154;
    box-shadow: 0 8px 16px rgba(255, 97, 84, 0.25);
    transform: translateY(-2px);
}

.pages-grid.list-view .page-thumbnail-wrapper.sortable-ghost {
    opacity: 0.4;
}

.pages-grid.list-view .page-item {
    width: 120px;
    height: 160px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: white;
    transition: none;
    border: 1px solid #e5e7eb;
}

.pages-grid.list-view .page-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: none;
}

.pages-grid.list-view .page-item canvas {
    border-radius: 8px;
    object-fit: cover;
}

.pages-grid.list-view .drag-handle,
.pages-grid.list-view .delete-btn {
    width: 32px;
    height: 32px;
}

.pages-grid.list-view .page-label {
    flex: 1;
    text-align: left;
    padding: 10px 18px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 0.95rem;
    border: 1px solid #e5e7eb;
}

.pages-grid.list-view .drag-handle {
    position: relative;
    top: 0;
    left: 0;
    order: -1;
}

.pages-grid.list-view .delete-btn {
    position: relative;
    top: 0;
    right: 0;
}

/* 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;
}

.controls-sticky {
}

/* 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: 12px 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 */
.controls-divider {
    height: 2px;
    background: linear-gradient(to right, #e5e7eb 0%, #e5e7eb 50%, transparent 50%);
    background-size: 8px 2px;
    margin: 24px 0;
}

/* Save Actions */
.save-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-save {
    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-save:hover:not(:disabled) {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
    transform: translateY(-2px);
}

.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-save svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    flex-shrink: 0;
}

.btn-save-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.btn-save-title {
    font-size: 1rem;
    font-weight: 700;
}

.btn-save-desc {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

/* 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 Styles */
.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;
}

.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;
    cursor: pointer;
}

.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;
}

.preview-page-info {
    color: #374151;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* 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;
}

/* File Card Container */
#file-card-container {
    margin-top: 50px;
    margin-bottom: 24px;
}

/* Single File Card */
.single-file-card {
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.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-primary-full {
    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;
    margin-bottom: 16px;
}

.download-primary-full:hover {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
    transform: translateY(-2px);
}

.download-primary-full 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;
}

#print-action,
#delete-action {
    flex: 1;
}

.action-button:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.action-button svg {
    width: 24px;
    height: 24px;
    stroke: #6b7280;
}

.action-button:hover svg {
    stroke: #ff6154;
}

/* Merge Another Button */
.merge-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;
}

.merge-another:hover {
    background: #fff5f4;
    box-shadow: 0 4px 12px rgba(255, 97, 84, 0.2);
}

/* Hide elements when showing download screen */
.content-hidden {
    display: none !important;
}

/* Custom scrollbar */
/* Apply to specific scrollable containers only */
.controls-panel::-webkit-scrollbar,
.pages-reorder-section::-webkit-scrollbar,
.pdf-preview-section::-webkit-scrollbar,
.download-actions-section::-webkit-scrollbar,
.preview-canvas-container::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track,
.pages-reorder-section::-webkit-scrollbar-track,
.pdf-preview-section::-webkit-scrollbar-track,
.download-actions-section::-webkit-scrollbar-track,
.preview-canvas-container::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.controls-panel::-webkit-scrollbar-thumb,
.pages-reorder-section::-webkit-scrollbar-thumb,
.pdf-preview-section::-webkit-scrollbar-thumb,
.download-actions-section::-webkit-scrollbar-thumb,
.preview-canvas-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.controls-panel::-webkit-scrollbar-thumb:hover,
.pages-reorder-section::-webkit-scrollbar-thumb:hover,
.pdf-preview-section::-webkit-scrollbar-thumb:hover,
.download-actions-section::-webkit-scrollbar-thumb:hover,
.preview-canvas-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .controls-panel {
        width: 380px;
    }
    
    .pages-reorder-section {
        margin-right: 380px;
    }
    
    .download-actions-section {
        width: 380px;
    }
    
    .pdf-preview-section {
        margin-right: 380px;
    }
    
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 968px) {
    body.reorder-active {
        overflow-y: auto;
    }
    
    .reorder-panel {
        position: relative;
        height: auto;
        min-height: calc(100vh - 81px);
    }
    
    .reorder-content {
        flex-direction: column;
        height: auto;
    }
    
    .controls-panel {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        border-left: none;
        border-bottom: 2px solid #e5e7eb;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    }
    
    .controls-sticky {
        padding: 32px 24px;
    }
    
    .pages-reorder-section {
        margin-right: 0;
        height: auto;
        order: 2;
        padding: 32px 24px;
        overflow-y: visible;
    }
    
    .controls-panel {
        order: 1;
    }
    
    .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;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    }
    
    .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) {
    .container {
        padding: 16px;
    }
    
    .pages-reorder-section {
        padding: 24px 16px 40px 16px;
        min-height: auto;
    }
    
    .pages-header {
        margin-bottom: 24px;
    }
    
    .pages-header h2 {
        font-size: 1.5rem;
    }
    
    .reorder-subtitle {
        font-size: 0.9rem;
    }
    
    .controls-sticky {
        padding: 24px 16px;
    }
    
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .pdf-preview-section {
        padding: 80px 16px 24px 16px;
    }
    
    .download-actions-section {
        padding: 24px 16px;
    }
    
    .back-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .pages-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .page-count-badge {
        font-size: 0.9rem;
        padding: 12px 16px;
    }
    
    .control-section-title {
        font-size: 0.95rem;
    }
    
    .btn-control-full {
        font-size: 0.9rem;
        padding: 11px 16px;
    }
    
    .btn-save {
        padding: 14px 16px;
    }
    
    .btn-save-title {
        font-size: 0.95rem;
    }
    
    .btn-save-desc {
        font-size: 0.75rem;
    }
}