@import url('https://fonts.googleapis.com/css2?family=Cherry+Bomb+One&display=swap');

/**
 * Professional PDF Processor Styles
 * Modern, accessible, and responsive design
 * Version: 2.0.0
 */

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f7f9fb;
  min-height: 100vh;
}

/* Page Header Styles */
.page-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0;
}

.page-title {
  font-family: 'Cherry Bomb One', system-ui, sans-serif;
  color: var(--title-color, #1B4B4B);
  font-size: 2.5rem;
  margin: 0 0 1rem 0;
  letter-spacing: 0.5px;
}

.page-description {
  color: var(--muted, #666666);
  font-size: 1.1rem;
  margin: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* PDF Annotation Layer Styles */
.pdf-annotation-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.pdf-annotation-layer.interactive {
  pointer-events: auto;
}

.pdf-ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}

.pdf-text-annotation {
  position: absolute;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.pdf-text-annotation:hover {
  background-color: rgba(0, 122, 204, 0.1) !important;
}

.pdf-annotation-selector {
  position: absolute;
  border: 2px solid #007acc;
  background: rgba(0, 122, 204, 0.1);
  pointer-events: none;
  z-index: 15;
}

.pdf-text-editor {
  position: absolute;
  background: white;
  border: 2px solid #007acc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 200px;
}

/* Toast Notification Styles */
.toast-container {
  position: fixed;
  top: 80px; /* Just below the header */
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #10b981;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  max-width: 400px;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: auto;
  font-weight: 500;
  font-size: 0.9rem;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.error {
  background: #ef4444;
}

.toast.warning {
  background: #f59e0b;
}

.toast.info {
  background: #3b82f6;
}

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: background-color 0.2s ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Container and Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

main {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Header */
.header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Content Area */
.content {
  padding: 2rem;
}

/* Section Styling */
section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

section h2 {
  color: #1e293b;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section h2::before {
  content: '';
  width: 4px;
  height: 20px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 2px;
}

/* Upload Section */
.upload-section {
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.upload-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.upload-header h2 {
  margin-bottom: 0;
}

#drop-area {
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 10px;
  background: white;
  border: 2px dashed #cbd5e1;
  position: relative;
}

.file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.file-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #e0f2fe;
  color: #0277bd;
  padding: 0.25rem 0.5rem;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid #b3e5fc;
  transition: all 0.3s ease;
}

.file-tag:hover {
  background: #b3e5fc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(2, 119, 189, 0.2);
}

.file-tag-number {
  background: #0277bd;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.file-tag-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tag-remove {
  background: none;
  border: none;
  color: #0277bd;
  cursor: pointer;
  padding: 1px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 12px;
  line-height: 1;
  transition: all 0.3s ease;
}

.file-tag-remove:hover {
  background: #0277bd;
  color: white;
}

#drop-area:hover,
#drop-area:focus-within {
  border-color: #4f46e5;
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.1);
}

#drop-area.drag-over {
  border-color: #10b981;
  background: #f0fdf4;
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.upload-icon {
  width: 64px;
  height: 64px;
  color: #6b7280;
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.file-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.file-info {
  font-size: 0.9rem;
  color: #6b7280;
  padding: 0.5rem 1rem;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-weight: 500;
  transition: all 0.3s ease;
  min-width: 200px;
  text-align: left;
}

.file-info.has-files {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

#drop-area:hover .upload-icon {
  color: #4f46e5;
}

.upload-text h3 {
  font-size: 1.25rem;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.upload-text p {
  color: #6b7280;
  margin-bottom: 1.5rem;
}

.browse-link {
  color: #4f46e5;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.3s ease;
}

.browse-link:hover {
  color: #3730a3;
  text-decoration: none;
  background: rgba(79, 70, 229, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
}

.browse-link:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Upload Footer */
.upload-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Merge Button */
.merge-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.merge-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.merge-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.merge-button svg {
  width: 20px;
  height: 20px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.modal-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #1f2937;
}

.file-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: white;
  border: 2px solid;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Color-specific file label styles (avoiding green and red) */
.file-label.file-color-0 {
  border-color: #3b82f6;
  background: #eff6ff;
}

.file-label.file-color-0 .file-color-dot {
  background-color: #3b82f6;
}

.file-label.file-color-1 {
  border-color: #8b5cf6;
  background: #faf5ff;
}

.file-label.file-color-1 .file-color-dot {
  background-color: #8b5cf6;
}

.file-label.file-color-2 {
  border-color: #f59e0b;
  background: #fffbeb;
}

.file-label.file-color-2 .file-color-dot {
  background-color: #f59e0b;
}

.file-label.file-color-3 {
  border-color: #06b6d4;
  background: #f0fdfa;
}

.file-label.file-color-3 .file-color-dot {
  background-color: #06b6d4;
}

.file-label.file-color-4 {
  border-color: #ec4899;
  background: #fdf2f8;
}

.file-label.file-color-4 .file-color-dot {
  background-color: #ec4899;
}

.file-label.file-color-5 {
  border-color: #6366f1;
  background: #eef2ff;
}

.file-label.file-color-5 .file-color-dot {
  background-color: #6366f1;
}

.file-label.file-color-6 {
  border-color: #0ea5e9;
  background: #f0f9ff;
}

.file-label.file-color-6 .file-color-dot {
  background-color: #0ea5e9;
}

.file-label.file-color-7 {
  border-color: #a855f7;
  background: #faf5ff;
}

.file-label.file-color-7 .file-color-dot {
  background-color: #a855f7;
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.modal-body {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto;
}

.preview-info {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f0f9ff;
  border-radius: 8px;
  border: 1px solid #bae6fd;
}

.preview-info p {
  margin: 0;
  color: #0369a1;
  font-weight: 500;
}

/* Pages Container */
.pages-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  align-items: flex-start;
}

/* Plus button for inserting pages */
.page-insert-zone {
  width: 30px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 0.25rem;
}

.page-insert-plus {
  width: 20px;
  height: 20px;
  background: #9ca3af;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.page-insert-zone.drag-over .page-insert-plus {
  background: #1f2937;
  transform: scale(1.2);
}

.page-insert-zone:hover .page-insert-plus {
  background: #6b7280;
}

.page-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.5rem;
  text-align: center;
  cursor: move;
  transition: all 0.3s ease;
  position: relative;
  user-select: none;
  width: 120px;
  height: 180px;
  display: flex;
  flex-direction: column;
}

.page-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  transform: translateY(-2px);
}

.page-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

/* Color-coded page cards for different files (avoiding green and red) */
.page-card.file-color-0 {
  border-color: #3b82f6;
  background: #eff6ff;
}

.page-card.file-color-1 {
  border-color: #8b5cf6;
  background: #faf5ff;
}

.page-card.file-color-2 {
  border-color: #f59e0b;
  background: #fffbeb;
}

.page-card.file-color-3 {
  border-color: #06b6d4;
  background: #f0fdfa;
}

.page-card.file-color-4 {
  border-color: #ec4899;
  background: #fdf2f8;
}

.page-card.file-color-5 {
  border-color: #6366f1;
  background: #eef2ff;
}

.page-card.file-color-6 {
  border-color: #0ea5e9;
  background: #f0f9ff;
}

.page-card.file-color-7 {
  border-color: #a855f7;
  background: #faf5ff;
}

/* Edited page indicator */
.page-card.page-edited {
  position: relative;
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
}

.page-card.page-edited::after {
  content: "✓ Edited";
  position: absolute;
  top: 4px;
  right: 4px;
  background: #10b981;
  color: white;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: bold;
  z-index: 2;
}

.updating-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.2rem;
  color: #0ea5e9;
  background: #f0f9ff;
  border-radius: 4px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.page-preview {
  width: 100%;
  flex: 1;
  background: #f8f9fa;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #e9ecef;
}

.page-preview canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2rem;
  color: #9ca3af;
}

.page-number {
  font-size: 0.7rem;
  font-weight: bold;
  color: #374151;
  margin-top: 0.25rem;
  text-align: center;
}

.page-file {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.page-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.page-remove:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Modal Footer */
.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
  text-align: center;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

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

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  background: white;
  padding: 3rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

.loading-content h3 {
  margin: 0 0 0.5rem 0;
  color: #1f2937;
  font-size: 1.5rem;
}

.loading-content p {
  margin: 0;
  color: #6b7280;
}

/* Download Section Updates */
.download-section {
  background: white;
  margin-top: 2rem;
}

.download-content {
  text-align: center;
}

.compression-options h3 {
  margin-bottom: 1rem;
  color: #1f2937;
  font-size: 1.1rem;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  margin-top: 1.5rem;
  text-decoration: none;
}

.download-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.download-button svg {
  width: 20px;
  height: 20px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(50px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 1rem;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
  
  .pages-container {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }
  
  .upload-footer {
    flex-direction: column;
    text-align: center;
  }
  
  .merge-button {
    width: 100%;
    justify-content: center;
  }
}

/* File List */
.file-section {
  background: white;
}

#file-list {
  min-height: 100px;
}

.no-files {
  text-align: center;
  color: #6b7280;
  padding: 2rem;
  font-style: italic;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: move;
}

.file-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.file-item.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.file-drag-handle {
  color: #9ca3af;
  margin-right: 1rem;
  cursor: grab;
  font-size: 1.2rem;
  line-height: 1;
}

.file-drag-handle:active {
  cursor: grabbing;
}

.file-icon {
  font-size: 2rem;
  margin-right: 1rem;
}

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

.file-name {
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.file-details {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.file-ranges {
  margin-top: 0.5rem;
}

.page-range-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.3s ease;
}

.page-range-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.page-range-input.invalid {
  border-color: #ef4444;
  background: #fef2f2;
}

.page-range-input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.file-actions {
  margin-left: 1rem;
}

.btn-icon {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  line-height: 1;
}

.btn-icon:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Stats */
#file-stats {
  padding: 1rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-weight: 500;
  color: #475569;
  text-align: center;
}

/* Compression Options */
.compression-options {
  background: white;
}

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.radio-option {
  flex: 1;
  min-width: 200px;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-option label {
  display: block;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.radio-option label:hover {
  border-color: #4f46e5;
  background: #f8fafc;
}

.radio-option input[type="radio"]:checked + label {
  border-color: #4f46e5;
  background: #ede9fe;
  color: #4f46e5;
  font-weight: 600;
}

.radio-option .option-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.radio-option .option-description {
  font-size: 0.875rem;
  color: #6b7280;
}

.radio-option .option-size {
  font-size: 0.875rem;
  color: #4f46e5;
  font-weight: 600;
  margin-top: 0.5rem;
}

/* Progress Section */
.progress-section {
  background: white;
  display: none;
}

.progress-bar-container {
  background: #f1f5f9;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #10b981);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

#progress-text {
  text-align: center;
  color: #475569;
  font-weight: 500;
}

/* Actions */
.actions-section {
  background: white;
  text-align: center;
}

.actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.actions button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.actions button.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.actions button.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.actions button.secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.actions button.secondary:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Download Section */
.download-section {
  background: white;
  text-align: center;
  display: none;
}

.download-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: #10b981;
}

#download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Status Messages */
.status-message {
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-weight: 500;
  display: none;
}

.status-message.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.status-message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.status-message.error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

/* Footer: inherit global site styles; avoid overriding color */

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .header {
    padding: 1.5rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .content {
    padding: 1rem;
  }
  
  section {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  #drop-area {
    padding: 2rem 1rem;
  }
  
  .file-item {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .file-drag-handle {
    align-self: center;
    margin-right: 0;
  }
  
  .radio-group {
    flex-direction: column;
  }
  
  .actions {
    flex-direction: column;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus States */
button:focus,
input:focus,
[tabindex]:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .file-item {
    border-width: 2px;
  }
  
  .radio-option label {
    border-width: 3px;
  }
}

/* Loading States */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  to {
    left: 100%;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-item {
  animation: fadeIn 0.3s ease;
}

/* Drag and Drop Visual Feedback */
.drag-over {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Full-screen page preview */
.page-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  cursor: pointer;
}

.page-fullscreen-content {
  max-width: 35vw;
  max-height: 35vh;
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* REMOVED: editing-mode class - no longer needed */

.page-fullscreen-content canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* REMOVED: edit-page-btn - no longer needed */

/* REMOVED: edit-page-btn:hover - no longer needed */

/* REMOVED: PDF Editor Interface styles - no longer needed for simplified merge tool */

/* Format Support Section */
.format-support {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.format-support h3 {
  margin: 0 0 1rem 0;
  color: #495057;
  font-size: 1.1rem;
  font-weight: 600;
}

.format-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.format-category {
  padding: 1rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  text-align: center;
}

.format-category h4 {
  margin: 0 0 0.5rem 0;
  color: #343a40;
  font-size: 0.9rem;
  font-weight: 600;
}

.format-category span {
  color: #6c757d;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Conversion Settings */
.conversion-options {
  margin-bottom: 2rem;
}

.conversion-options h3 {
  margin: 0 0 1rem 0;
  color: #495057;
  font-size: 1.1rem;
  font-weight: 600;
}

.settings-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.setting-option {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-option label {
  font-weight: 500;
  color: #495057;
  font-size: 0.9rem;
}

.setting-option select {
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: white;
  font-size: 0.9rem;
  color: #495057;
}

.setting-option select:focus {
  outline: none;
  border-color: #007acc;
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.25);
}

/* Download section styling */
.download-info {
  margin-top: 10px;
  text-align: center;
}

.download-info small {
  color: #666;
  font-style: italic;
  display: block;
  padding: 8px;
  background: rgba(0, 120, 212, 0.1);
  border-radius: 4px;
  border-left: 3px solid #0078d4;
}
