/* Smart Text Cleaner-specific interface; global LuxTool components remain in /style.css. */
.tclean-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: fit-content;
  margin: 0 auto 1rem;
  padding: .55rem .85rem;
  color: #6ee7b7;
  background: rgba(16, 185, 129, .08);
  border: 1px solid rgba(52, 211, 153, .22);
  border-radius: 999px;
  font-size: .8rem;
}

.tclean-privacy svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
}

.tclean-privacy span {
  color: var(--muted);
}

.tclean-panel {
  position: relative;
  width: min(100%, 1380px) !important;
  margin-inline: auto !important;
}

.tclean-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tclean-preset-field {
  width: min(100%, 280px);
}

.tclean-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}

.tclean-toolbar .btn:disabled {
  cursor: not-allowed;
  opacity: .4;
  transform: none;
  box-shadow: none;
}

.tclean-danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, .3);
  background: rgba(248, 113, 113, .08);
}

.tclean-danger:hover {
  color: #fecaca;
  background: rgba(248, 113, 113, .18);
}

.tclean-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tclean-editor {
  min-width: 0;
}

.tclean-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 1.8rem;
}

.tclean-editor-head .lux-label {
  margin: 0;
}

.tclean-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .3rem .65rem;
  color: var(--muted);
  font-size: .68rem;
}

.tclean-stats strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tclean-textarea {
  display: block;
  min-height: 330px;
  margin-top: .5rem;
  line-height: 1.65;
}

.tclean-output {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 4%, var(--surface2));
}

.tclean-primary-actions {
  margin-top: 1rem;
}

.tclean-smart-btn {
  width: 100%;
  gap: .55rem;
  min-height: 48px;
  font-size: .95rem;
}

.tclean-smart-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.tclean-smart-btn kbd {
  padding: .18rem .4rem;
  margin-left: .25rem;
  color: rgba(15, 23, 42, .65);
  background: rgba(255, 255, 255, .36);
  border: 1px solid rgba(15, 23, 42, .16);
  border-radius: .3rem;
  font: 600 .67rem/1 inherit;
}

.tclean-smart-btn[aria-busy="true"] {
  cursor: wait;
  opacity: .75;
}

.tclean-output-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  margin-top: 1rem;
}

.tclean-output-actions > .btn {
  min-width: min(100%, 240px);
}

.tclean-secondary-actions {
  display: flex;
  justify-content: flex-end;
  gap: .85rem;
}

.tclean-text-btn {
  padding: .2rem 0;
  color: var(--muted);
  background: none;
  border: 0;
  font: 600 .75rem/1.3 inherit;
  cursor: pointer;
  transition: color .2s ease;
}

.tclean-text-btn:hover,
.tclean-text-btn:focus-visible {
  color: var(--gold);
}

.tclean-results {
  padding: 1rem;
  margin-top: 1rem;
  background: rgba(16, 185, 129, .07);
  border: 1px solid rgba(52, 211, 153, .22);
  border-radius: .8rem;
}

.tclean-result-heading {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.tclean-result-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  color: #052e22;
  background: #6ee7b7;
  border-radius: 50%;
  font-weight: 900;
}

.tclean-result-heading h2 {
  color: #6ee7b7;
  font-size: 1rem;
}

.tclean-results ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem .8rem;
  margin: .8rem 0 0;
  padding: 0;
  list-style: none;
}

.tclean-results li {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  padding: .45rem .6rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border-radius: .45rem;
  font-size: .75rem;
}

.tclean-results li strong {
  color: #6ee7b7;
  font-variant-numeric: tabular-nums;
}

.tclean-results .tclean-no-changes {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.tclean-advanced {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: .8rem;
  overflow: hidden;
}

.tclean-advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
  cursor: pointer;
  list-style: none;
  transition: background .2s ease;
}

.tclean-advanced summary::-webkit-details-marker {
  display: none;
}

.tclean-advanced summary:hover {
  background: color-mix(in srgb, var(--gold) 7%, var(--surface));
}

.tclean-advanced summary span:first-child {
  display: flex;
  flex-direction: column;
  gap: .12rem;
}

