/* === CSS Variables === */
:root {
  --primary: #e53e3e;
  --primary-dark: #c53030;
  --primary-light: #feb2b2;
  --secondary: #4a5568;
  --success: #38a169;
  --error: #e53e3e;
  --gray-50: #f9fafb;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --gray-400: #cbd5e0;
  --gray-500: #a0aec0;
  --gray-600: #2d3748;
  --gray-700: #4a5568;
  --gray-800: #2d3748;
  --gray-900: #1a202c;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
  --nav-blue-light: #bee3f8;
  --nav-blue-medium: #90cdf4;
  --nav-blue-dark: #4299e1;
  --nav-blue-darker: #3182ce;
  --nav-text-light: #2c5282;
  --nav-text-dark: #1a365d;
}

/* === Reset & Base Styles === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background-color: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 45px; /* Fixed header offset */
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* === Layout === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main {
  flex: 1;
  padding: 2rem 0;
}

/* === Header & Navigation (combined) === */
.header.desktop-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1200;
  background: #fff;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.logo {
  height: 40px;
  width: auto;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  margin-left: 0.5rem;
  color: var(--nav-text-light);
}

/* Main navigation block */
.main-nav {
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.5rem 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  color: #2c5282;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo a:hover {
  color: #4299e1;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
  align-items: center;
}

.nav-menu > li > a {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: #bee3f8;
  color: #2c5282;
  text-decoration: none;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  border: 1px solid #90cdf4;
}
.nav-menu > li > a:hover {
  background-color: #90cdf4;
  color: #1a365d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.nav-menu > li > a.active {
  background-color: #4299e1;
  color: white;
  border-color: #3182ce;
}

/* Dropdown (general) */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown.mega {
  position: static;
}

.dropbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.75rem 1.5rem;
  background-color: #bee3f8;
  color: #2c5282;
  text-decoration: none;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  border: 1px solid #90cdf4;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  position: relative;
}
.dropbtn:hover,
.dropdown:hover .dropbtn {
  background-color: #90cdf4;
  color: #1a365d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.dropbtn .arrow {
  font-size: 0.7rem;
  transition: transform 0.3s;
  margin-left: 0.25rem;
}
.dropdown:hover .arrow {
  transform: rotate(180deg);
}

/* Dropdown content (base) */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: 0 0 0.5rem 0.5rem;
  padding: 10px 0 0.5rem 0;
  z-index: 9999;
  border: 1px solid #e2e8f0;
  border-top: none;
}

.dropdown:hover .dropbtn {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: #2d3748;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.dropdown-content a:hover {
  background-color: #f7fafc;
  color: #4299e1;
  border-left: 3px solid #4299e1;
}

/* PDF Tools 3‑column mega dropdown (specific) */
.dropdown-content.pdf-tools-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 24px;
  padding: 16px 20px;
  min-width: 640px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  box-sizing: border-box;
}
.dropdown-content.pdf-tools-grid a {
  white-space: nowrap;
  font-size: 14px;
  padding: 6px 10px;
}

/* Mega menu system (non‑dropdown) */
.mega-menu {
  position: absolute;
  left: 200px;
  top: 89%;
  width: 65%;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(0,0,0,.15);
  display: none;
  z-index: 9999;
  padding: 16px 20px;
}
.dropdown.mega:hover .mega-menu {
  display: block;
}

