/**
 * GS MultiTools - Tool Interface Stylesheet
 * Specialized UI layouts for image, PDF, text, developer, and calculator tools.
 */

/* ==========================================================================
   1. Tool Page Workspace Layout
   ========================================================================== */
.tool-header {
  margin-bottom: 32px;
}

.tool-header-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.tool-header-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid var(--border-color);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-header-icon svg {
  width: 28px;
  height: 28px;
}

.tool-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 48px;
}

.tool-workspace.single-column {
  grid-template-columns: 1fr;
}

.tool-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.tool-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 1.15rem;
}

.tool-panel-title .actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   2. Drag & Drop File Upload Zone
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  background: rgba(229, 9, 20, 0.02);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold-primary);
  background: rgba(229, 9, 20, 0.08);
  box-shadow: var(--gold-glow);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(229, 9, 20, 0.1);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-icon svg {
  width: 28px;
  height: 28px;
}

.dropzone-text h4 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.dropzone-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   3. File Queue / Reorder List (PDF Merger, Image to PDF)
   ========================================================================== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  max-height: 320px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  gap: 12px;
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.file-item-info svg {
  color: var(--gold-primary);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.file-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

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

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   4. Image Previews & Cropper
   ========================================================================== */
.preview-container {
  width: 100%;
  min-height: 260px;
  max-height: 480px;
  background: #000000;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.preview-container img, .preview-container canvas {
  max-width: 100%;
  max-height: 450px;
  object-fit: contain;
}

.crop-canvas-wrapper {
  position: relative;
  display: inline-block;
  user-select: none;
}

.crop-box {
  position: absolute;
  border: 2px dashed var(--gold-primary);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  cursor: move;
  pointer-events: auto;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--gold-primary);
  border: 1px solid #000;
  border-radius: 2px;
}
.crop-handle-tl { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle-tr { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle-bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle-br { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Color Picker Loupe & Swatches */
.color-picker-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.color-preview-box {
  height: 80px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-end;
  padding: 10px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  color: #ffffff;
}

.color-swatch-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   5. Diff Checker Highlighting
   ========================================================================== */
.diff-container {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.diff-line {
  display: flex;
  padding: 4px 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-line-number {
  width: 44px;
  color: var(--text-muted);
  user-select: none;
  text-align: right;
  padding-right: 12px;
  flex-shrink: 0;
}

.diff-line-content {
  flex: 1;
}

.diff-line.added {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.diff-line.removed {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.diff-line.unchanged {
  color: var(--text-secondary);
}

/* ==========================================================================
   6. Statistics Cards & Chips
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: center;
}

.stat-chip-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-chip-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold-primary);
}

/* Size comparison badge (e.g. Image Compressor) */
.size-comparison-box {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.size-tag {
  text-align: center;
}
.size-tag span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.size-tag strong {
  font-size: 1.15rem;
  color: var(--text-primary);
}

.savings-pill {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
}

/* ==========================================================================
   7. Calculators (Scientific Keypad, EMI breakdown)
   ========================================================================== */
.calc-screen {
  background: #000000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
  text-align: right;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calc-expression {
  font-size: 0.95rem;
  color: var(--text-muted);
  min-height: 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.calc-result {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-primary);
  overflow-x: auto;
  white-space: nowrap;
}

.calc-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.calc-btn {
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calc-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color);
  color: var(--gold-primary);
}

.calc-btn.op {
  color: var(--gold-primary);
  background: rgba(229, 9, 20, 0.08);
}

.calc-btn.action {
  color: var(--error);
  background: var(--error-bg);
}

.calc-btn.equals {
  background: var(--red-gradient);
  color: #ffffff;
  font-weight: 700;
  grid-column: span 2;
}
.calc-btn.equals:hover {
  background: var(--red-gradient-hover);
  color: #ffffff;
}

/* ==========================================================================
   8. Information, How-To & FAQ Sections on Tool Pages
   ========================================================================== */
.tool-info-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 32px;
}

.tool-info-section h3 {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.steps-list {
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.step-item {
  counter-increment: step-counter;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.step-item::before {
  content: counter(step-counter);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.faq-question {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.faq-question:hover {
  color: var(--gold-primary);
}

.faq-question svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-normal);
  color: var(--gold-primary);
}

.faq-item.active .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal), padding var(--transition-normal);
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  padding: 0 20px 16px 20px;
  max-height: 500px;
}
