/**
 * Text Analysis Tools - Hero Live Analyzer, Category Directory,
 * 30 Custom Tool Workspaces, Diff Highlighter, SERP Preview & Educational Sections
 */

/* Homepage Hero with Lightweight Animated Background */
.tat-hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2.25rem, 5vw, 4rem);
  border-bottom: 1px solid var(--tat-border);
  background-color: var(--tat-bg);
}

.tat-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.tat-hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--tat-border-strong) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.42;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 35%, transparent 100%);
}

.tat-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.24;
  will-change: transform, opacity;
  animation: tatOrbFloat 14s ease-in-out infinite alternate;
}

.tat-hero-orb-1 {
  width: 380px;
  height: 380px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
}

.tat-hero-orb-2 {
  width: 340px;
  height: 340px;
  bottom: -120px;
  right: -60px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  animation-delay: -7s;
}

@keyframes tatOrbFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.2;
  }
  100% {
    transform: translate3d(24px, 18px, 0) scale(1.06);
    opacity: 0.3;
  }
}

.tat-hero-inner {
  position: relative;
  z-index: 1;
}

.tat-hero-header {
  text-align: center;
  max-width: 780px;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.tat-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--tat-radius-pill);
  background-color: var(--tat-primary-soft);
  color: var(--tat-primary);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
}

html[data-theme="dark"] .tat-hero-kicker {
  color: #c7d2fe;
}

.tat-hero-desc {
  font-size: clamp(1.02rem, 1.8vw, 1.18rem);
  color: var(--tat-text-secondary);
  max-width: 65ch;
  margin-inline: auto;
  margin-bottom: 0;
}

/* Hero Live Text Box */
.tat-hero-workspace {
  background-color: var(--tat-surface);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-xl);
  box-shadow: var(--tat-shadow-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.tat-editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.tat-live-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tat-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  background-color: var(--tat-bg-muted);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-pill);
  color: var(--tat-text);
}

.tat-live-pill strong {
  color: var(--tat-primary);
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .tat-live-pill strong {
  color: #a5b4fc;
}

.tat-hero-textarea {
  min-height: 210px;
  font-size: 1rem;
  background-color: var(--tat-bg-subtle);
}

.tat-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.tat-btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

/* Live Stats Dashboard Grid (9 Metrics) */
.tat-dashboard-section {
  margin-top: 1.5rem;
}

.tat-dashboard-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.tat-dashboard-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tat-text-muted);
  margin: 0;
}

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

@media (min-width: 640px) {
  .tat-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .tat-stats-grid-9 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .tat-stats-grid-9 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .tat-stats-grid-9 .tat-stat-card-highlight {
    grid-column: span 2;
  }
}

.tat-stat-card {
  background-color: var(--tat-surface);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--tat-shadow-xs);
  min-width: 0;
}

.tat-stat-card-highlight {
  border-color: rgba(79, 70, 229, 0.35);
  background: linear-gradient(180deg, var(--tat-primary-soft) 0%, var(--tat-surface) 100%);
}

.tat-stat-value {
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--tat-text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.tat-stat-label {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tat-text-muted);
}

/* Tool Directory Search, Filter Pills & Category Sections */
.tat-directory-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tat-search-box {
  position: relative;
  max-width: 540px;
  width: 100%;
}

.tat-search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tat-text-muted);
  pointer-events: none;
}

.tat-search-input {
  padding-left: 2.6rem;
  padding-right: 2.6rem;
  min-height: 46px;
}

.tat-search-clear {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--tat-text-muted);
  cursor: pointer;
  padding: 0;
  border-radius: var(--tat-radius-sm);
}

.tat-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tat-filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--tat-radius-pill);
  border: 1px solid var(--tat-border-strong);
  background-color: var(--tat-surface);
  color: var(--tat-text-secondary);
  cursor: pointer;
  transition: all var(--tat-transition);
}

@media (max-width: 767px) {
  .tat-filter-pill {
    min-height: 44px;
  }
}

