/* ========================================
   MERGE PDF - COMPLETE RESPONSIVE CSS
   Covers: Desktop, Tablet, Mobile, Small Mobile
   ======================================== */

/* ===== BASE IMPROVEMENTS ===== */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER RESPONSIVE ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.logo img {
  height: 40px;
  width: auto;
  display: block;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  font-size: 15px;
  color: #334155;
  font-weight: 600;
  padding: 6px 0;
  transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
  color: #2563eb;
}

/* Hamburger menu (hidden on desktop) */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: #334155;
  border-radius: 2px;
  transition: all 0.3s;
}

/* ===== TOOL CONTAINER RESPONSIVE ===== */
.tool-container {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
  min-height: calc(100vh - 200px);
}

/* ===== TOOL HEADER RESPONSIVE ===== */
.tool-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

.tool-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: #1a365d;
  margin-bottom: 10px;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(90deg, #3182ce, #805ad5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-description {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: #4a5568;
  max-width: 700px;
  margin: 0 auto 20px;
  line-height: 1.6;
  padding: 0 10px;
}

.tool-tip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #ebf8ff, #e6fffa);
  padding: 12px 20px;
  border-radius: 12px;
  color: #2d3748;
  border-left: 4px solid #3182ce;
  box-shadow: 0 2px 10px rgba(49, 130, 206, 0.1);
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}