.mega-grid {
  max-width: 1200px;
  margin: auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mega-col h4 {
  font-size: 16px;
  margin: 0 0 8px;
  line-height: 1.2;
  font-weight: 600;
  color: #333;
}
.mega-col a {
  display: block;
  padding: 4px 0;
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: #333;
  text-decoration: none;
}
.mega-col a:hover {
  color: #0077cc;
  text-decoration: underline;
}

/* Alternative simple nav (used on some pages) */
.nav {
  display: flex;
  gap: 0.5rem;
}
.nav-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--nav-blue-light);
  color: var(--nav-text-light);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid var(--nav-blue-medium);
}
.nav-link:hover {
  background-color: var(--nav-blue-medium);
  color: var(--nav-text-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.nav-link.active {
  background-color: var(--nav-blue-dark);
  color: var(--white);
  border-color: var(--nav-blue-darker);
}

/* === Mobile Header System === */
.mobile-header {
  display: none;
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
  z-index: 9999;
  font-family: inherit;
}
.mobile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}
.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #222;
  text-decoration: none;
}
.mobile-logo img {
  height: 28px;
}
#mobileToggle {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
}
#mobileNav {
  display: none;
  background: #ffffff;
  border-top: 1px solid #eee;
}
#mobileNav.open {
  display: block;
}
#mobileNav a,
.m-acc {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  color: #222;
  background: #fff;
  border: none;
  text-align: left;
}
.m-acc {
  background: #f6f6f6;
  font-weight: 600;
  cursor: pointer;
}
.m-panel {
  display: none;
}
.m-panel.open {
  display: block;
}
.m-panel a {
  padding-left: 28px;
  border-top: 1px solid #eee;
}

/* === Hero Section === */
.hero {
  text-align: center;
  padding: 3rem 0;
}
.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.hero-subtitle {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

/* === Tools Grid === */
.tools {
  padding: 3rem 0;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.tool-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}
.tool-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.tool-icon-merge {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: var(--white);
}
.tool-icon-split {
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
  color: var(--white);
}
.tool-icon-rearrange {
  background: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%);
  color: var(--white);
}
.tool-icon-image {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--white);
}
.tool-icon-crop {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: var(--white);
}
.tool-title {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--gray-900);
}
.tool-description {
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}
.tool-cta {
  color: var(--primary);
  font-weight: 600;
}
.tool-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: #2d3748;
  font-weight: 700;
}
.tool-card p {
  color: #2d3748;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* === How It Works === */
.how-it-works {
  padding: 1rem 0;
}
.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 3rem;
  color: var(--gray-900);
}
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}
.step {
  text-align: center;
}
.step-number {
  width: 60px;
  height: 60px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}
.step-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.step-description {
  color: var(--gray-600);
}

/* === Features === */
.features {
  padding: 3rem 0;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}
.feature {
  text-align: center;
  padding: 2rem;
}
.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.feature-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.feature-description {
  color: var(--gray-600);
}

/* === Page Header === */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}
.breadcrumb {
  display: inline-block;
  color: var(--gray-600);
  text-decoration: none;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  transition: var(--transition);
}
.breadcrumb:hover {
  color: var(--primary);
}
.page-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.page-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
}

/* === Drop Zone === */
.upload-section {
  margin-bottom: 1rem;
}
.drop-zone {
  border: 3px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}
.drop-zone:hover,
.drop-zone:focus {
  border-color: var(--primary);
  background: var(--gray-50);
}
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.02);
}
.drop-zone-icon {
  color: var(--gray-400);
  margin-bottom: 1rem;
}
.drop-zone-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}
.drop-zone-hint {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* === Files Section === */
.files-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}
.files-header {
  margin-bottom: 1.5rem;
}
.files-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.files-hint {
  color: var(--gray-600);
  font-size: 0.95rem;
}
.files-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  cursor: move;
  transition: var(--transition);
  animation: fadeIn 0.3s ease;
}
.file-item:hover {
  border-color: var(--primary);
}
.file-item.sortable-ghost {
  opacity: 0.4;
}
.file-drag-handle {
  color: var(--gray-400);
  cursor: grab;
}
.file-drag-handle:active {
  cursor: grabbing;
}
.file-thumbnail {
  width: 60px;
  height: 80px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.file-thumbnail canvas {
  max-width: 100%;
  max-height: 100%;
}
.file-thumbnail-placeholder {
  color: var(--gray-400);
}
.file-info {
  flex: 1;
}
.file-name {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
  word-break: break-word;
}
.file-details {
  font-size: 0.875rem;
  color: var(--gray-600);
}
.file-remove {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.file-remove:hover {
  background: var(--gray-100);
}

/* === Split Section === */
.split-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.split-options {
  margin-bottom: 2rem;
}
.split-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.split-method {
  cursor: pointer;
  display: block;
}
.split-method input[type="radio"] {
  display: none;
}
.split-method-content {
  padding: 1.5rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  transition: var(--transition);
}
.split-method input:checked + .split-method-content {
  border-color: var(--primary);
  background: var(--gray-50);
}
.split-method-content h3 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}
.split-method-content p {
  font-size: 0.95rem;
  color: var(--gray-600);
}

/* === Pages Grid === */
.pages-preview {
  margin-bottom: 2rem;
}
.pages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.pages-actions {
  display: flex;
  gap: 0.5rem;
}
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.page-item {
  position: relative;
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  animation: fadeIn 0.3s ease;
}
.page-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.page-item.selected {
  border-color: var(--primary);
  background: var(--gray-50);
}
.page-item.sortable-ghost {
  opacity: 0.4;
}
.page-number {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--gray-900);
  color: var(--white);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10;
}
.page-checkbox {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
}
.page-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--error);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  z-index: 10;
}
.page-item:hover .page-delete {
  opacity: 1;
}
.page-delete:hover {
  background: var(--primary-dark);
}
.page-thumbnail-wrapper {
  width: 100%;
  aspect-ratio: 0.707;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-thumbnail-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
}
.blank-page-indicator {
  color: var(--gray-400);
  font-size: 0.875rem;
  text-align: center;
}

