/* ========================================
   PDF Tools - Shared Styles
   ======================================== */

/* Hero Section */
.tool-hero {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.tool-hero-content {
  max-width: 700px;
  width: 100%;
}

.tool-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-xl);
  color: #fff;
  margin-bottom: var(--space-lg);
  animation: floatIcon 3s ease-in-out infinite;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.03); }
}

.tool-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.tool-hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.tool-hero .privacy-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.tool-hero .privacy-note svg {
  color: var(--primary);
  flex-shrink: 0;
}

/* Upload Area */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.upload-zone:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.upload-zone:hover::before {
  opacity: 0.03;
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(57, 211, 83, 0.08);
  transform: scale(1.01);
  box-shadow: 0 0 30px rgba(57, 211, 83, 0.15);
}

.upload-zone .upload-icon {
  position: relative;
  z-index: 1;
}

.upload-zone .upload-icon svg {
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.upload-zone:hover .upload-icon svg {
  color: var(--primary);
}

.upload-zone h4 {
  position: relative;
  z-index: 1;
  font-weight: 600;
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.upload-zone p {
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-md);
}

.upload-zone .file-badge {
  position: relative;
  z-index: 1;
  display: inline-block;
  background: rgba(57, 211, 83, 0.12);
  color: var(--primary-dark);
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  border: 1px solid rgba(57, 211, 83, 0.2);
}

[data-bs-theme="dark"] .upload-zone .file-badge {
  color: var(--primary);
}

/* File List */
.file-list-container {
  margin-top: var(--space-lg);
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.file-list-header h5 {
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.file-count-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: grab;
  position: relative;
}

.file-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.file-item.dragging {
  opacity: 0.5;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.file-item .drag-handle {
  color: var(--text-muted);
  cursor: grab;
  flex-shrink: 0;
}

.file-item .file-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.file-item .file-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.file-item .file-size {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-item .file-pages {
  font-size: 0.75rem;
  color: var(--primary-dark);
  background: rgba(57, 211, 83, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

[data-bs-theme="dark"] .file-item .file-pages {
  color: var(--primary);
}

.file-item .remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.file-item .remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Action Bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}

.action-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.action-info .info-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

.action-info .info-chip svg {
  color: var(--primary);
}

.action-buttons {
  display: flex;
  gap: var(--space-sm);
}

.btn-process {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(57, 211, 83, 0.3);
}

.btn-process::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.btn-process:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(57, 211, 83, 0.4);
}

.btn-process:hover::before {
  left: 100%;
}

.btn-process:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-process:disabled::before {
  display: none;
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-action:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Features Grid */
.features-section {
  margin-top: var(--space-3xl);
  padding: var(--space-2xl) var(--space-lg);
}

.features-section h2 {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-xl);
  color: var(--text-primary);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
}

.feature-card {
  text-align: center;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(57, 211, 83, 0.2);
}

.feature-card .feature-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(57, 211, 83, 0.1);
  border-radius: var(--radius-md);
  color: var(--primary);
  margin-bottom: var(--space-md);
}

.feature-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Progress Overlay */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.progress-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.progress-card .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--space-lg);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-card h4 {
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.progress-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  width: 0%;
}

/* Result Section */
.result-section {
  margin-top: var(--space-xl);
  padding: var(--space-xl);
  background: var(--bg-secondary);
  border: 2px solid rgba(57, 211, 83, 0.2);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

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

.result-section .result-icon {
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(57, 211, 83, 0.15);
  border-radius: 50%;
  color: var(--primary);
  margin-bottom: var(--space-md);
}

.result-section h3 {
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin: var(--space-lg) 0;
  flex-wrap: wrap;
}

.result-stat {
  text-align: center;
}

.result-stat .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.result-stat .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(57, 211, 83, 0.3);
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(57, 211, 83, 0.4);
}

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  margin-top: var(--space-md);
  transition: all 0.2s ease;
}

.btn-reset:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Page Thumbnails Grid */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.page-thumb {
  position: relative;
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  aspect-ratio: 210/297;
}

.page-thumb:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.page-thumb.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(57, 211, 83, 0.2);
}

.page-thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.page-thumb .page-number {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.page-thumb .page-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.page-thumb.selected .page-check {
  display: flex;
}

/* Rotate Controls */
.rotate-controls {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.page-thumb:hover .rotate-controls {
  opacity: 1;
}

.rotate-btn {
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rotate-btn:hover {
  background: var(--primary);
}

/* Settings Panel */
.settings-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.settings-panel h5 {
  font-weight: 600;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.settings-panel h5 svg {
  color: var(--primary);
}

.setting-group {
  margin-bottom: var(--space-md);
}

.setting-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.setting-group select,
.setting-group input[type="text"],
.setting-group input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.setting-group select:focus,
.setting-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(57, 211, 83, 0.1);
}

/* Quality Slider */
.quality-slider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.quality-slider input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
}

.quality-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(57, 211, 83, 0.3);
}

.quality-slider .quality-value {
  font-weight: 600;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

/* Selection Bar */
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.selection-bar .sel-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.selection-bar .sel-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-sm-action {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sm-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Footer */
.tool-footer {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.tool-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-buttons {
    justify-content: center;
  }

  .pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .result-stats {
    gap: var(--space-md);
  }
}

@media (max-width: 576px) {
  .features-grid {
    grid-template-columns: 1fr;
  }

  .tool-hero {
    padding: var(--space-xl) var(--space-md);
  }
}
