.hidden {
    display: none !important;
}

svg {
    fill: none;
}

body {
    overflow-x: hidden;
}

body.download-active {
    height: calc(100vh - 81px);
    overflow-y: visible;
}

body.selection-active {
    overflow-y: hidden;
}

/* 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;
}

/* 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-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;
}

/* File Selection Modal */
.file-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.file-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.file-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.file-modal-overlay.active .file-modal {
    transform: scale(1) translateY(0);
}

.file-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-modal-close:hover {
    background: #fee2e2;
}

.file-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: #6b7280;
}

.file-modal-close:hover svg {
    stroke: #ef4444;
}

.file-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    text-align: center;
}

.file-modal-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0 0 32px 0;
    text-align: center;
}

.file-modal-content {
    display: flex;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 32px;
}

.file-select-box {
    flex: 1;
    position: relative;
}

.file-select-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: #f8f9fa;
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 180px;
    text-align: center;
}

.file-select-label:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.file-select-label.has-file {
    display: none;
}

.file-select-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-select-icon svg {
    width: 24px;
    height: 24px;
    stroke: #ff6154;
}

.file-select-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.file-select-hint {
    font-size: 0.85rem;
    color: #9ca3af;
}

.file-select-preview {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 180px;
    position: relative;
}

.file-select-preview canvas {
    max-width: 100%;
    max-height: 100px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.file-select-info {
    text-align: center;
}

.file-select-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-select-size {
    font-size: 0.8rem;
    color: #6b7280;
}

.file-select-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-select-remove:hover {
    background: #fee2e2;
}

.file-select-remove svg {
    width: 14px;
    height: 14px;
    stroke: #6b7280;
}

.file-select-remove:hover svg {
    stroke: #ef4444;
}

.file-modal-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
}

.file-modal-vs span {
    font-size: 1.1rem;
    font-weight: 700;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 10px 14px;
    border-radius: 50%;
}

.file-modal-confirm {
    width: 100%;
    padding: 16px 32px;
    background: #ff6154;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.file-modal-confirm:hover:not(:disabled) {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
    transform: translateY(-2px);
}

.file-modal-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-modal-confirm svg {
    width: 20px;
    height: 20px;
}

/* Selection Panel - Split View Layout */
.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 - Files Preview */
.files-preview-section {
    flex: 1;
    background: #f8f9fa;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
    margin-right: 450px;
    box-sizing: border-box;
}

.dual-preview-container {
    display: flex;
    align-items: stretch;
    gap: 24px;
    max-width: 800px;
    width: 100%;
}

.file-preview-card {
    flex: 1;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
}

.file-preview-card:hover {
    border-color: #ff6154;
    box-shadow: 0 8px 24px rgba(255, 97, 84, 0.12);
}

.file-preview-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-preview-badge.original {
    background: #3b82f6;
    color: white;
}

.file-preview-badge.modified {
    background: #10b981;
    color: white;
}

.file-preview-thumbnail {
    width: 100%;
    max-width: 160px;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-preview-thumbnail canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

.file-preview-details {
    width: 100%;
}

.file-preview-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    word-break: break-word;
    line-height: 1.4;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 auto;
}

.file-preview-size {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.preview-vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-vs-divider span {
    font-size: 1.25rem;
    font-weight: 700;
    color: #9ca3af;
    background: white;
    padding: 12px 16px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.file-change-btn {
    background: transparent;
    border: 2px solid #e5e7eb;
    color: #6b7280;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.file-change-btn:hover {
    border-color: #ff6154;
    color: #ff6154;
    background: #fff5f4;
}

.file-change-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* 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;
}

.control-section {
    margin-bottom: 24px;
}

.control-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.controls-divider {
    height: 2px;
    background: linear-gradient(to right, #e5e7eb 0%, #e5e7eb 50%, transparent 50%);
    background-size: 8px 2px;
    margin: 24px 0;
}

/* View Mode Options */
.view-mode-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.view-mode-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.view-mode-option:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.view-mode-option.active {
    border-color: #ff6154;
    background: linear-gradient(135deg, rgba(255, 97, 84, 0.08) 0%, rgba(255, 97, 84, 0.04) 100%);
}

.view-mode-icon {
    width: 44px;
    height: 44px;
    background: #f3f4f6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.view-mode-option.active .view-mode-icon {
    background: #ff6154;
}

.view-mode-icon svg {
    width: 22px;
    height: 22px;
    stroke: #6b7280;
}

.view-mode-option.active .view-mode-icon svg {
    stroke: white;
}

.view-mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.view-mode-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.view-mode-desc {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Toggle Option */
.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.toggle-option.compact {
    padding: 12px 16px;
    background: white;
    border: 2px solid #e5e7eb;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.toggle-desc {
    font-size: 0.8rem;
    color: #6b7280;
}

.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);
}

/* Legend */
.legend-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #374151;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.added {
    background: rgba(16, 185, 129, 0.3);
    border: 2px solid #10b981;
}

