/* ==========================================================================
   WebUtilities Tools Stylesheet
   Workbench layout, interactive dropzones, controls, and output states.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tool Layout & Headers
   -------------------------------------------------------------------------- */
.tool-page-header {
  margin-bottom: 2.5rem;
}

.tool-header-badge-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tool-page-title {
  font-size: clamp(2rem, 3.5vw + 0.5rem, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

.tool-page-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 800px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Workbench (Main Tool Card)
   -------------------------------------------------------------------------- */
.tool-workbench {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 3.5rem;
  transition: border-color var(--transition-normal);
}

.tool-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.tool-grid-1col {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.tool-panel-title svg,
.tool-title-icon,
.tool-header-badge-row svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: 1.25rem !important;
  min-height: 1.25rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  stroke: currentColor;
  stroke-width: 2.2 !important;
  fill: none !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* --------------------------------------------------------------------------
   Interactive Dropzone
   -------------------------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-surface-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary-light);
  transform: scale(1.005);
}

.dropzone-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand-primary);
  box-shadow: var(--shadow-sm);
}

.dropzone-icon svg {
  width: 1.75rem;
  height: 1.75rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dropzone-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

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

.file-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-raised);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Forms, Controls, and Settings Panel
   -------------------------------------------------------------------------- */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.control-label {
  font-size: 0.835rem !important;
  font-weight: 650 !important;
  color: var(--text-secondary) !important;
  margin-bottom: 0.2rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  letter-spacing: 0.01em !important;
}

/* ==========================================================================
   Universal Form Controls: Inputs, Selects, and Textareas
   ========================================================================== */

/* Base input styling for single line fields */
.form-control,
.input-text,
.input-field,
.select-input,
.textarea-input,
.tool-panel input[type="text"],
.tool-panel input[type="number"],
.tool-panel input[type="search"],
.tool-panel input[type="email"],
.tool-panel input[type="url"],
.tool-panel input[type="password"],
.tool-panel select,
.tool-panel textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.925rem;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

/* Single-line Inputs height and padding */
.form-control:not(textarea):not(select),
.input-text,
.input-field,
.tool-panel input[type="text"],
.tool-panel input[type="number"],
.tool-panel input[type="search"],
.tool-panel input[type="email"],
.tool-panel input[type="url"],
.tool-panel input[type="password"] {
  height: 2.75rem;
  padding: 0.55rem 0.95rem;
  line-height: 1.5;
}

/* Dark mode inputs */
[data-theme="dark"] .form-control:not(textarea):not(select),
[data-theme="dark"] .input-text,
[data-theme="dark"] .input-field,
[data-theme="dark"] .tool-panel input[type="text"],
[data-theme="dark"] .tool-panel input[type="number"],
[data-theme="dark"] .tool-panel input[type="search"],
[data-theme="dark"] .tool-panel input[type="email"],
[data-theme="dark"] .tool-panel input[type="url"],
[data-theme="dark"] .tool-panel input[type="password"] {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hover & Focus States for all editable controls */
.form-control:hover:not([readonly]):not([disabled]),
.input-text:hover:not([readonly]):not([disabled]),
.input-field:hover:not([readonly]):not([disabled]),
.select-input:hover,
.tool-panel select:hover,
.tool-panel input:hover:not([readonly]):not([disabled]),
.tool-panel textarea:hover:not([readonly]):not([disabled]) {
  border-color: #94a3b8;
}

[data-theme="dark"] .form-control:hover:not([readonly]):not([disabled]),
[data-theme="dark"] .input-text:hover:not([readonly]):not([disabled]),
[data-theme="dark"] .input-field:hover:not([readonly]):not([disabled]),
[data-theme="dark"] .select-input:hover,
[data-theme="dark"] .tool-panel select:hover,
[data-theme="dark"] .tool-panel input:hover:not([readonly]):not([disabled]),
[data-theme="dark"] .tool-panel textarea:hover:not([readonly]):not([disabled]) {
  border-color: #3b4d6e;
}

.form-control:focus,
.input-text:focus,
.input-field:focus,
.select-input:focus,
.textarea-input:focus,
.tool-panel select:focus,
.tool-panel input:focus,
.tool-panel textarea:focus {
  outline: none !important;
  border-color: var(--color-brand-primary) !important;
  background-color: var(--bg-surface) !important;
  box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.16) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .input-text:focus,
[data-theme="dark"] .input-field:focus,
[data-theme="dark"] .select-input:focus,
[data-theme="dark"] .textarea-input:focus,
[data-theme="dark"] .tool-panel select:focus,
[data-theme="dark"] .tool-panel input:focus,
[data-theme="dark"] .tool-panel textarea:focus {
  background-color: var(--bg-surface-subtle) !important;
  box-shadow: 0 0 0 3.5px rgba(129, 140, 248, 0.22) !important;
}

/* Small input variant */
.form-control-sm,
.btn-sm {
  min-height: 32px !important;
  height: 32px !important;
  padding: 0.25rem 0.75rem !important;
  font-size: 0.825rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}

/* ==========================================================================
   Modern Dropdown Select Boxes with Custom SVG Chevron
   ========================================================================== */
select,
.select-input,
select.form-control,
.tool-panel select {
  height: 2.75rem;
  padding: 0.55rem 2.5rem 0.55rem 1rem !important;
  font-size: 0.925rem;
  font-weight: 550;
  line-height: 1.5;
  cursor: pointer;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: var(--bg-surface) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.85rem center !important;
  background-size: 1.15rem 1.15rem !important;
}

[data-theme="dark"] select,
[data-theme="dark"] .select-input,
[data-theme="dark"] select.form-control,
[data-theme="dark"] .tool-panel select {
  background-color: var(--bg-surface-subtle) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
}

select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
}

