/* Text Styler — all rules scoped to .tstyler so nothing leaks into the theme. */

.tstyler {
  --tstyler-bg: #f7f8fb;
  --tstyler-card: #ffffff;
  --tstyler-card-hover: #f2f5ff;
  --tstyler-border: #e3e6ee;
  --tstyler-text: #1a1d26;
  --tstyler-muted: #667085;
  --tstyler-accent: #3b6fe0;
  --tstyler-accent-soft: rgba(59, 111, 224, .10);
  --tstyler-chip: #eef0f6;
  --tstyler-green: #16a34a;
  --tstyler-green-soft: rgba(22, 163, 74, .12);
  --tstyler-radius: 14px;

  box-sizing: border-box;
  margin: 0 auto;
  padding: var(--tstyler-pad, 20px);
  background: var(--tstyler-bg);
  border-radius: var(--tstyler-radius);
  color: var(--tstyler-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
}

/* Panel off — inherit the section background instead. */
.tstyler--bare {
  background: transparent;
  padding: 0;
}

.tstyler *,
.tstyler *::before,
.tstyler *::after { box-sizing: border-box; }

/* Must beat the display:flex on cards, or filtering silently does nothing. */
.tstyler [hidden] { display: none !important; }

.tstyler--theme-dark {
  --tstyler-bg: #0f1115;
  --tstyler-card: #181b22;
  --tstyler-card-hover: #1e222b;
  --tstyler-border: #2a2f3a;
  --tstyler-text: #e8eaf0;
  --tstyler-muted: #8b93a5;
  --tstyler-accent: #6c9eff;
  --tstyler-accent-soft: rgba(108, 158, 255, .13);
  --tstyler-chip: #1c2029;
  --tstyler-green: #4ade80;
  --tstyler-green-soft: rgba(74, 222, 128, .14);
}

@media (prefers-color-scheme: dark) {
  .tstyler--theme-auto {
    --tstyler-bg: #0f1115;
    --tstyler-card: #181b22;
    --tstyler-card-hover: #1e222b;
    --tstyler-border: #2a2f3a;
    --tstyler-text: #e8eaf0;
    --tstyler-muted: #8b93a5;
    --tstyler-accent: #6c9eff;
    --tstyler-accent-soft: rgba(108, 158, 255, .13);
    --tstyler-chip: #1c2029;
    --tstyler-green: #4ade80;
    --tstyler-green-soft: rgba(74, 222, 128, .14);
  }
}

/* --- reset theme/Elementor button + field styling inside the widget --- */
.tstyler button,
.tstyler input,
.tstyler textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: none;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}
.tstyler button {
  cursor: pointer;
  background: none !important;
  border: none !important;
  border-radius: 0;
  color: inherit;
  padding: 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  text-decoration: none;
  text-shadow: none;
  transform: none;
}
.tstyler button:focus-visible,
.tstyler input:focus-visible,
.tstyler textarea:focus-visible {
  outline: 2px solid var(--tstyler-accent);
  outline-offset: 2px;
}

.tstyler-sronly {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tstyler-header { text-align: center; margin-bottom: 18px; }
.tstyler-title {
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--tstyler-text);
}
.tstyler-sub { color: var(--tstyler-muted); font-size: .92em; margin: 6px 0 0; }

/* --- explainer copy --- */
.tstyler-intro {
  margin: 0 0 18px;
  color: var(--tstyler-text);
  font-size: .97em;
  line-height: 1.65;
}
.tstyler-intro p { margin: 0 0 10px; color: inherit; }
.tstyler-intro p:last-child { margin-bottom: 0; }
.tstyler-intro-where { color: var(--tstyler-muted); font-size: .93em; }
.tstyler-intro-where strong { color: var(--tstyler-text); }

/* --- 1-2-3 how-to strip --- */
.tstyler-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  counter-reset: none;
}
.tstyler-steps li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--tstyler-card);
  border: 1px solid var(--tstyler-border);
  border-radius: var(--tstyler-radius);
  padding: 13px 14px;
  margin: 0;
  list-style: none;
}
.tstyler-steps li::before,
.tstyler-steps li::marker { content: none; }
.tstyler-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--tstyler-accent-soft);
  color: var(--tstyler-accent);
  font-size: .85em;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.tstyler-step-body { display: block; font-size: .88em; color: var(--tstyler-muted); line-height: 1.5; }
.tstyler-step-body strong {
  display: block;
  color: var(--tstyler-text);
  font-size: 1.04em;
  font-weight: 600;
  margin-bottom: 2px;
}

/* --- small print --- */
.tstyler-note {
  margin: 26px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--tstyler-border);
  color: var(--tstyler-muted);
  font-size: .84em;
  line-height: 1.65;
}
.tstyler-note p { margin: 0 0 8px; color: inherit; }
.tstyler-note p:last-child { margin-bottom: 0; }
.tstyler-note strong { color: var(--tstyler-text); }

.tstyler-top { padding: 4px 0 2px; background: var(--tstyler-bg); }
.tstyler--sticky .tstyler-top {
  position: sticky;
  top: var(--tstyler-sticky-offset, 0px);
  z-index: 20;
}