.tool-tip span {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* ===== UPLOAD AREA RESPONSIVE ===== */
.upload-area {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  margin-bottom: 40px;
}

/* ===== DROP ZONE RESPONSIVE ===== */
.drop-zone {
  border: 3px dashed #cbd5e0;
  border-radius: 16px;
  padding: 70px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: linear-gradient(145deg, #f7fafc, #edf2f7);
}

.drop-zone:hover {
  border-color: #4299e1;
  background: linear-gradient(145deg, #ebf8ff, #e6fffa);
  transform: translateY(-2px);
}

.dropzone-icon svg {
  width: clamp(60px, 15vw, 80px);
  height: clamp(60px, 15vw, 80px);
  stroke-width: 1.5;
  color: #4299e1;
}

.drop-zone h3 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  color: #2d3748;
  margin: 20px 0 10px;
  font-weight: 700;
}

.drop-zone p {
  color: #718096;
  margin: 6px 0;
  font-size: clamp(0.95rem, 3vw, 1.1rem);
}

.file-info {
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  color: #a0aec0;
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
}

/* ===== FILE LIST RESPONSIVE ===== */
.file-list {
  margin-top: 30px;
  background: linear-gradient(145deg, #f8f9fa, #e9ecef);
  border-radius: 16px;
  padding: 25px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 12px;
}

.file-list-header h4 {
  margin: 0;
  color: #2d3748;
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 700;
}

.btn-clear {
  background: linear-gradient(135deg, #fc8181, #f56565);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  font-weight: 600;
  transition: all 0.3s;
  white-space: nowrap;
}

/* ===== FILE ITEMS RESPONSIVE ===== */
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: white;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
  cursor: grab;
}

.file-item:active {
  cursor: grabbing;
}

.file-drag-handle {
  cursor: grab;
  color: #9ca3af;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  user-select: none;
  flex-shrink: 0;
}

.file-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.file-name {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-size {
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: #718096;
}

.file-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.file-actions button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #6b7280;
  font-size: 16px;
  font-weight: 600;
  padding: 0;
}

/* ===== ACTION BUTTONS RESPONSIVE ===== */
.action-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 40px 0;
  flex-wrap: wrap;
}

.btn-primary {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: 12px;
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s;
  box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
  min-width: 200px;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #3182ce, #2c5282);
  transform: translateY(-3px);
}

.btn-primary:disabled {
  background: linear-gradient(135deg, #cbd5e0, #a0aec0);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

.btn-secondary {
  background: white;
  color: #4299e1;
  border: 2px solid #4299e1;
  padding: 16px 36px;
  border-radius: 12px;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 180px;
}

/* ===== PROGRESS BAR RESPONSIVE ===== */
.progress-container {
  margin: 30px 0;
  background: #f7fafc;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.progress-bar-wrapper {
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4299e1, #805ad5, #d53f8c);
  border-radius: 6px;
  width: 0%;
  transition: width 0.5s;
}

.progress-text {
  display: block;
  text-align: center;
  margin-top: 10px;
  color: #4a5568;
  font-weight: 600;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

/* ===== STATUS MESSAGE RESPONSIVE ===== */
.status-message {
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  margin: 25px 0;
  font-weight: 600;
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  display: none;
  word-wrap: break-word;
}

/* ===== FEATURES GRID RESPONSIVE ===== */
.tool-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

.feature {
  text-align: center;
  padding: 30px 25px;
  background: linear-gradient(145deg, white, #f7fafc);
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
}

.feature-icon {
  font-size: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: 20px;
  display: inline-block;
}

.feature h4 {
  color: #2d3748;
  margin-bottom: 12px;
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  font-weight: 700;
}

.feature p {
  color: #718096;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  line-height: 1.6;
  margin: 0;
}

/* ===== FOOTER RESPONSIVE ===== */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: #718096;
  margin-top: 80px;
  border-top: 1px solid #e2e8f0;
  background: linear-gradient(145deg, #f7fafc, #edf2f7);
}

.footer-content p {
  margin: 10px 0;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* ========================================
   TABLET (max-width: 992px)
   ======================================== */
@media (max-width: 992px) {
  .header {
    padding: 16px 24px;
  }

  .tool-container {
    max-width: 95%;
    margin: 20px auto;
    padding: 0 16px;
  }

  .tool-header {
    margin-bottom: 30px;
  }

  .upload-area {
    padding: 30px 24px;
    border-radius: 16px;
  }

  .drop-zone {
    padding: 60px 24px;
  }

  .tool-features {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
  }

  .action-buttons {
    gap: 16px;
  }
}

/* ========================================
   MOBILE (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
  /* Header becomes hamburger menu */
  .header {
    padding: 12px 16px;
  }

  .logo img {
    height: 32px;
  }

  .nav {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 250px;
    height: calc(100vh - 60px);
    background: white;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    gap: 16px;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.1);
    transition: right 0.3s;
    z-index: 999;
  }

  .nav.active {
    right: 0;
  }

  .nav a {
    width: 100%;
    padding: 12px 0;
    font-size: 16px;
    border-bottom: 1px solid #e5e7eb;
  }

  .hamburger {
    display: flex;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }

  /* Content adjustments */
  .tool-container {
    padding: 0 12px;
    margin: 16px auto;
  }

  .tool-header {
    margin-bottom: 24px;
    padding-top: 12px;
  }

  .tool-tip {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .tool-tip svg {
    width: 16px;
    height: 16px;
  }

  .upload-area {
    padding: 24px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
  }

  .drop-zone {
    padding: 50px 20px;
    border-radius: 12px;
    border-width: 2px;
  }

  .drop-zone h3 {
    margin: 16px 0 8px;
  }

  .file-list {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .file-list-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-clear {
    width: 100%;
    justify-content: center;
  }

  .file-item {
    padding: 12px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .file-drag-handle {
    display: none; /* Hide on mobile */
  }

  .file-info {
    flex-basis: calc(100% - 100px);
  }

  .file-name {
    margin-bottom: 6px;
  }

  .file-actions {
    margin-left: auto;
  }

  /* Larger touch targets on mobile */
  .file-actions button {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 30px 0;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 100%;
    min-width: unset;
    padding: 16px 24px;
  }

  .progress-container {
    margin: 24px 0;
    padding: 16px;
  }

  .tool-features {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 32px;
  }

  .feature {
    padding: 24px 20px;
  }

  .footer {
    margin-top: 40px;
    padding: 30px 16px;
  }
}

/* ========================================
   SMALL MOBILE (max-width: 480px)
   ======================================== */
@media (max-width: 480px) {
  .header {
    padding: 10px 12px;
  }

  .logo img {
    height: 28px;
  }

  .tool-container {
    padding: 0 8px;
    margin: 12px auto;
  }

  .tool-header {
    margin-bottom: 20px;
    padding-top: 8px;
  }

  .tool-title {
    margin-bottom: 8px;
  }

  .tool-description {
    margin-bottom: 16px;
  }

  .tool-tip {
    padding: 8px 12px;
    border-radius: 8px;
  }

  .upload-area {
    padding: 20px 12px;
    border-radius: 10px;
  }

  .drop-zone {
    padding: 40px 16px;
    border-radius: 10px;
  }

  .drop-zone h3 {
    margin: 12px 0 6px;
  }

  .drop-zone p {
    margin: 4px 0;
  }

  .file-info {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .file-list {
    padding: 16px 12px;
    margin-top: 20px;
  }

  .file-list-header h4 {
    font-size: 1rem;
  }

  .btn-clear {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .file-item {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .file-icon {
    font-size: 1.3rem;
  }

  .file-name {
    font-size: 0.9rem;
  }

  .file-size {
    font-size: 0.8rem;
  }

  .file-actions {
    gap: 6px;
  }

  .file-actions button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 14px;
  }

  /* Hide move buttons on small mobile, only show remove */
  .btn-move-up,
  .btn-move-down {
    display: none;
  }

  .btn-primary,
  .btn-secondary {
    padding: 14px 20px;
    border-radius: 10px;
  }

  .progress-container {
    padding: 14px;
    border-radius: 10px;
  }

  .progress-bar-wrapper {
    height: 10px;
  }

  .status-message {
    padding: 16px;
    margin: 20px 0;
    border-radius: 10px;
  }

  .tool-features {
    gap: 12px;
    margin-top: 24px;
  }

  .feature {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .feature-icon {
    margin-bottom: 16px;
  }

  .feature h4 {
    margin-bottom: 8px;
  }

  .footer {
    margin-top: 32px;
    padding: 24px 12px;
  }

  .footer-content p {
    font-size: 0.85rem;
  }
}

/* ========================================
   EXTRA SMALL (max-width: 360px)
   ======================================== */
@media (max-width: 360px) {
  .tool-title {
    font-size: 1.5rem;
  }

  .drop-zone {
    padding: 30px 12px;
  }

  .dropzone-icon svg {
    width: 50px;
    height: 50px;
  }

  .drop-zone h3 {
    font-size: 1.1rem;
  }

  .drop-zone p {
    font-size: 0.9rem;
  }

  .btn-primary {
    font-size: 1rem;
    padding: 12px 16px;
  }

  .file-item {
    gap: 8px;
  }
}

/* ========================================
   LANDSCAPE MODE (Mobile Horizontal)
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .header {
    position: relative; /* Don't stick on landscape mobile */
  }

  .tool-header {
    padding-top: 8px;
    margin-bottom: 16px;
  }

  .drop-zone {
    padding: 30px 20px;
  }

  .tool-features {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .footer {
    margin-top: 24px;
    padding: 20px 16px;
  }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn-primary,
  .btn-secondary,
  .btn-clear {
    min-height: 44px;
  }

  .file-actions button {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Remove hover effects on touch */
  .drop-zone:hover {
    transform: none;
  }

  .file-item:hover {
    transform: none;
  }
}

/* ========================================
   REDUCED MOTION (Accessibility)
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   HIGH CONTRAST MODE (Accessibility)
   ======================================== */
@media (prefers-contrast: high) {
  .drop-zone {
    border-width: 3px;
    border-color: #000;
  }

  .btn-primary {
    border: 2px solid #000;
  }

  .file-item {
    border-width: 2px;
    border-color: #000;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .header,
  .hamburger,
  .drop-zone,
  .action-buttons,
  .file-actions,
  .progress-container,
  .footer,
  .tool-tip {
    display: none !important;
  }

  .tool-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .upload-area {
    box-shadow: none;
    border: 1px solid #000;
  }

  .file-list {
    page-break-inside: avoid;
  }
}