[data-theme="dark"] select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* ==========================================================================
   Textarea Input (Editable)
   ========================================================================== */
textarea:not([readonly]),
textarea.form-control:not([readonly]),
.textarea-input:not([readonly]),
.input-text:not([readonly]):is(textarea),
.tool-panel textarea:not([readonly]) {
  padding: 0.85rem 1.05rem !important;
  font-size: 0.925rem;
  line-height: 1.62;
  min-height: 110px;
  resize: vertical;
}

/* ==========================================================================
   Output Text Boxes & Code Workbenches (Readonly / Generated Content)
   ========================================================================== */
textarea[readonly],
textarea.form-control[readonly],
.textarea-input[readonly],
.input-text[readonly]:is(textarea),
.tool-panel textarea[readonly],
.output-textarea,
.output-box textarea,
.result-box textarea {
  background-color: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  font-family: var(--font-mono) !important;
  font-size: 0.885rem !important;
  line-height: 1.65 !important;
  color: #0f172a !important;
  padding: 1.1rem 1.25rem !important;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  letter-spacing: -0.01em !important;
  resize: vertical !important;
  min-height: 150px;
  cursor: text !important;
}

[data-theme="dark"] textarea[readonly],
[data-theme="dark"] textarea.form-control[readonly],
[data-theme="dark"] .textarea-input[readonly],
[data-theme="dark"] .input-text[readonly]:is(textarea),
[data-theme="dark"] .tool-panel textarea[readonly],
[data-theme="dark"] .output-textarea,
[data-theme="dark"] .output-box textarea,
[data-theme="dark"] .result-box textarea {
  background-color: #080d1a !important;
  border-color: #22304a !important;
  color: #f1f5f9 !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45) !important;
}

textarea[readonly]:focus,
textarea.form-control[readonly]:focus,
.textarea-input[readonly]:focus,
.tool-panel textarea[readonly]:focus {
  outline: none !important;
  border-color: var(--color-brand-primary) !important;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.04), 0 0 0 3px rgba(99, 102, 241, 0.16) !important;
}

/* Single-line Output Fields (e.g. hash, token, slug generator outputs) */
input[readonly]:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
input.form-control[readonly],
input.input-text[readonly] {
  background-color: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--radius-md) !important;
  color: #0f172a !important;
  font-family: var(--font-mono) !important;
  font-weight: 600 !important;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  cursor: text !important;
}

[data-theme="dark"] input[readonly]:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
[data-theme="dark"] input.form-control[readonly],
[data-theme="dark"] input.input-text[readonly] {
  background-color: #080d1a !important;
  border-color: #22304a !important;
  color: #f1f5f9 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45) !important;
}

input[readonly]:focus {
  outline: none !important;
  border-color: var(--color-brand-primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18) !important;
}

/* Custom Sleek Scrollbars for Textareas and Code Blocks */
textarea::-webkit-scrollbar,
pre::-webkit-scrollbar,
.custom-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
textarea::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 4px;
}
textarea::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
.custom-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
[data-theme="dark"] textarea::-webkit-scrollbar-thumb,
[data-theme="dark"] pre::-webkit-scrollbar-thumb,
[data-theme="dark"] .custom-scroll::-webkit-scrollbar-thumb {
  background: #2b3954;
}
textarea::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
[data-theme="dark"] textarea::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] pre::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .custom-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Range Slider */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex-grow: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-brand-primary);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  min-width: 3.5rem;
  text-align: right;
  color: var(--text-primary);
}

