/* ===== PDF to Image - Modern Styles ===== */

/* Layout */
.pdf-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.pdf-main { min-width: 0; }
.pdf-card {
  background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 18px;
  padding: 32px; box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.pdf-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* Upload area */
.pdf-upload {
  border: 2px dashed var(--border); border-radius: 16px;
  padding: 50px 20px; text-align: center; cursor: pointer;
  transition: all 0.25s ease; background: var(--bg-soft);
}
.pdf-upload:hover { border-color: var(--primary); background: var(--primary-50); }
.pdf-upload.dragover { border-color: var(--primary); background: var(--primary-50); transform: scale(1.01); }
.pdf-upload-icon { font-size: 48px; color: var(--primary); margin-bottom: 14px; opacity: 0.7; }
.pdf-upload-text { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.pdf-upload-sub { font-size: 13px; color: var(--text-muted); }

/* Settings bar */
.pdf-settings { margin-top: 20px; background: var(--bg-soft); border-radius: 14px; padding: 20px; border: 1px solid var(--border-light); }
.pdf-settings-row { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.pdf-setting-group { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; }
.pdf-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.pdf-select {
  padding: 10px 12px; border: 2px solid var(--border-light); border-radius: 10px;
  font-size: 14px; background: var(--bg); color: var(--text); outline: none;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.pdf-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

.pdf-range-wrap { display: flex; align-items: center; gap: 10px; }
.pdf-range {
  flex: 1; -webkit-appearance: none; appearance: none; height: 6px;
  background: var(--bg-muted); border-radius: 6px; outline: none; cursor: pointer;
}
.pdf-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); cursor: pointer; box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}
.pdf-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); cursor: pointer; border: none; }
.pdf-range-val { font-size: 13px; font-weight: 700; color: var(--primary); min-width: 36px; text-align: right; }

.pdf-download-all-btn {
  padding: 10px 20px; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.25s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 3px 10px rgba(79,70,229,0.25);
}
.pdf-download-all-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,70,229,0.35); }
.pdf-download-all-btn:active { transform: translateY(0); }
.pdf-download-all-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.pdf-info-bar {
  margin-top: 12px; display: flex; gap: 20px; font-size: 13px; color: var(--text-secondary);
  padding: 10px 14px; background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-light);
}
.pdf-info-bar i { margin-right: 4px; color: var(--primary); }

/* Progress */
.pdf-progress { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.pdf-progress-bar { flex: 1; height: 8px; background: var(--bg-muted); border-radius: 8px; overflow: hidden; }
.pdf-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b5cf6); border-radius: 8px; transition: width 0.3s ease; width: 0%; }
.pdf-progress-text { font-size: 13px; font-weight: 700; color: var(--primary); min-width: 40px; text-align: right; }

/* Gallery */
.pdf-gallery { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.pdf-gallery-item {
  background: var(--bg-soft); border-radius: 14px; border: 1px solid var(--border-light);
  overflow: hidden; transition: transform 0.2s ease;
}
.pdf-gallery-item:hover { transform: translateY(-2px); }
.pdf-gallery-item img { width: 100%; display: block; object-fit: cover; max-height: 280px; border-bottom: 1px solid var(--border-light); }
.pdf-gallery-item-info { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; }
.pdf-gallery-item-info span { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.pdf-gallery-download {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-light);
  background: var(--bg-card); color: var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; font-size: 14px;
}
.pdf-gallery-download:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Loading overlay */
.pdf-loading {
  margin-top: 16px; text-align: center; padding: 30px;
  background: var(--bg-soft); border-radius: 14px; border: 1px solid var(--border-light);
}
.pdf-loading-spinner { font-size: 36px; color: var(--primary); margin-bottom: 12px; }
.pdf-loading-text { font-size: 14px; color: var(--text-secondary); font-weight: 500; }

/* Error */
.pdf-error { margin-top: 16px; padding: 14px 18px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; color: #dc2626; font-size: 14px; font-weight: 500; display: none; }
body[data-theme="dark"] .pdf-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #fca5a5; }

/* How-to list */
.pdf-howto-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pdf-howto-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.pdf-howto-num {
  width: 24px; height: 24px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* Sidebar (shared patterns) */
.sidebar-section { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.sidebar-header { text-align: center; padding: 28px 20px !important; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; border-color: transparent !important; }
.sidebar-header h1 { font-size: 1.35rem; font-weight: 800; color: #fff; margin-bottom: 6px; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.sidebar-header p { font-size: 0.82rem; color: rgba(255,255,255,0.85); }
body[data-theme="dark"] .sidebar-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; }
.sidebar-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.sidebar-title i { color: var(--primary); font-size: 0.9rem; }
.sidebar-tools { display: flex; flex-direction: column; gap: 8px; }
.sidebar-tool { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; transition: all 0.2s ease; text-decoration: none; background: var(--bg-soft); }
.sidebar-tool:hover { background: var(--primary-50); transform: translateX(3px); }
.sidebar-tool-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 16px; flex-shrink: 0; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.sidebar-tool-info { flex: 1; min-width: 0; }
.sidebar-tool-name { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.sidebar-tool-desc { font-size: 0.78rem; color: var(--text-muted); }
.ad-placeholder { width: 300px; height: 250px; flex-shrink: 0; margin: 0 auto; background: var(--bg-card); border: 2px dashed var(--border); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }
.ad-placeholder .ad-icon { font-size: 1.8rem; color: var(--text-muted); margin-bottom: 10px; opacity: 0.4; }
.ad-placeholder .ad-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.ad-placeholder .ad-size { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }

/* Dark mode */
body[data-theme="dark"] .pdf-card { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-section { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .sidebar-tool { background: var(--bg-muted); }
body[data-theme="dark"] .sidebar-tool:hover { background: var(--primary-50); }
body[data-theme="dark"] .ad-placeholder { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .pdf-upload { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .pdf-upload:hover { border-color: var(--primary); background: var(--primary-50); }
body[data-theme="dark"] .pdf-select { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .pdf-gallery-item { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .pdf-gallery-download { background: var(--bg-card); border-color: var(--border); }
body[data-theme="dark"] .pdf-gallery-download:hover { background: var(--primary); border-color: var(--primary); }
body[data-theme="dark"] .pdf-settings { background: var(--bg-muted); border-color: var(--border); }
body[data-theme="dark"] .pdf-info-bar { background: var(--bg-muted); border-color: var(--border); }

/* Responsive */
@media (max-width: 1024px) { .pdf-layout { grid-template-columns: 1fr 280px; gap: 20px; } }
@media (max-width: 860px) { .pdf-layout { grid-template-columns: 1fr; } .pdf-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } }
@media (max-width: 768px) {
  .pdf-settings-row { flex-direction: column; }
  .pdf-card { padding: 20px; }
  .pdf-upload { padding: 30px 16px; }
  .pdf-gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .pdf-sidebar { grid-template-columns: 1fr; }
  .pdf-gallery { grid-template-columns: 1fr; }
}