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

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-card: #1f2937;
  --bg-card-hover: #374151;
  --bg-drop: #111827;
  --border-color: #374151;
  --border-hover: #6366f1;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.1);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
  --transition: 200ms ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* --- Nav Placeholder --- */
#shared-nav {
  min-height: 56px;
  display: block;
  width: 100%;
}

/* --- Navbar --- */
.tool-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tool-nav__inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-nav__logo {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.tool-nav__links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.tool-nav__links a { color: var(--text-secondary); }
.tool-nav__links a:hover { color: var(--text-primary); }
.tool-nav__links a.active { color: var(--accent); }

/* --- Breadcrumb --- */
.breadcrumb {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  width: 100%;
}

.breadcrumb a {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumb a:hover { text-decoration: underline; }

/* --- Tool Page Header --- */
.tool-header {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
}

.tool-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Drop Zone --- */
.drop-zone {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 3rem 2rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-drop);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.drop-zone__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.drop-zone__text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

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

.drop-zone__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.625rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.drop-zone__btn:hover { background: var(--accent-hover); }

/* --- File List --- */
.file-list {
  max-width: 720px;
  margin: 0 auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background var(--transition);
}

.file-item:hover { background: var(--bg-card-hover); }

.file-item__icon { font-size: 1.25rem; flex-shrink: 0; }
.file-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  overflow: hidden;
}
.file-item__name { flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__size { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }

.file-item__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.file-item__remove:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

.file-item__drag {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
}

.file-item--draggable {
  cursor: grab;
}

.file-item--draggable:active {
  cursor: grabbing;
}

.file-list--panel {
  margin: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-primary);
  max-height: 300px;
  overflow-y: auto;
  gap: 0;
}

.file-list--panel .file-item {
  padding: 1rem;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
}

.file-list--panel .file-item:last-child {
  border-bottom: none;
}

.file-list--panel .file-item__icon {
  font-size: 1.5rem;
}

/* --- Action Bar --- */
.action-bar {
  max-width: 720px;
  margin: 1.5rem auto;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform .15s;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

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

/* --- Progress --- */
.progress-container {
  max-width: 720px;
  margin: 1rem auto;
  display: none;
}

.progress-container.visible { display: block; }

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

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* --- Result Area --- */
.result-area {
  max-width: 720px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  text-align: center;
  display: none;
}

.result-area.visible { display: block; }

.result-area__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 0.75rem;
}

.result-area__info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-download:hover { background: #16a34a; }

/* --- Feature Grid --- */
.features {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.features__title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  text-align: center;
  padding: 1.5rem;
}

.feature-card__icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.feature-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.feature-card__text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- CTA Banner --- */
.cta-banner {
  max-width: 900px;
  margin: 2rem auto 3rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--accent-bg), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  text-align: center;
}

.cta-banner__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.cta-banner__text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.cta-banner__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.cta-banner__btn:hover { background: var(--accent-hover); color: #fff; }

/* --- Tool Footer --- */
.tool-footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tool-footer a { color: var(--text-muted); }
.tool-footer a:hover { color: var(--accent); }

/* --- Tools Grid (for listing page) --- */
.tools-grid {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition), transform .15s;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  color: inherit;
}

.tool-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tool-card__icon--red { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.tool-card__icon--blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tool-card__icon--green { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.tool-card__icon--purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.tool-card__icon--orange { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.tool-card__icon--pink { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

.tool-card__content { flex-grow: 1; }

.tool-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tool-card__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .tool-header h1 { font-size: 1.75rem; }
  .drop-zone { padding: 2rem 1.25rem; margin: 1rem; }
  .file-list { margin: 0 1rem; }
  .action-bar { margin: 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-nav__links { display: none; }
  .options-grid { grid-template-columns: 1fr !important; }
}

/* --- Specific Tool Options Panel --- */
.options-panel {
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.options-panel__header {
  font-weight: 700;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: .5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.options-grid--full {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: .875rem;
  color: var(--text-secondary);
  margin-bottom: .5rem;
}

.form-input, .form-select {
  width: 100%;
  padding: .625rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: .875rem;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
}

.form-input--lg {
  font-size: 1rem;
  font-weight: bold;
}

/* Color input — 需要固定高度才能正常显示 */
.form-color {
  width: 100%;
  height: 42px;
  padding: 2px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.form-color:focus { border-color: var(--accent); }

/* Single-column options grid */
.options-grid--single {
  grid-template-columns: 1fr;
}

/* Indeterminate (animated) progress bar */
@keyframes indeterminate {
  0%   { left: -40%; width: 40%; }
  100% { left: 100%; width: 40%; }
}

.progress-bar-fill--indeterminate {
  position: relative;
  width: 100% !important;
  background: transparent;
  overflow: hidden;
}

.progress-bar-fill--indeterminate::before {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  animation: indeterminate 1.4s ease infinite;
}

/* Password strength indicator */
.pwd-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin-top: 0.5rem;
  overflow: hidden;
}

.pwd-strength__bar {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s, background 0.3s;
}

.pwd-strength__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Options Panel Wrapper --- */
.options-panel-wrap {
  margin: 1.5rem auto;
  display: none;
}
.options-panel-wrap.visible {
  display: block;
}
.options-panel-wrap--sm { max-width: 480px; }
.options-panel-wrap--md { max-width: 720px; }
.options-panel-wrap--lg { max-width: 900px; }

/* --- FAQ Section --- */
.faq-section {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.faq-section__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.faq-section__item {
  margin-bottom: 1.5rem;
}

.faq-section__q {
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.faq-section__a {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- Utilities & Standardized Helpers --- */
.hidden { display: none !important; }
.flex-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.flex-actions--no-margin { margin-bottom: 0; }
.flex-actions--top-margin { margin-top: 0.75rem; }
.text-sm-btn { font-size: 0.8rem; }
.preview-container { max-width: 720px; margin: 0 auto; }
.preview-grid { max-width: 720px; margin: 1.5rem auto; }
.options-panel__header--plain { border: none; margin-bottom: 0.75rem; padding: 0; }
.text-sm-secondary { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }
.text-xs-secondary { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.text-error { color: var(--error, #ef4444); font-size: 0.875rem; }
.text-success { font-weight: 700; color: var(--success); }
.preview-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.grid-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.btn-sm { font-size: 0.8rem; padding: 0.5rem 1rem; }
.image-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.image-card__preview {
  width: 100%;
  display: block;
}
.image-card__meta {
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.image-card__download {
  color: var(--accent);
  font-size: 1rem;
}

.tool-header--main { padding: 3.5rem 1.5rem 2rem; }
.tools-grid--main { margin-bottom: 3rem; }