/* Checkbox & Toggle */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-custom {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Action Bar
   -------------------------------------------------------------------------- */
.tool-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Results & Preview Area
   -------------------------------------------------------------------------- */
.result-box {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.preview-container {
  max-width: 100%;
  max-height: 480px;
  overflow: auto;
  border-radius: var(--radius-md);
  background: repeating-conic-gradient(#80808020 0% 25%, transparent 0% 50%) 50% / 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 1px solid var(--border-color);
}

.preview-image,
.preview-canvas {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
}

/* Size Comparison Pill */
.comparison-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.size-original {
  color: var(--text-muted);
  text-decoration: line-through;
}

.size-compressed {
  color: var(--color-success);
  font-weight: 700;
}

.size-savings {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress-wrap {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  margin-top: 1rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

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

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Empty and Error States
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem auto;
  opacity: 0.5;
}

.alert-message {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid var(--color-danger);
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success);
}

/* --------------------------------------------------------------------------
   Diff Viewer
   -------------------------------------------------------------------------- */
.diff-container {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
}

.diff-line {
  display: flex;
  padding: 0.15rem 0.75rem;
}

.diff-line-num {
  width: 3rem;
  color: #64748b;
  user-select: none;
  flex-shrink: 0;
}

.diff-line-content {
  flex-grow: 1;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-add {
  background: var(--diff-add-bg);
  color: var(--diff-add-text);
}

.diff-del {
  background: var(--diff-del-bg);
  color: var(--diff-del-text);
}

/* --------------------------------------------------------------------------
   PDF Thumbnail Organizer Grid
   -------------------------------------------------------------------------- */
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

.pdf-page-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  position: relative;
}

.pdf-page-card:hover {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-md);
}

.pdf-thumb-canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.pdf-page-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-thumb-action {
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
}

.btn-thumb-action:hover {
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
}

/* --------------------------------------------------------------------------
   Educational Content Section on Tool Pages (Modern & Premium Redesign)
   -------------------------------------------------------------------------- */
.tool-info-section {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(310px, 1.1fr);
  gap: 2.75rem;
  margin-top: 3.5rem;
  align-items: start;
}

.tool-article {
  min-width: 0;
}

.tool-section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.tool-section-title:first-child {
  margin-top: 0;
}

.tool-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius-md);
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
  flex-shrink: 0;
}

.tool-title-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* Step-by-Step Guide (Modern Numbered Cards) */
.tool-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0;
  margin: 0 0 2rem 0;
}

.tool-step-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.tool-step-item:hover {
  border-color: var(--color-brand-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--color-brand-gradient);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 3px 6px rgba(99, 102, 241, 0.28);
  margin-top: 0.15rem;
}

.tool-step-text {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Callout Cards (Practical Example & Engine Notes) */
.tool-callout-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin: 1.25rem 0 2rem 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tool-callout-card:hover {
  box-shadow: var(--shadow-md);
}

.tool-callout-example {
  border-left: 4px solid var(--color-brand-secondary);
}

.tool-callout-limits {
  border-left: 4px solid var(--color-warning);
}

.tool-callout-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.tool-callout-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.tool-callout-example .tool-callout-badge {
  background: rgba(6, 182, 212, 0.12);
  color: var(--color-brand-secondary);
}

.tool-callout-limits .tool-callout-badge {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.tool-callout-badge svg {
  width: 14px;
  height: 14px;
}

.tool-callout-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0;
}

/* Backward compatibility classes */
.tool-example-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-brand-secondary);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin: 1.25rem 0 2rem 0;
  box-shadow: var(--shadow-sm);
}

.tool-limitations-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-warning);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin: 1.25rem 0 2rem 0;
  box-shadow: var(--shadow-sm);
}

/* Tool Security & Specs Aside (Sticky Card Dashboard) */
.tool-specs-aside {
  position: sticky;
  top: 5.5rem;
}

.tool-specs-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.tool-specs-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--color-brand-gradient);
}

.tool-specs-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
}

.tool-specs-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: var(--radius-lg);
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  flex-shrink: 0;
}

.tool-specs-shield svg {
  width: 1.4rem;
  height: 1.4rem;
}