/* === Rearrange Section === */
.rearrange-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.rearrange-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.toolbar-actions {
  display: flex;
  gap: 0.5rem;
}
.rearrange-hint {
  color: var(--gray-600);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* === Buttons === */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-900);
}
.btn-secondary:hover {
  background: var(--gray-300);
}
.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}
.btn-large {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* === Processing Section === */
.processing-section {
  text-align: center;
  padding: 4rem 2rem;
}
.processing-content {
  max-width: 500px;
  margin: 0 auto;
}
.spinner-large {
  width: 60px;
  height: 60px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.processing-title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}
.processing-text {
  color: var(--gray-600);
  margin-bottom: 2rem;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

/* === Success Section === */
.success-section {
  text-align: center;
  padding: 4rem 2rem;
}
.success-content {
  max-width: 500px;
  margin: 0 auto;
}
.success-icon {
  width: 80px;
  height: 80px;
  background: var(--success);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
}
.success-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}
.success-text {
  color: var(--gray-600);
  margin-bottom: 2rem;
}
.success-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* === Error Section === */
.error-section {
  text-align: center;
  padding: 4rem 2rem;
}
.error-content {
  max-width: 500px;
  margin: 0 auto;
}
.error-icon {
  width: 80px;
  height: 80px;
  background: var(--error);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
}
.error-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}
.error-text {
  color: var(--gray-600);
  margin-bottom: 2rem;
}
.error-tips {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: left;
  margin-bottom: 2rem;
}
.error-tips-title {
  font-weight: 600;
  margin-bottom: 1rem;
}
.error-tips-list {
  list-style-position: inside;
  color: var(--gray-600);
}
.error-tips-list li {
  margin-bottom: 0.5rem;
}

/* === Footer === */
.footer {
  background: var(--gray-900);
  color: var(--white);
  padding: 3rem 0 1rem;
  margin-top: auto;
}
.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-section h3,
.footer-section h4 {
  color: var(--white);
  margin-bottom: 1rem;
}
.footer-section p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}
.footer-section ul {
  list-style: none;
}
.footer-section ul li {
  margin-bottom: 0.5rem;
}
.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  font-size: 0.95rem;
}
.footer-section a:hover {
  color: var(--white);
}
.footer-subsection {
  margin-bottom: 1.5rem;
}
.footer-subsection:last-child {
  margin-bottom: 0;
}
.footer-subsection h4 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.footer-copyright {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

/* === Image Tools Specific Styles === */
.converter-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 0;
}
.upload-area {
  border: 3px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--white);
  transition: var(--transition);
  margin-bottom: 2rem;
  cursor: pointer;
}
.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--gray-50);
}
.upload-icon {
  font-size: 3rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}
