body {
  font-family: system-ui, arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #ffffff;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

h1 {
  text-align: center;
}

.intro-section {
  text-align: center;
  margin: 30px 0;
}

.intro-section h1 {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
}

.subheading {
  font-size: 16px;
  color: #444;
  margin-bottom: 12px;
}

.upload-wrapper-box {
  background-color: #d5f7ff80;
  padding: 5px;
  border-radius: 10px;
  margin: 0 auto;
  box-sizing: border-box;
}

.drop-zone {
  width: 100%;
  min-height: 230px;
  border: 2px dashed #0078d5;
  background: transparent;
  border-radius: 0;
  padding: 1rem;
  cursor: pointer;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: all 0.3s ease;
}

.drop-zone:hover {
  background: #e8f7ff;
}

.upload-ui {
  margin-bottom: 0;
  text-align: center;
}

.upload-button {
  color: white;
  font-size: 26px;
  padding: 10px 28px;
  text-decoration: none;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: all .2s ease-out;
  display: block;
  background-color: #ff6411;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
}

.upload-button:hover {
  background-color: #e55a0f;
  transform: translateY(-2px);
}

.upload-button:active {
  transform: translateY(0);
}

input[type="file"] {
  display: none;
}

.drag-hint {
  margin-top: 10px;
  font-size: 14px;
  color: #555;
  font-style: italic;
}

.preview-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 1rem;
  width: 100%;
  padding: 10px;
  min-height: 200px;
}

/* Thumbnail Container */
.thumb-container {
  position: relative;
  width: 160px;
  margin: 10px 5px;
  transition: all 0.3s ease;
}

.thumb-box {
  width: 140px;
  height: 190px;
  border: 3px solid #ccc;
  border-radius: 8px;
  background: white;
  text-align: center;
  padding: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  cursor: grab;
  user-select: none;
  margin: 0 auto;
}

.thumb-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.thumb-box img,
.thumb-box canvas {
  width: 100%;
  height: 130px;
  object-fit: contain;
  border-radius: 4px;
}