.tstyler .tstyler-input {
  display: block;
  width: 100%;
  background: var(--tstyler-card) !important;
  color: var(--tstyler-text) !important;
  border: 1.5px solid var(--tstyler-border) !important;
  border-radius: var(--tstyler-radius);
  padding: 13px 15px;
  font-size: 1.05em;
  resize: vertical;
  min-height: 54px;
  transition: border-color .15s;
}
.tstyler .tstyler-input:focus { border-color: var(--tstyler-accent); outline: none; }

.tstyler-tabs { display: flex; gap: 6px; margin-top: 10px; }
.tstyler .tstyler-tab {
  flex: 1;
  background: var(--tstyler-chip) !important;
  color: var(--tstyler-muted);
  border: 1px solid transparent !important;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .9em;
  font-weight: 600;
  transition: .12s;
}
.tstyler .tstyler-tab.is-active {
  background: var(--tstyler-accent-soft) !important;
  color: var(--tstyler-accent);
  border-color: var(--tstyler-accent) !important;
}

.tstyler .tstyler-chips-label {
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tstyler-muted);
  margin: 16px 0 8px;
  font-weight: 600;
}
.tstyler-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tstyler .tstyler-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--tstyler-chip) !important;
  color: var(--tstyler-text);
  border: 1.5px solid var(--tstyler-border) !important;
  border-radius: 999px;
  padding: 9px 15px;
  font-size: .87em;
  font-weight: 600;
  white-space: nowrap;
  transition: .12s;
}
.tstyler .tstyler-chip:hover { border-color: var(--tstyler-accent) !important; background: var(--tstyler-card-hover) !important; }
.tstyler .tstyler-chip:active { transform: scale(.97); }
.tstyler .tstyler-chip .tstyler-count {
  background: rgba(128, 140, 165, .22);
  color: var(--tstyler-muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: .74em;
  font-weight: 700;
}
.tstyler .tstyler-chip.is-active {
  background: var(--tstyler-accent-soft) !important;
  color: var(--tstyler-accent);
  border-color: var(--tstyler-accent) !important;
}
.tstyler .tstyler-chip.is-active .tstyler-count {
  background: var(--tstyler-accent);
  color: var(--tstyler-bg);
}

.tstyler .tstyler-search {
  display: block;
  width: 100%;
  background: var(--tstyler-card) !important;
  color: var(--tstyler-text) !important;
  border: 1.5px solid var(--tstyler-border) !important;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: .9em;
  margin-top: 12px;
}
.tstyler .tstyler-search:focus { border-color: var(--tstyler-accent); outline: none; }

/* Flex column so the Top Styles view can be ordered by rank via `order`. */
.tstyler-results { display: flex; flex-direction: column; }

.tstyler-card {
  background: var(--tstyler-card);
  border: 1px solid var(--tstyler-border);
  border-radius: var(--tstyler-radius);
  padding: 13px 15px;
  margin-top: 11px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background .12s;
}
.tstyler-card:hover { background: var(--tstyler-card-hover); }
.tstyler-info { flex: 1; min-width: 0; }
.tstyler-name {
  font-size: .72em;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tstyler-muted);
  margin-bottom: 5px;
  font-weight: 600;
}
.tstyler-preview {
  font-size: 1.15em;
  word-break: break-word;
  line-height: 1.55;
  color: var(--tstyler-text);
}
.tstyler-preview.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: .95em;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.3;
}

.tstyler .tstyler-copy {
  flex-shrink: 0;
  background: var(--tstyler-accent-soft) !important;
  color: var(--tstyler-accent) !important;
  border-radius: 9px;
  padding: 10px 17px;
  font-size: .85em;
  font-weight: 600;
  transition: transform .08s, background .12s, color .12s;
}
.tstyler .tstyler-copy:hover { transform: scale(1.04); }
.tstyler .tstyler-copy:active { transform: scale(.97); }
.tstyler .tstyler-copy.is-copied { background: var(--tstyler-green-soft) !important; color: var(--tstyler-green) !important; }

.tstyler-banner {
  background: var(--tstyler-card);
  border: 1px solid var(--tstyler-border);
  border-radius: var(--tstyler-radius);
  padding: 12px 14px 14px;
  margin-top: 11px;
}
.tstyler-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.tstyler-banner-head .tstyler-name { margin-bottom: 0; }
.tstyler .tstyler-banner-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  font-variant-ligatures: none;
  white-space: pre;
  overflow-x: auto;
  margin: 0 !important;
  padding: 0 0 4px !important;
  background: none !important;
  border: none !important;
  border-radius: 0;
  color: var(--tstyler-text) !important;
  max-width: none;
  text-shadow: none;
}

.tstyler-empty,
.tstyler-loading {
  text-align: center;
  color: var(--tstyler-muted);
  padding: 36px 0;
  font-size: .95em;
}

.tstyler-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(14px);
  background: var(--tstyler-green-soft);
  color: var(--tstyler-green);
  border: 1px solid var(--tstyler-green);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: .87em;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 9999;
  backdrop-filter: blur(8px);
}
.tstyler-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 700px) {
  .tstyler-steps { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 600px) {
  .tstyler-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .tstyler .tstyler-copy { width: 100%; }
  .tstyler .tstyler-banner-pre { font-size: 10px; }
}