.tclean-advanced summary strong {
  font-size: .85rem;
}

.tclean-advanced summary small {
  color: var(--muted);
  font-size: .7rem;
}

.tclean-chevron {
  color: var(--gold);
  font-size: 1.2rem;
  transition: transform .2s ease;
}

.tclean-advanced[open] .tclean-chevron {
  transform: rotate(180deg);
}

.tclean-options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.tclean-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-width: 0;
  padding: .7rem;
  background: color-mix(in srgb, var(--text) 3%, var(--surface));
  border: 1px solid transparent;
  border-radius: .6rem;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.tclean-option:hover {
  border-color: var(--gold-dim);
  transform: translateY(-1px);
}

.tclean-option:has(input:checked) {
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
  border-color: var(--gold-dim);
}

.tclean-option-risk:has(input:checked) {
  background: rgba(248, 113, 113, .07);
  border-color: rgba(248, 113, 113, .3);
}

.tclean-option input {
  width: 1rem;
  height: 1rem;
  margin: .12rem 0 0;
  accent-color: var(--gold);
  flex: 0 0 auto;
}

.tclean-option:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.tclean-option span {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .18rem;
}

.tclean-option strong {
  color: var(--text);
  font-size: .78rem;
}

.tclean-option small {
  color: var(--muted);
  font-size: .67rem;
  line-height: 1.35;
}

.tclean-toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 1000;
  max-width: min(360px, calc(100vw - 2rem));
  padding: .72rem 1rem;
  color: #a7f3d0;
  background: color-mix(in srgb, #052e22 88%, var(--surface));
  border: 1px solid rgba(52, 211, 153, .35);
  border-radius: .7rem;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .28);
  font-size: .84rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
}

.tclean-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tclean-toast.info {
  color: var(--gold);
  background: color-mix(in srgb, var(--surface) 92%, var(--gold));
  border-color: var(--gold-dim);
}

.tclean-toast.error {
  color: #fecaca;
  background: color-mix(in srgb, #450a0a 88%, var(--surface));
  border-color: rgba(248, 113, 113, .4);
}

html.theme-light .tclean-privacy,
html.theme-light .tclean-result-heading h2,
html.theme-light .tclean-results li strong {
  color: #047857;
}

html.theme-light .tclean-result-check {
  color: #fff;
  background: #059669;
}

html.theme-light .tclean-toast {
  color: #065f46;
  background: #ecfdf5;
  border-color: rgba(5, 150, 105, .32);
}

html.theme-light .tclean-toast.info {
  color: var(--gold);
  background: #fffbeb;
}

html.theme-light .tclean-toast.error {
  color: #991b1b;
  background: #fef2f2;
}

@media (min-width: 1000px) {
  .tool-page > .panel.tclean-panel:has(#tclean-input) {
    display: block !important;
  }

  .tool-page > .panel.tclean-panel:has(#tclean-input) > * {
    grid-column: auto !important;
    grid-row: auto !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
}

@media (max-width: 900px) {
  .tclean-workspace {
    grid-template-columns: 1fr;
  }

  .tclean-textarea {
    min-height: 250px;
  }

  .tclean-options-grid,
  .tclean-results ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tclean-privacy {
    align-items: flex-start;
    width: 100%;
    border-radius: .7rem;
    line-height: 1.35;
  }

  .tclean-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tclean-preset-field {
    width: 100%;
  }

  .tclean-toolbar {
    justify-content: stretch;
  }

  .tclean-toolbar .btn {
    flex: 1 1 calc(50% - .45rem);
  }

  .tclean-editor-head {
    align-items: flex-start;
    flex-direction: column;
    gap: .25rem;
  }

  .tclean-stats {
    justify-content: flex-start;
  }

  .tclean-options-grid,
  .tclean-results ul {
    grid-template-columns: 1fr;
  }

  .tclean-output-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tclean-output-actions > .btn {
    width: 100%;
  }

  .tclean-secondary-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .tclean-smart-btn kbd {
    display: none;
  }

  .tclean-toast {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tclean-option,
  .tclean-chevron,
  .tclean-toast {
    transition: none;
  }
}