.legend-color.removed {
    background: rgba(239, 68, 68, 0.3);
    border: 2px solid #ef4444;
}

.legend-color.changed {
    background: rgba(245, 158, 11, 0.3);
    border: 2px solid #f59e0b;
}

/* Extract Actions */
.extract-actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-extract {
    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: 16px;
    text-align: left;
}

.btn-extract.single {
    background-color: #ff6154;
    color: white;
}

.btn-extract.single: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;
}

.btn-extract svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    flex-shrink: 0;
}

.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;
}

.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/Comparison 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);
}

.pdf-preview-section {
    flex: 1;
    background: #f8f9fa;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin-right: 420px;
    height: calc(100vh - 81px);
    box-sizing: border-box;
}

/* Comparison Toolbar */
.comparison-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 50;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #6b7280;
}

.toolbar-btn:hover {
    background: white;
    color: #ff6154;
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.zoom-level {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    min-width: 50px;
    text-align: center;
}

.change-navigator {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 8px;
}

.nav-change-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-change-btn:hover:not(:disabled) {
    border-color: #ff6154;
    color: #ff6154;
}

.nav-change-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-change-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.change-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #374151;
    font-weight: 500;
}

.change-badge {
    background: #f59e0b;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.export-btn {
    width: auto;
    padding: 8px 16px;
    gap: 6px;
    background: #1f2937;
    color: white;
    border-radius: 8px;
}

.export-btn:hover {
    background: #374151;
    color: white;
}

.export-btn span {
    font-size: 0.85rem;
    font-weight: 600;
}

.comparison-preview-wrapper {
    flex: 1;
    width: 100%;
    padding: 24px;
    overflow-y: auto;
}

.preview-canvas-container {
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 0;
}

/* Side by Side View */
.side-by-side-view {
    display: flex;
    gap: 24px;
    width: 100%;
}

.comparison-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.column-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.column-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.column-badge.original {
    background: #3b82f6;
    color: white;
}

.column-badge.modified {
    background: #10b981;
    color: white;
}

.column-filename {
    font-size: 0.85rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-canvas-container {
    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;
}

/* Overlay View */
.overlay-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
}

.overlay-canvas-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    max-width: 100%;
}

.overlay-canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

.overlay-slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 400px;
    padding: 16px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.slider-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.overlay-slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(to right, #3b82f6 0%, #3b82f6 50%, #10b981 50%, #10b981 100%);
    border-radius: 4px;
    outline: none;
}

.overlay-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Download Actions Section */
.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: 24px;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
    gap: 20px;
}