.tat-filter-pill:hover {
  border-color: var(--tat-primary);
  color: var(--tat-primary);
}

.tat-filter-pill.is-active {
  background: var(--tat-gradient);
  border-color: transparent;
  color: #ffffff;
}

.tat-category-block {
  margin-bottom: 2.75rem;
}

.tat-category-block.is-hidden {
  display: none;
}

.tat-category-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--tat-border);
}

.tat-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .tat-tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .tat-tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tat-tool-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  height: 100%;
  padding: 1.2rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-lg);
  box-shadow: var(--tat-shadow-xs);
  transition: transform var(--tat-transition), box-shadow var(--tat-transition), border-color var(--tat-transition);
  min-width: 0;
}

html[data-theme="dark"] .tat-tool-card {
  background: linear-gradient(180deg, #162033 0%, #111829 100%);
  border-color: #24324a;
}

.tat-tool-card.is-hidden {
  display: none;
}

.tat-tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -6px rgba(79, 70, 229, 0.16), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  border-color: rgba(79, 70, 229, 0.48);
}

html[data-theme="dark"] .tat-tool-card:hover {
  box-shadow: 0 12px 26px -6px rgba(0, 0, 0, 0.55);
  border-color: rgba(129, 140, 248, 0.55);
}

.tat-tool-graphic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(124, 58, 237, 0.08) 55%, rgba(37, 99, 235, 0.1) 100%);
  border: 1px solid rgba(99, 102, 241, 0.16);
  flex-shrink: 0;
  transition: transform var(--tat-transition), border-color var(--tat-transition);
}

html[data-theme="dark"] .tat-tool-graphic {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(139, 92, 246, 0.15) 55%, rgba(59, 130, 246, 0.16) 100%);
  border-color: rgba(129, 140, 248, 0.25);
}

.tat-tool-card:hover .tat-tool-graphic {
  transform: scale(1.04);
  border-color: rgba(79, 70, 229, 0.35);
}

.tat-tool-svg {
  width: 52px;
  height: 52px;
  display: block;
}

.tat-tool-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.tat-tool-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.35rem;
  color: var(--tat-text);
}

.tat-tool-card-title a {
  color: inherit;
  text-decoration: none;
}

.tat-tool-card-title a:hover {
  color: var(--tat-primary);
}

html[data-theme="dark"] .tat-tool-card-title a:hover {
  color: #c7d2fe;
}

.tat-tool-card-desc {
  font-size: 0.89rem;
  line-height: 1.52;
  color: var(--tat-text-secondary);
  margin-bottom: 0.85rem;
  flex: 1;
}

.tat-tool-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tat-primary);
  margin-top: auto;
  width: fit-content;
}

.tat-tool-card-link svg {
  transition: transform var(--tat-transition);
}

.tat-tool-card:hover .tat-tool-card-link svg {
  transform: translateX(3px);
}

html[data-theme="dark"] .tat-tool-card-link {
  color: #a5b4fc;
}

/* Individual Tool Page Workspace */
.tat-tool-workspace {
  background-color: var(--tat-surface);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-xl);
  box-shadow: var(--tat-shadow-md);
  padding: clamp(1rem, 2.5vw, 1.75rem);
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.tat-tool-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--tat-border);
}

.tat-tool-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  background-color: var(--tat-bg-subtle);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  margin-bottom: 1rem;
}

.tat-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 820px) {
  .tat-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tat-panel-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.tat-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tat-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block: 0.85rem;
}

.tat-results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .tat-results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .tat-results-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Responsive Data Tables */
.tat-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  margin-top: 1rem;
}

.tat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.tat-table th,
.tat-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--tat-border);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.tat-table th {
  background-color: var(--tat-bg-subtle);
  font-weight: 700;
  color: var(--tat-text);
  white-space: nowrap;
}

.tat-table tbody tr:last-child td {
  border-bottom: 0;
}

.tat-table tbody tr:hover {
  background-color: var(--tat-bg-subtle);
}