.tool-specs-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.tool-specs-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-success);
}

.status-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-success);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.tool-specs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  transition: background var(--transition-fast);
}

.tool-spec-row:hover {
  background: var(--bg-surface-hover);
}

.tool-spec-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.tool-spec-label svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tool-spec-val {
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

.tool-spec-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 600;
}

.tool-spec-badge.badge-green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.25);
}

.tool-spec-badge.badge-indigo {
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
  border-color: rgba(99, 102, 241, 0.25);
}

.tool-specs-guarantee {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.tool-specs-guarantee svg {
  width: 16px;
  height: 16px;
  color: var(--color-success);
  flex-shrink: 0;
}

/* Related Tools Section */
.related-tools-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
}

.related-tools-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.related-tools-header-text {
  max-width: 600px;
}

.related-tools-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
  margin-bottom: 0.6rem;
}

.related-tools-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.related-tools-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.related-tools-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-brand-primary);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  transition: all var(--transition-fast);
}

.related-tools-link:hover {
  background: var(--color-brand-primary);
  color: #ffffff;
  border-color: var(--color-brand-primary);
  transform: translateX(2px);
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .tool-grid-2col { grid-template-columns: 1fr; }
  .tool-info-section { grid-template-columns: 1fr; gap: 2.25rem; }
  .tool-specs-aside { position: static; margin-top: 1rem; }
  .tool-workbench { padding: 1.5rem; }
  .related-tools-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* ==========================================================================
   Batch Processing & Multi-File Queue Styles
   ========================================================================== */
#batch-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.batch-wrapper {
  margin-top: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease-out;
  width: 100%;
}

.batch-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.batch-title-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.batch-counter-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
}

.batch-limits-pill {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.batch-summary-banner {
  padding: 0.85rem 1.25rem;
  background: rgba(16, 185, 129, 0.1);
  border-bottom: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--text-primary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.batch-summary-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.batch-summary-stats strong {
  color: #10b981;
}

.batch-overall-progress {
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.batch-items-list {
  display: flex;
  flex-direction: column;
  max-height: 440px;
  overflow-y: auto;
  divide-y: 1px solid var(--border-subtle);
}

.batch-item-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  gap: 1rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.batch-item-row:hover {
  background: var(--bg-surface-subtle);
}

.batch-item-thumb {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
}

.batch-item-thumb-placeholder {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  color: var(--text-tertiary);
  border: 1px solid var(--border-color);
}

.batch-item-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.batch-item-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.batch-item-meta .savings-tag {
  color: #10b981;
  font-weight: 700;
}

.batch-item-progress-track {
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.batch-item-progress-bar {
  height: 100%;
  background: var(--color-brand-primary);
  width: 0%;
  transition: width 0.2s ease;
}

.batch-item-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-queued {
  background: var(--bg-surface-subtle);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}

.status-processing {
  background: var(--color-brand-primary-light);
  color: var(--color-brand-primary);
  animation: pulse 1.5s infinite;
}

.status-done {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.batch-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-batch-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-batch-action:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-primary);
}

.btn-batch-action.btn-remove:hover {
  color: #ef4444;
}

.batch-footer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-zip-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-zip-download:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

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

/* ==========================================================================
   Tool Chaining & Pipeline Engine Styles
   ========================================================================== */

/* Pipeline Action Button (Beside Download) */
.btn-pipeline-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-pipeline-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-pipeline-action svg {
  stroke: #fbbf24;
  fill: #fbbf24;
}

/* Pipeline Modal & Backdrop */
.pipeline-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.pipeline-modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.pipeline-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pipeline-modal-backdrop.visible .pipeline-modal {
  transform: translateY(0) scale(1);
}

.pipeline-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.pipeline-header-title-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pipeline-brand-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.pipeline-modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.pipeline-modal-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.pipeline-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* File Summary Card inside modal */
.pipeline-file-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 1.5rem 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-surface-elevated, rgba(99, 102, 241, 0.05));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.pipeline-modal-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.pipeline-modal-thumb-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.pipeline-file-details {
  flex: 1;
  min-width: 0;
}

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

.pipeline-file-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.pipeline-source-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
}

/* Search bar inside modal */
.pipeline-search-row {
  padding: 0.75rem 1.5rem 0.5rem;
}

.pipeline-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.pipeline-search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.pipeline-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  font-size: 0.92rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pipeline-search-input::placeholder {
  color: var(--text-muted);
}

.pipeline-search-input:focus {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 3px var(--color-brand-primary-light);
}

.pipeline-search-wrap:focus-within .pipeline-search-icon {
  color: var(--color-brand-primary);
}

.pipeline-section-label {
  padding: 0.75rem 1.5rem 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Tools recommendations grid */
.pipeline-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  padding: 0.5rem 1.5rem 1.25rem;
  overflow-y: auto;
  max-height: 280px;
}

@media (max-width: 600px) {
  .pipeline-tools-grid {
    grid-template-columns: 1fr;
  }
}

.pipeline-tool-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.pipeline-tool-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  background: var(--bg-surface-elevated, var(--bg-hover));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pipeline-card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.pipeline-card-info {
  flex: 1;
  min-width: 0;
}

.pipeline-card-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-card-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.pipeline-card-arrow {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.15s, color 0.15s;
}

.pipeline-tool-card:hover .pipeline-card-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

.pipeline-no-results {
  grid-column: span 2;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Modal Footer */
.pipeline-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-elevated, var(--bg-surface));
}