.thumb-box p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #333;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* Color borders for different PDF files */
.thumb-box.pdf-color-1 { border-color: #FF6B6B; }
.thumb-box.pdf-color-2 { border-color: #4ECDC4; }
.thumb-box.pdf-color-3 { border-color: #45B7D1; }
.thumb-box.pdf-color-4 { border-color: #96CEB4; }
.thumb-box.pdf-color-5 { border-color: #FFEAA7; }
.thumb-box.pdf-color-6 { border-color: #DDA0DD; }
.thumb-box.pdf-color-7 { border-color: #98D8C8; }
.thumb-box.pdf-color-8 { border-color: #F7DC6F; }
.thumb-box.pdf-color-9 { border-color: #BB8FCE; }
.thumb-box.pdf-color-10 { border-color: #85C1E9; }

/* Horizontal Plus Buttons Between Thumbnails */
.plus-btn-horizontal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #28a745;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 20;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.plus-btn-left {
  left: -16px;
}

.plus-btn-right {
  right: -16px;
}

.thumb-container:hover .plus-btn-horizontal {
  opacity: 1;
}

.plus-btn-horizontal:hover {
  background: #218838;
  transform: translateY(-50%) scale(1.1);
}

/* Action Buttons on Thumbnail */
.remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(117, 116, 116, 0.9);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.remove-btn:hover {
  background: #d33a2c;
  transform: scale(1.1);
}

.eye-btn {
  position: absolute;
  top: 5px;
  right: 32px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
  z-index: 10;
}
.eye-btn:hover {
  background: #00b7ff;
}

.file-name-label {
  font-size: 10px;
  color: #666;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
  font-style: italic;
}

/* Initial Upload Area */
.initial-plus-container {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  border: 2px dashed #0078d5;
  border-radius: 10px;
  background: #f8fdff;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 20px 0;
}

.initial-plus-container:hover {
  background: #e8f7ff;
  border-color: #0056b3;
}

.large-plus-button {
  font-size: 48px;
  color: #0078d5;
  margin-bottom: 10px;
  line-height: 1;
}

.plus-text {
  font-size: 16px;
  color: #555;
}

/* Drag and Drop Styles */
.dragging {
  opacity: 0.6;
  transform: rotate(5deg);
}

#previewBox,
#previewBox * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

.thumb-box:active,
.dragging {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

.merge-button-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  margin-bottom: 20px;
}

.intro-banner {
  width: 100px;
  height: auto;
  margin-bottom: -20px;
}

#mergeBtn {
  color: white;
  font-size: 22px;
  padding: 12px 35px;
}

#mergeBtn:disabled {
  background-color: #aaa !important;
  cursor: not-allowed;
  opacity: 0.7;
}

#downloadBtn {
  font-size: 24px;
  background-color: #41b14f;
  background-image: linear-gradient(#9ec14c, #41b14f);
  color: #fff;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .25);
  box-shadow: 0 4px #2d8f39;
  position: relative;
  display: inline-block;
  border-radius: 11px;
  text-align: center;
  text-decoration: none;
  border: none;
  outline: 0;
  top: -2px;
  transition: top .1s ease-in-out, box-shadow .1s ease-in-out;
  padding: 12px 30px;
  margin-top: 15px;
}

#downloadBtn:hover {
  background: #41b14f;
  top: 0;
  box-shadow: 0 2px #2d8f39;
}

#downloadBtn:active {
  outline: 3px dotted red;
  outline-offset: 2px;
  background: #41b14f;
  transform: translateY(5px);
  box-shadow: 0 0 0 #0056b3;
  box-shadow: 0 4px #2d8f39;
  box-shadow: inset 0 3px 3px rgba(0, 0, 0, .3);
}

:focus {
  outline: 3px dotted red;
  outline-offset: 2px;
}

/* Status and Processing */
.processing-card {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  margin: 30px auto;
  max-width: 500px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  background-color: #ffffff;
  border-bottom: 1px solid #ddd;
  font-family: sans-serif;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 18px;
  color: #111;
}

.logo img {
  width: 20px;
  height: 20px;
}

/* ========================================= */
/* ENHANCED PDF PREVIEW MODAL STYLES */
/* ========================================= */

.pdf-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 20, 20, 0.98); /* Increased opacity */
  z-index: 10000;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: modalSlideIn 0.3s ease-out;
}

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

.pdf-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #1a1a1a;
  border-bottom: 1px solid #404040;
  color: white;
  min-height: 60px;
  box-sizing: border-box;
  width: 100%;
}

.pdf-preview-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
}

.page-count {
  font-size: 14px;
  color: #ccc;
  font-weight: normal;
}

.pdf-preview-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  justify-content: center;
}

.control-btn {
  background: #404040;
  border: none;
  border-radius: 6px;
  color: white;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.control-btn:hover {
  background: #505050;
  transform: translateY(-1px);
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.view-controls-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Centered Page Info */
.page-info-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 14px;
  background: #404040;
  border-radius: 6px;
  padding: 4px 12px;
}

.page-input {
  width: 50px;
  background: #2c2c2c;
  border: 1px solid #505050;
  border-radius: 4px;
  color: white;
  padding: 4px 8px;
  text-align: center;
  font-size: 14px;
}

.page-input:focus {
  outline: none;
  border-color: #007acc;
}

.num-pages {
  color: #ccc;
}

.close-btn {
  background: rgba(239, 68, 68, 0.8);
  margin-left: auto;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 1);
}

/* Enhanced PDF Preview with Transparent Background */
.pdf-preview-content {
  flex: 1;
  display: flex;
  overflow: hidden;
  width: 100%;
  height: calc(100vh - 60px);
}

.pdfViewer {
  flex: 1;
  background: transparent !important;
  overflow: auto;
  position: relative;
  width: 100%;
}