/* Visual Bar Meter */
.tat-meter-track {
  width: 100%;
  height: 10px;
  background-color: var(--tat-bg-muted);
  border-radius: var(--tat-radius-pill);
  overflow: hidden;
  margin-block: 0.5rem;
}

.tat-meter-fill {
  height: 100%;
  background: var(--tat-gradient);
  border-radius: var(--tat-radius-pill);
  transition: width 160ms ease;
}

.tat-meter-fill.is-optimal {
  background: var(--tat-success);
}

.tat-meter-fill.is-warning {
  background: var(--tat-warning);
}

.tat-meter-fill.is-danger {
  background: var(--tat-danger);
}

/* Text Diff Viewer */
.tat-diff-output {
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  background-color: var(--tat-bg-subtle);
  padding: 1rem;
  font-family: var(--tat-font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 1rem;
}

.tat-diff-line {
  display: block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.tat-diff-added {
  background-color: var(--tat-success-bg);
  color: var(--tat-success);
  text-decoration: none;
}

.tat-diff-removed {
  background-color: var(--tat-danger-bg);
  color: var(--tat-danger);
  text-decoration: line-through;
}

/* Google SERP Preview Card (SEO Title & Meta Description Tools) */
.tat-serp-card {
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  padding: 1.15rem 1.25rem;
  background-color: #ffffff;
  color: #202124;
  max-width: 650px;
  margin-top: 1rem;
}

html[data-theme="dark"] .tat-serp-card {
  background-color: #161b26;
  color: #e2e8f0;
}

.tat-serp-url {
  font-size: 0.82rem;
  color: #4d5156;
  margin-bottom: 0.25rem;
  word-break: break-all;
}

html[data-theme="dark"] .tat-serp-url {
  color: #94a3b8;
}

.tat-serp-title {
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.3;
  color: #1a0dab;
  margin-bottom: 0.3rem;
  word-break: break-word;
}

html[data-theme="dark"] .tat-serp-title {
  color: #8ab4f8;
}

.tat-serp-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #4d5156;
  margin: 0;
  word-break: break-word;
}

html[data-theme="dark"] .tat-serp-desc {
  color: #cbd5e1;
}

/* Educational Content & FAQ Accordion */
.tat-edu-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.tat-edu-grid > *,
.tat-example-grid > *,
.tat-two-col > * {
  min-width: 0;
}

.tat-edu-block {
  background-color: var(--tat-surface);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-lg);
  padding: clamp(1.15rem, 2.5vw, 1.65rem);
  min-width: 0;
}

.tat-formula-box {
  background-color: var(--tat-bg-subtle);
  border-left: 4px solid var(--tat-primary);
  border-radius: 0 var(--tat-radius-md) var(--tat-radius-md) 0;
  padding: 1rem 1.2rem;
  margin-block: 1rem;
  font-family: var(--tat-font-mono);
  font-size: 0.92rem;
  color: var(--tat-text);
  overflow-x: auto;
  max-width: 100%;
}

.tat-example-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 768px) {
  .tat-example-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tat-example-card {
  background-color: var(--tat-bg-subtle);
  border: 1px solid var(--tat-border);
  border-radius: var(--tat-radius-md);
  padding: 1rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.tat-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.tat-faq-item summary {
  padding: 0.95rem 1.15rem;
  font-weight: 700;
  color: var(--tat-text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tat-faq-item summary::-webkit-details-marker {
  display: none;
}

.tat-faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--tat-primary);
  flex-shrink: 0;
}

.tat-faq-item[open] summary::after {
  content: "−";
}

.tat-faq-answer {
  padding: 0 1.15rem 1rem;
  color: var(--tat-text-secondary);
}

.tat-faq-answer p:last-child {
  margin-bottom: 0;
}

/* WordPress Notice Box */
.tat-notice-note {
  font-size: 0.84rem;
  color: var(--tat-text-muted);
  margin-top: 0.65rem;
}