.btn-pipeline-cancel {
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}

.btn-pipeline-download {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--text-primary);
  color: var(--bg-surface);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-pipeline-download:hover {
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Incoming Pipeline Banner (On Target Tool)
   -------------------------------------------------------------------------- */
.pipeline-incoming-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.35);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.pipeline-incoming-banner.loaded-auto {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.15));
  border-color: rgba(16, 185, 129, 0.4);
  transition: background 0.3s, border-color 0.3s;
}

.pipeline-incoming-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pipeline-incoming-icon {
  font-size: 1.5rem;
}

.pipeline-incoming-title {
  font-size: 0.92rem;
  color: var(--text-primary);
}

.pipeline-incoming-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.pipeline-incoming-sub code {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

.pipeline-incoming-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pipeline-load {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  background: #6366f1;
  color: #ffffff;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-pipeline-dismiss {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Floating Workflow Tray (Bottom-Right Chip)
   -------------------------------------------------------------------------- */
.pipeline-floating-tray {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
}

.pipeline-tray-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pipeline-tray-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
}

.pipeline-tray-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pipeline-tray-count {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.pipeline-tray-popover {
  position: absolute;
  bottom: calc(100% + 0.6rem);
  right: 0;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: popoverFade 0.2s ease;
}

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

.pipeline-tray-popover.open {
  display: flex;
}

.pipeline-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.85rem;
}

.pipeline-tray-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.pipeline-tray-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pipeline-tray-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated, var(--bg-hover));
}

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

