/* ==========================================================================
   ToolSuite - Tool-Specific Custom Styles (Clean & Minimal)
   Dedicated interfaces for PDF, Images, OCR, Markdown, DevTools, Utilities
   ========================================================================== */

/* Checkerboard Background for Transparency (Images, Favicon, Detourage) */
.transparency-grid {
  background-color: #1e222b;
  background-image: 
    linear-gradient(45deg, #14171d 25%, transparent 25%), 
    linear-gradient(-45deg, #14171d 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #14171d 75%), 
    linear-gradient(-45deg, transparent 75%, #14171d 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

[data-theme="light"] .transparency-grid {
  background-color: #ffffff;
  background-image: 
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%), 
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
}

/* 1. PDF Tools Styles */
.pdf-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.pdf-file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}

.pdf-file-item:hover {
  border-color: var(--border-color-hover);
}

.pdf-file-handle {
  cursor: grab;
  color: var(--text-muted);
}

.pdf-file-info {
  flex: 1;
}

.pdf-file-name {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.pdf-file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pdf-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.pdf-page-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card);
  transition: border-color var(--transition-fast);
}

.pdf-page-card.selected {
  border-color: var(--accent-primary);
}

/* 2. Markdown Preview Styler */
.markdown-preview {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3, .markdown-preview h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.markdown-preview p {
  margin-bottom: 0.85rem;
}

.markdown-preview code {
  background: var(--border-subtle);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.markdown-preview pre {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 1rem;
}

.markdown-preview pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
}

.markdown-preview blockquote {
  border-left: 3px solid var(--accent-primary);
  padding-left: 0.85rem;
  color: var(--text-secondary);
  margin: 0.85rem 0;
  font-style: italic;
}

.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.markdown-preview th, .markdown-preview td {
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-preview th {
  background: var(--border-subtle);
  font-weight: 600;
}

/* 3. Image Comparison & Favicon Grid */
.comparison-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.comparison-box {
  flex: 1;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.comparison-img-wrapper {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.comparison-img-wrapper img, .comparison-img-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.saving-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-xs);
  background: var(--border-color);
  color: var(--accent-emerald);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.favicon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.favicon-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.favicon-card canvas {
  border-radius: var(--radius-xs);
}

.favicon-size-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* 4. Background Remover Studio */
.bg-remover-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.canvas-editor-wrapper {
  position: relative;
  width: 100%;
  min-height: 380px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-editor-wrapper canvas {
  max-width: 100%;
  max-height: 520px;
  cursor: crosshair;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

/* 5. DevTools (JSON, Regex, Shadows, Base64) */
.json-tree-container {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
}

.json-key { color: #60a5fa; }
.json-string { color: #34d399; }
.json-number { color: #fbbf24; }
.json-boolean { color: #f472b6; }
.json-null { color: #9ca3af; }

.regex-highlight-box {
  position: relative;
  min-height: 140px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
}

.regex-backdrop, .regex-input-textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.regex-backdrop {
  color: transparent;
  pointer-events: none;
  z-index: 1;
}

.regex-input-textarea {
  background: transparent;
  color: var(--text-primary);
  border: none;
  resize: none;
  z-index: 2;
  outline: none;
}

.regex-match {
  background-color: rgba(59, 130, 246, 0.3);
  border-radius: 2px;
  color: transparent;
}

/* CSS Shadow & Neumorphism Playground */
.shadow-preview-stage {
  height: 300px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.shadow-target-box {
  width: 160px;
  height: 160px;
  border-radius: 16px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

/* 6. Dynamic QR Codes & Utilities */
.qr-preview-box {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.color-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.color-swatch-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.color-swatch-card:hover {
  border-color: var(--border-color-hover);
}

.color-swatch-rect {
  height: 65px;
  width: 100%;
}

.color-swatch-meta {
  padding: 0.5rem;
  text-align: center;
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
}

.color-rgb {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Password Entropy Meter */
.entropy-meter-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  margin-top: 0.4rem;
  overflow: hidden;
}

.entropy-meter-fill {
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}
