/* ============================================================
   TOOLSHUB4U — DEVELOPER TOOLS (dw2 additions on top of tw2)
   Reuses the tw2 glass-card design block from text-writer.css.
   ============================================================ */

/* Code editors — monospace everywhere */
.dw2-input {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  tab-size: 2;
}

/* Size stats bar */
.dw2-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
}
.dw2-stat {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.dw2-stat strong {
  color: var(--text-primary);
  font-weight: 700;
  margin-right: 0.25rem;
}
.dw2-stat--accent strong {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Status note */
.dw2-note {
  margin: 0.8rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.dw2-note--error { color: var(--error); }
.dw2-note--error code { color: var(--error); }

/* Regex tester */
.dw2-testview {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
}
.dw2-match {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(168, 85, 247, 0.35));
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 1px;
}
.dw2-matches {
  margin: 0.9rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 220px;
  overflow: auto;
}
.dw2-matchrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.7rem;
}
.dw2-matchrow__idx {
  color: var(--primary);
  font-weight: 700;
  min-width: 1.6rem;
}
.dw2-matchrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; }
.dw2-matchrow__pos { color: var(--text-tertiary); font-size: 0.72rem; }

/* Color picker */
.dw2-swatch {
  width: 100%;
  height: 96px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 0.9rem;
  transition: background 0.15s ease;
}
.dw2-color-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.9rem;
}
.dw2-color-row input[type="color"] {
  width: 64px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  padding: 3px;
  cursor: pointer;
}

/* Visual builders (gradient / shadow / flexbox) */
.dw2-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 720px) {
  .dw2-builder { grid-template-columns: 1fr; }
}
.dw2-builder__controls {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.dw2-builder__preview {
  min-height: 220px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.dw2-builder__preview .dw2-fbox-item {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.dw2-builder__preview .dw2-shadow-box {
  width: 110px;
  height: 110px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.dw2-range-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 3.5rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.dw2-range-row input[type="range"] { accent-color: var(--primary); }
.dw2-range-row input[type="number"],
.dw2-range-row select {
  font: inherit;
  font-size: 0.82rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.25rem 0.4rem;
  min-width: 3.2rem;
}
.dw2-range-row select { min-width: 8rem; }

/* Diff view */
.dw2-diff {
  margin-top: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.82rem;
  max-height: 340px;
  overflow-y: auto;
}
.dw2-dline {
  display: flex;
  gap: 0.6rem;
  padding: 0.2rem 0.7rem;
  line-height: 1.55;
}
.dw2-dline code {
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-primary);
}
.dw2-dline__mark {
  flex: 0 0 1.1rem;
  text-align: center;
  font-weight: 800;
  color: var(--text-tertiary);
  user-select: none;
}
.dw2-dline--add { background: color-mix(in srgb, #10b981 14%, transparent); }
.dw2-dline--add .dw2-dline__mark { color: #10b981; }
.dw2-dline--del { background: color-mix(in srgb, #ef4444 14%, transparent); }
.dw2-dline--del .dw2-dline__mark { color: #ef4444; }
.dw2-dline--same code { color: var(--text-secondary); }

/* Markdown preview */
.dw2-md-preview {
  margin-top: 0.9rem;
  padding: 1rem 1.2rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 320px;
  overflow: auto;
}
.dw2-md-preview h1, .dw2-md-preview h2, .dw2-md-preview h3 { margin: 0.6rem 0 0.3rem; color: var(--text-primary); }
.dw2-md-preview p { margin: 0.4rem 0; }
.dw2-md-preview code { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 4px; padding: 0.1rem 0.3rem; font-size: 0.85em; }
.dw2-md-preview pre { background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem; overflow: auto; }
.dw2-md-preview pre code { border: none; background: none; padding: 0; }
.dw2-md-preview a { color: var(--primary); }