.pdfViewer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
  padding: 20px;
  background: transparent;
  width: 100%;
}

.pdf-canvas {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: transparent;
  margin: 0 auto;
  display: block;
  border-radius: 8px;
  max-width: 95%;
  max-height: 95%;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 1200px) {
  .container {
    max-width: 95%;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .intro-section {
    margin: 20px 0;
  }
  
  .intro-section h1 {
    font-size: 24px;
  }
  
  .subheading {
    font-size: 14px;
    padding: 0 10px;
  }
  
  .upload-wrapper-box {
    padding: 3px;
  }
  
  .drop-zone {
    min-height: 180px;
    padding: 0.5rem;
  }
  
  .upload-button {
    font-size: 20px;
    padding: 8px 20px;
  }
  
  .drag-hint {
    font-size: 12px;
  }
  
  .preview-container {
    gap: 8px;
    padding: 5px;
    min-height: 150px;
  }
  
  .thumb-container {
    width: 120px;
    margin: 5px 2px;
  }
  
  .thumb-box {
    width: 100px;
    height: 140px;
    padding: 6px;
  }
  
  .thumb-box img,
  .thumb-box canvas {
    height: 90px;
  }
  
  .thumb-box p {
    font-size: 11px;
    margin: 4px 0 0;
  }
  
  .file-name-label {
    font-size: 9px;
  }
  
  .plus-btn-horizontal {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  
  .plus-btn-left {
    left: -12px;
  }
  
  .plus-btn-right {
    right: -12px;
  }
  
  .remove-btn, .eye-btn {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  .eye-btn {
    right: 26px;
    padding: 2px 4px;
  }
  
  .merge-button-wrapper {
    margin-top: 20px;
  }
  
  #mergeBtn {
    font-size: 18px;
    padding: 10px 25px;
  }
  
  .processing-card {
    padding: 20px;
    margin: 20px auto;
  }
  
  .main-header {
    padding: 10px 20px;
  }
  
  .logo {
    font-size: 16px;
  }
  
  /* PDF Preview Mobile Optimizations */
  .pdf-preview-header {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    min-height: auto;
  }
  
  .pdf-preview-title {
    font-size: 14px;
    order: 1;
    flex: 1;
  }
  
  .pdf-preview-controls {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
    gap: 8px;
  }
  
  .view-controls-group {
    order: 1;
    width: auto;
  }
  
  .control-btn {
    width: 36px;
    height: 36px;
  }
  
  .page-input {
    width: 40px;
    font-size: 12px;
  }
  
  .pdfViewer-container {
    padding: 10px;
  }
  
  .pdf-preview-content {
    padding-top: 120px;
    height: calc(100vh - 120px);
  }
  
  .page-info-center {
    padding: 4px 8px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 5px;
  }
  
  .intro-section h1 {
    font-size: 20px;
  }
  
  .subheading {
    font-size: 12px;
  }
  
  .drop-zone {
    min-height: 150px;
  }
  
  .upload-button {
    font-size: 18px;
    padding: 6px 16px;
  }
  
  .preview-container {
    gap: 5px;
  }
  
  .thumb-container {
    width: 100px;
  }
  
  .thumb-box {
    width: 85px;
    height: 120px;
  }
  
  .thumb-box img,
  .thumb-box canvas {
    height: 70px;
  }
  
  .thumb-box p {
    font-size: 10px;
  }
  
  .file-name-label {
    font-size: 8px;
  }
  
  .pdf-preview-controls {
    gap: 8px;
  }
  
  .view-controls-group {
    gap: 6px;
  }
  
  .page-info-center {
    gap: 4px;
    padding: 3px 6px;
  }
}

/* Scrollbar styling */
.pdfViewer::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.pdfViewer::-webkit-scrollbar-track {
  background: #404040;
}

.pdfViewer::-webkit-scrollbar-thumb {
  background: #606060;
  border-radius: 4px;
}

.pdfViewer::-webkit-scrollbar-thumb:hover {
  background: #707070;
}