.file-input {
  display: none;
}
.image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.preview-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--white);
}
.preview-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.remove-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--error);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.remove-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
}
.controls {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}
.control-group {
  margin-bottom: 1.5rem;
}
.control-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--gray-800);
}
.select-control, .checkbox-control, .input-control {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: var(--transition);
}
.select-control:focus,
.input-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-control {
  width: auto;
}
.dimension-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.dimension-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dimension-input input {
  flex: 1;
}
.aspect-ratio-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.ratio-btn {
  padding: 0.5rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
}
.ratio-btn.active,
.ratio-btn:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}
.tool-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}
.tool-btn.active,
.tool-btn:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}
.crop-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.editor-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  margin-top: 2rem;
}
.editor-main {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.editor-preview {
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--gray-300);
}
#imagePreview {
  max-width: 100%;
  max-height: 500px;
  display: none;
}
.controls-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  height: fit-content;
}
.preview-info {
  text-align: center;
  margin-top: 1rem;
  color: var(--gray-600);
  font-size: 0.9rem;
}
.loading {
  display: none;
  text-align: center;
  padding: 2rem;
}
.spinner-small {
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 2s linear infinite;
  margin: 0 auto 1rem;
}
.supported-formats {
  text-align: center;
  color: var(--gray-600);
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* === Modern Buttons (Related Tools) === */
.related-tools-section {
  margin: 3rem 0;
  padding: 2rem;
  background: #f7fafc;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}
.related-tools-title {
  text-align: center;
  color: #2d3748;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
}
.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  justify-items: center;
}
.modern-btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #4299e1, #2b6cb0);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
  text-decoration: none;
  width: 100%;
  max-width: 250px;
  position: relative;
  overflow: hidden;
}
.modern-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(66, 153, 225, 0.5);
  background: linear-gradient(135deg, #2b6cb0, #2c5282);
}
.modern-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(66, 153, 225, 0.4);
}

/* === Animations === */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Accessibility === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
.drop-zone:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

/* === Media Queries (merged) === */
@media (max-width: 1024px) {
  .dropdown-content.pdf-tools-grid {
    grid-template-columns: 1fr;
    min-width: auto;
  }
  .mega-menu {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* Header & Navigation */
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  .mobile-menu-btn {
    display: none !important;
  }
  .desktop-header {
    display: none !important;
  }
  .mobile-header {
    display: block;
  }
  .desktop-header .dropdown-content {
    display: none !important;
  }

  /* Disable hover‑based dropdowns on mobile */
  .dropdown.mega:hover .mega-menu,
  .dropdown:hover .dropdown-content {
    display: none !important;
  }
  .desktop-header .dropdown {
    pointer-events: none;
  }
  .mobile-header {
    pointer-events: auto;
  }
  #mobileNav a,
  .m-acc {
    padding: 16px;
    min-height: 52px;
    font-size: 17px;
  }
  .m-panel a {
    padding-left: 32px;
  }

  /* Hero */
  .hero-title {
    font-size: 2rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .page-title {
    font-size: 2rem;
  }

  /* Tools */
  .tool-card {
    padding: 1.5rem;
  }

  /* Pages & Files */
  .pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .files-list {
    gap: 0.75rem;
  }
  .file-item {
    flex-wrap: wrap;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .footer-section:first-child {
    grid-column: 1 / -1;
  }

  /* Image Tools */
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .dimension-controls {
    grid-template-columns: 1fr;
  }
  .aspect-ratio-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
  .crop-controls {
    grid-template-columns: 1fr;
  }
  .image-preview {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .upload-area {
    padding: 2rem 1rem;
  }

  /* Related Tools */
  .related-tools-section {
    padding: 1.5rem;
  }
  .modern-btn {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  .logo-text {
    font-size: 1.25rem;
  }
  .hero-title {
    font-size: 1.75rem;
  }
  .pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .action-buttons {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
  .nav-container {
    padding: 0 1rem;
  }
  .nav-menu > li > a,
  .dropbtn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer-section {
    text-align: center;
  }
  .footer-subsection {
    margin-bottom: 1rem;
  }
  .converter-container,
  .editor-container {
    padding: 1rem 0;
  }
  .controls-panel {
    padding: 1rem;
  }
  .aspect-ratio-buttons {
    grid-template-columns: 1fr;
  }
  .dropdown-content {
    min-width: 200px;
  }
  .dropdown-content a {
    padding: 0.6rem 1rem;
  }
}