.pipeline-tray-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-tray-item-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.btn-tray-route {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Advanced Tool Chaining — Chain Builder, Workflows & Saved Pipelines
   -------------------------------------------------------------------------- */

/* Scrollable modal body so extra sections never clip on short screens */
.pipeline-modal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Let the whole modal scroll instead of nesting a scroller in the grid */
.pipeline-modal-scroll .pipeline-tools-grid {
  overflow: visible;
  max-height: none;
  padding-bottom: 0.5rem;
}

/* Tool card + "add to chain" button */
.pipeline-tool-card-wrap {
  position: relative;
  display: flex;
}

.pipeline-tool-card-wrap .pipeline-tool-card {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.pipeline-card-add {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.pipeline-card-add:hover,
.pipeline-card-add:focus-visible {
  opacity: 1;
  transform: scale(1.08);
  border-color: #6366f1;
  color: #6366f1;
}

.pipeline-card-add.is-added {
  opacity: 1;
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

/* Chain builder strip */
.pipeline-chain-builder {
  margin: 0 1.5rem 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  background: var(--bg-surface-elevated, var(--bg-hover));
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pipeline-chain-builder.is-highlighted {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.pipeline-chain-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.pipeline-chain-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  max-width: 100%;
}

.pipeline-chain-chip.is-start {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(139, 92, 246, 0.16));
  border-color: rgba(99, 102, 241, 0.45);
}

.pipeline-chain-chip-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-chain-chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.1rem;
}

.pipeline-chain-chip-remove:hover {
  color: #ef4444;
}

.pipeline-chain-arrow {
  color: var(--text-muted);
  font-weight: 700;
}

.pipeline-chain-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pipeline-chain-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Starter workflows */
.pipeline-section-hint {
  margin: 0;
  padding: 0 1.5rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pipeline-workflow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  padding: 0 1.5rem 1.25rem;
}

.pipeline-workflow-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated, var(--bg-hover));
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.pipeline-workflow-card:hover,
.pipeline-workflow-card:focus-visible {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 8px 20px -10px rgba(99, 102, 241, 0.5);
}

.pipeline-workflow-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.pipeline-workflow-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pipeline-workflow-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.pipeline-workflow-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.pipeline-workflow-steps {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

/* Inline save / share row */
.pipeline-save-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface-elevated, var(--bg-hover));
  animation: slideDown 0.2s ease;
}

.pipeline-save-label {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pipeline-save-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pipeline-save-input {
  flex: 1;
  min-width: 180px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.pipeline-save-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-pipeline-save-confirm,
.btn-pipeline-copy-link,
.btn-pipeline-run-chain {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-pipeline-run-chain {
  background: linear-gradient(135deg, #10b981, #059669);
}

.btn-pipeline-save-confirm:hover,
.btn-pipeline-copy-link:hover,
.btn-pipeline-run-chain:hover {
  opacity: 0.92;
}

.btn-pipeline-save-cancel {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.pipeline-save-success {
  font-size: 0.85rem;
  color: #10b981;
  font-weight: 600;
}

.pipeline-share-url {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-canvas, var(--bg-surface));
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* --------------------------------------------------------------------------
   Running Workflow Banner (active chain)
   -------------------------------------------------------------------------- */
.pipeline-chain-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.15rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(16, 185, 129, 0.12));
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pipeline-chain-banner-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pipeline-chain-banner-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.pipeline-chain-banner-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pipeline-chain-banner-progress {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary);
}

.pipeline-chain-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pipeline-chain-next {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pipeline-chain-next.is-last {
  color: #10b981;
  font-weight: 700;
}

.btn-pipeline-exit-chain {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Tray: Saved Pipelines list
   -------------------------------------------------------------------------- */
.pipeline-tray-body {
  max-height: 340px;
  overflow-y: auto;
}

.pipeline-tray-body .pipeline-tray-list {
  max-height: none;
}

.pipeline-tray-section-label {
  padding: 0.6rem 0.85rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pipeline-tray-item-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-tray-run,
.btn-tray-share,
.btn-tray-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.btn-tray-run:hover,
.btn-tray-share:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-tray-delete:hover {
  border-color: #ef4444;
}

@media (max-width: 600px) {
  .pipeline-workflow-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-modal-footer {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .pipeline-modal-footer > button {
    flex: 1;
    justify-content: center;
  }

  .pipeline-chain-banner-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Reduced-motion friendly: keep the UI calm for motion-sensitive users */
@media (prefers-reduced-motion: reduce) {
  .pipeline-tool-card-wrap .pipeline-tool-card:hover ~ .pipeline-card-add,
  .pipeline-card-add:hover,
  .pipeline-workflow-card:hover {
    transform: none;
  }

  .pipeline-chain-banner,
  .pipeline-save-row,
  .pipeline-incoming-banner,
  .pipeline-tray-pulse {
    animation: none;
  }
}

/* ==========================================================================
   Enhanced Input/Output Styling for Network Tools
   ========================================================================== */

.input-field {
  background: var(--bg-canvas);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  line-height: 1.5;
  transition: all var(--transition-fast);
  resize: vertical;
}

.input-field:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: var(--bg-surface);
}

.input-field::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.output-display {
  background: var(--bg-canvas);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  line-height: 1.6;
  overflow-x: auto;
  word-break: break-word;
  white-space: pre-wrap;
  transition: all var(--transition-fast);
  min-height: 160px;
  max-height: 600px;
  overflow-y: auto;
}

.output-display:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  opacity: 0.6;
}

/* Enhanced table styling for DNS and network lookups */
.output-display table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.output-display table thead {
  background: var(--bg-surface-subtle);
  border-bottom: 2px solid var(--border-color);
}

.output-display table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.output-display table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.output-display table tbody tr:hover {
  background: var(--bg-surface-subtle);
}

/* Grid layout for structured output */
.output-display > div[style*="display:grid"] {
  gap: 1.5rem;
}

.output-display > div[style*="display:grid"] > div {
  padding: 0.75rem;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-primary);
}

.output-display strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Status indicators */
.status-success {
  color: #10b981;
  font-weight: 600;
}

.status-error {
  color: #ef4444;
  font-weight: 600;
}

.status-info {
  color: var(--color-primary);
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tool-grid-2col {
    grid-template-columns: 1fr;
  }

  .input-field,
  .output-display {
    font-size: 0.9rem;
  }

  .output-display table th,
  .output-display table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
}