.back-button {
    background: transparent;
    color: #6b7280;
    border: none;
    padding: 8px 0;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.back-button:hover {
    color: #ff6154;
    transform: translateX(-2px);
}

.back-button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Summary Card */
.summary-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.summary-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

.summary-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-status.identical {
    background: #10b98115;
    color: #10b981;
}

.summary-status.minor {
    background: #fef3c7;
    color: #d97706;
}

.summary-status.moderate {
    background: #fed7aa;
    color: #ea580c;
}

.summary-status.major {
    background: #fee2e2;
    color: #dc2626;
}

.summary-status.different {
    background: #f59e0b15;
    color: #f59e0b;
}

.summary-stats {
    padding: 20px;
}

.summary-stat.main {
    text-align: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.summary-stat.main .stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: #f59e0b;
    line-height: 1;
}

.summary-stat.main .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-icon {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.detail-icon.added {
    background: #10b981;
}

.detail-icon.removed {
    background: #ef4444;
}

.detail-icon.modified {
    background: #f59e0b;
}

.detail-label {
    flex: 1;
    font-size: 0.9rem;
    color: #374151;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
}

.summary-meta {
    display: flex;
    border-top: 1px solid #e5e7eb;
}

.meta-item {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
}

.meta-item:first-child {
    border-right: 1px solid #e5e7eb;
}

.meta-label {
    display: block;
    font-size: 0.7rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

/* Changes List Section */
.changes-list-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
    margin: 0 0 12px 0;
}

.section-title svg {
    width: 16px;
    height: 16px;
    stroke: #6b7280;
}

.changes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.empty-changes {
    text-align: center;
    padding: 24px;
    color: #9ca3af;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-changes svg {
    width: 40px;
    height: 40px;
    stroke: #10b981;
    opacity: 0.6;
}

.change-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.change-item:hover {
    border-color: #ff6154;
    transform: translateX(4px);
}

.change-item.active {
    border-color: #ff6154;
    background: #fff5f4;
}

.change-page-num {
    width: 32px;
    height: 32px;
    background: #f59e0b;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.change-info {
    flex: 1;
    min-width: 0;
}

.change-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
}

.change-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

.change-arrow {
    width: 16px;
    height: 16px;
    stroke: #9ca3af;
    flex-shrink: 0;
}

.change-item-page {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.change-item-page .page-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
}

.change-type {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.change-type.modified {
    background: #fef3c7;
    color: #d97706;
}

.change-type.added {
    background: #d1fae5;
    color: #059669;
}

.change-type.removed {
    background: #fee2e2;
    color: #dc2626;
}

.change-item-arrow {
    width: 16px;
    height: 16px;
    stroke: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.change-item:hover .change-item-arrow {
    stroke: #ff6154;
    transform: translateX(4px);
}

/* View Options Section */
.view-options-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
}

.view-options-section .view-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.view-options-section .view-mode-btn {
    flex: none;
    padding: 12px 16px;
    justify-content: flex-start;
    gap: 12px;
}

.view-options-section .view-mode-btn span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.view-options-section .view-mode-btn.active span {
    color: white;
}

.view-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
}

.view-mode-btn:hover {
    border-color: #ff6154;
    background: #fff5f4;
}

.view-mode-btn.active {
    background: #ff6154;
    border-color: #ff6154;
    color: white;
}

.view-mode-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.view-mode-btn.active svg {
    stroke: white;
}

.view-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

/* Export Modal */
.export-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.export-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.export-modal-overlay.hidden {
    display: none;
}

.export-modal {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.export-modal h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

.export-desc {
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    color: #6b7280;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #fee2e2;
}

.modal-close svg {
    width: 18px;
    height: 18px;
    stroke: #6b7280;
}

.modal-close:hover svg {
    stroke: #ef4444;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.export-option {
    cursor: pointer;
}

.export-option input {
    display: none;
}

.export-option .option-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.export-option input:checked + .option-content {
    background: #fff5f4;
    border-color: #ff6154;
}

.option-icon {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-icon svg {
    width: 22px;
    height: 22px;
    stroke: #ff6154;
}

.option-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: block;
}

.option-desc {
    font-size: 0.8rem;
    color: #6b7280;
}

.export-actions {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    flex: 1;
    padding: 14px 24px;
    background: transparent;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: #ff6154;
    color: #ff6154;
}

.btn-primary {
    flex: 2;
    padding: 14px 24px;
    background: #ff6154;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #e5554a;
    box-shadow: 0 6px 16px rgba(255, 97, 84, 0.4);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-primary .btn-spinner,
.btn-spinner.active {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
    display: inline-block;
}

/* Extract Another Button */
.extract-another-btn {
    width: 100%;
    padding: 14px 32px;
    background: transparent;
    color: #ff6154;
    border: 2px solid #ff6154;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: auto;
}

.extract-another-btn: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;
}

/* Scrollbar Styling */
.controls-panel::-webkit-scrollbar,
.files-preview-section::-webkit-scrollbar,
.pdf-preview-section::-webkit-scrollbar,
.download-actions-section::-webkit-scrollbar,
.preview-canvas-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.controls-panel::-webkit-scrollbar-track,
.files-preview-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,
.files-preview-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,
.files-preview-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 */
@media (max-width: 1200px) {
    .controls-panel {
        width: 380px;
    }

    .files-preview-section {
        margin-right: 380px;
    }

    .download-actions-section {
        width: 380px;
    }

    .pdf-preview-section {
        margin-right: 380px;
    }

    .dual-preview-container {
        flex-direction: column;
        max-width: 350px;
    }

    .preview-vs-divider {
        padding: 8px 0;
    }
}

@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;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
        order: 1;
    }

    .files-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;
        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;
    }

    .side-by-side-view {
        flex-direction: column;
    }

    .file-modal-content {
        flex-direction: column;
    }

    .file-modal-vs {
        padding: 12px 0;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .files-preview-section {
        padding: 24px 16px 40px 16px;
        min-height: auto;
    }

    .controls-panel {
        padding: 24px 16px;
    }

    .pdf-preview-section {
        padding: 80px 16px 24px 16px;
    }

    .download-actions-section {
        padding: 24px 16px;
    }

    .file-modal {
        padding: 24px;
    }

    .dual-preview-container {
        gap: 16px;
    }
}
