/* ═══════════════════════════════════════════════════════════════════
   word-tool.css  -  Word Counter  |  Scoped under #wct-root
   Theme: Light / Orange accent - Premium SaaS
   ⚠  ALL selectors scoped to #wct-root - zero bleed to other tools
═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────── */
#wct-root {
  /* Backgrounds */
  --wct-bg:           #f8f5f2;
  --wct-surface:      #ffffff;
  --wct-surface2:     #fef9f5;
  --wct-surface3:     #fff4ec;

  /* Borders */
  --wct-border:       #ede8e3;
  --wct-border2:      #e0d8d0;

  /* Accent - vibrant orange */
  --wct-accent:       #f97316;
  --wct-accent2:      #fb923c;
  --wct-accent3:      #fed7aa;
  --wct-accent-dim:   rgba(249, 115, 22, 0.10);
  --wct-accent-glow:  rgba(249, 115, 22, 0.22);
  --wct-accent-ring:  rgba(249, 115, 22, 0.30);

  /* Semantic */
  --wct-ok:           #22c55e;
  --wct-ok-dim:       rgba(34, 197, 94, 0.12);
  --wct-info:         #3b82f6;
  --wct-info-dim:     rgba(59, 130, 246, 0.10);
  --wct-warn:         #f59e0b;

  /* Text */
  --wct-text:         #1c1917;
  --wct-text2:        #57534e;
  --wct-text3:        #78716c;
  --wct-muted:        #a8a29e;

  /* Type */
  --wct-sans:  'Outfit', system-ui, sans-serif;
  --wct-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Shape */
  --wct-radius:    14px;
  --wct-radius-sm:  9px;
  --wct-radius-xs:  5px;

  /* Shadows */
  --wct-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --wct-shadow:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --wct-shadow-lg: 0 12px 40px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);

  /* Transitions */
  --wct-ease: cubic-bezier(.25,.46,.45,.94);
  --wct-t:    160ms;

  font-family: var(--wct-sans);
  color: var(--wct-text);
  background: var(--wct-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Reset ─────────────────────────────────────────────────────── */
#wct-root *, #wct-root *::before, #wct-root *::after { box-sizing: border-box; }
#wct-root button { cursor: pointer; font-family: inherit; }
#wct-root textarea, #wct-root input, #wct-root select { font-family: inherit; }

/* ── Layout wrapper ────────────────────────────────────────────── */
#wct-root {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.wct-hero {
  text-align: center;
  padding: 48px 20px 36px;
}

.wct-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 99px;
  background: var(--wct-accent-dim);
  border: 1px solid var(--wct-accent-ring);
  color: var(--wct-accent);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.wct-hero-badge svg { width: 14px; height: 14px; }

.wct-hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--wct-text);
  margin: 0 0 14px;
  letter-spacing: -.02em;
}
.wct-hero h1 span { color: var(--wct-accent); }

.wct-hero p {
  font-size: 16px;
  color: var(--wct-text2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ── Main Grid ──────────────────────────────────────────────────── */
.wct-main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

/* ── Editor Card ─────────────────────────────────────────────────── */
.wct-editor-card {
  background: var(--wct-surface);
  border: 1px solid var(--wct-border);
  border-radius: var(--wct-radius);
  box-shadow: var(--wct-shadow);
  overflow: hidden;
}

.wct-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--wct-border);
  background: var(--wct-surface2);
}

.wct-editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--wct-text2);
}
.wct-editor-title svg { width: 16px; height: 16px; color: var(--wct-accent); }

.wct-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Textarea */
.wct-textarea {
  width: 100%;
  min-height: 380px;
  padding: 18px 20px;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.7;
  color: var(--wct-text);
  background: var(--wct-surface);
  display: block;
  transition: background var(--wct-t) var(--wct-ease);
}
.wct-textarea::placeholder { color: var(--wct-muted); }
.wct-textarea:focus { background: #fffdf9; }

/* Inline mini-stats bar under textarea */
.wct-inline-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid var(--wct-border);
  background: var(--wct-surface2);
  flex-wrap: wrap;
}
.wct-inline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--wct-accent-dim);
  border: 1px solid var(--wct-accent-ring);
  font-size: 12px;
  font-weight: 600;
  color: var(--wct-accent);
  white-space: nowrap;
}
.wct-inline-pill .wct-pill-val { font-variant-numeric: tabular-nums; }
.wct-inline-pill .wct-pill-lbl { color: var(--wct-text3); font-weight: 500; }

/* ── Action Buttons ─────────────────────────────────────────────── */
.wct-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--wct-radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--wct-t) var(--wct-ease);
  white-space: nowrap;
}
.wct-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.wct-btn-primary {
  background: var(--wct-accent);
  color: #fff;
  border-color: var(--wct-accent);
  box-shadow: 0 2px 8px var(--wct-accent-glow);
}
.wct-btn-primary:hover {
  background: #ea6c0a;
  border-color: #ea6c0a;
  box-shadow: 0 4px 14px var(--wct-accent-glow);
  transform: translateY(-1px);
}

.wct-btn-outline {
  background: transparent;
  color: var(--wct-text2);
  border-color: var(--wct-border2);
}
.wct-btn-outline:hover {
  background: var(--wct-accent-dim);
  border-color: var(--wct-accent-ring);
  color: var(--wct-accent);
}

.wct-btn-ghost {
  background: transparent;
  color: var(--wct-text3);
  border-color: transparent;
  padding: 7px 10px;
}
.wct-btn-ghost:hover {
  background: var(--wct-accent-dim);
  color: var(--wct-accent);
}

/* Copy feedback */
.wct-btn-copied {
  background: var(--wct-ok) !important;
  border-color: var(--wct-ok) !important;
  color: #fff !important;
}

/* ── Stats Sidebar ──────────────────────────────────────────────── */
.wct-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wct-stats-card {
  background: var(--wct-surface);
  border: 1px solid var(--wct-border);
  border-radius: var(--wct-radius);
  box-shadow: var(--wct-shadow);
  overflow: hidden;
}

.wct-card-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wct-muted);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--wct-border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.wct-card-title svg { width: 13px; height: 13px; color: var(--wct-accent); }

/* Stat rows */
.wct-stat-list { padding: 8px 0; }

.wct-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  transition: background var(--wct-t);
}
.wct-stat-row:hover { background: var(--wct-surface3); }
.wct-stat-row + .wct-stat-row {
  border-top: 1px solid var(--wct-border);
}

.wct-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--wct-text2);
  font-weight: 500;
}
.wct-stat-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--wct-accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wct-stat-icon svg { width: 13px; height: 13px; color: var(--wct-accent); }

.wct-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--wct-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  transition: color var(--wct-t);
}
.wct-stat-val.wct-updated { color: var(--wct-accent); }

/* Time stat - compact layout */
.wct-time-rows { padding: 8px 0; }
.wct-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  transition: background var(--wct-t);
}
.wct-time-row:hover { background: var(--wct-surface3); }
.wct-time-row + .wct-time-row { border-top: 1px solid var(--wct-border); }

.wct-time-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--wct-info-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wct-time-icon svg { width: 15px; height: 15px; color: var(--wct-info); }

.wct-time-info { flex: 1; min-width: 0; }
.wct-time-label { font-size: 11.5px; color: var(--wct-text3); font-weight: 500; margin-bottom: 1px; }
.wct-time-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--wct-text);
  font-variant-numeric: tabular-nums;
}

/* ── Top Words ───────────────────────────────────────────────────── */
.wct-words-card {
  background: var(--wct-surface);
  border: 1px solid var(--wct-border);
  border-radius: var(--wct-radius);
  box-shadow: var(--wct-shadow);
  overflow: hidden;
}

.wct-words-list { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 5px; }

.wct-word-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wct-word-rank {
  font-size: 10px;
  font-weight: 700;
  color: var(--wct-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.wct-word-bar-wrap { flex: 1; position: relative; }

.wct-word-bar-bg {
  height: 22px;
  border-radius: 5px;
  background: var(--wct-surface3);
  overflow: hidden;
  position: relative;
}

.wct-word-bar-fill {
  position: absolute;
  top: 0; left: 0; height: 100%;
  background: linear-gradient(90deg, var(--wct-accent), var(--wct-accent2));
  border-radius: 5px;
  transition: width 0.4s var(--wct-ease);
  opacity: .18;
}

.wct-word-text {
  position: absolute;
  top: 0; left: 8px; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--wct-text);
}

.wct-word-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--wct-accent);
  min-width: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wct-words-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--wct-muted);
  font-size: 13px;
}

/* ── Case Analysis ───────────────────────────────────────────────── */
.wct-case-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--wct-border);
  border-top: 1px solid var(--wct-border);
}

.wct-case-cell {
  background: var(--wct-surface);
  padding: 12px 14px;
  text-align: center;
}

.wct-case-pct {
  font-size: 22px;
  font-weight: 800;
  color: var(--wct-accent);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.wct-case-lbl {
  font-size: 11px;
  color: var(--wct-text3);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Sticky Mobile Stats Bar ─────────────────────────────────────── */
.wct-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--wct-surface);
  border-top: 2px solid var(--wct-accent);
  box-shadow: 0 -4px 20px rgba(0,0,0,.10);
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wct-sticky-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-width: max-content;
}

.wct-sticky-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--wct-surface3);
  border: 1px solid var(--wct-border);
  min-width: 60px;
}
.wct-sticky-pill .sp-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--wct-accent);
  font-variant-numeric: tabular-nums;
}
.wct-sticky-pill .sp-lbl {
  font-size: 10px;
  color: var(--wct-text3);
  font-weight: 500;
}

/* ── SEO Content Section ─────────────────────────────────────────── */
.wct-seo {
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--wct-border);
}

.wct-seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.wct-seo-card {
  background: var(--wct-surface);
  border: 1px solid var(--wct-border);
  border-radius: var(--wct-radius);
  padding: 24px;
  box-shadow: var(--wct-shadow-sm);
}
.wct-seo-card h3 {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--wct-text);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wct-seo-card h3 svg { width: 16px; height: 16px; color: var(--wct-accent); flex-shrink: 0; }
.wct-seo-card p {
  font-size: 13.5px;
  color: var(--wct-text2);
  line-height: 1.65;
  margin: 0;
}

/* FAQ */
.wct-faq-section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--wct-text);
  margin: 0 0 20px;
}

.wct-faq-list { display: flex; flex-direction: column; gap: 10px; }

.wct-faq-item {
  background: var(--wct-surface);
  border: 1px solid var(--wct-border);
  border-radius: var(--wct-radius-sm);
  overflow: hidden;
}

.wct-faq-q {
  width: 100%;
  background: none;
  border: none;
  padding: 15px 18px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--wct-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background var(--wct-t);
}
.wct-faq-q:hover { background: var(--wct-surface3); }
.wct-faq-q.open { color: var(--wct-accent); }

.wct-faq-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  transition: transform var(--wct-t) var(--wct-ease);
  color: var(--wct-muted);
}
.wct-faq-q.open .wct-faq-chevron { transform: rotate(180deg); color: var(--wct-accent); }

.wct-faq-a {
  display: none;
  padding: 0 18px 15px;
  font-size: 13.5px;
  color: var(--wct-text2);
  line-height: 1.65;
  border-top: 1px solid var(--wct-border);
}
.wct-faq-a.open { display: block; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .wct-main {
    grid-template-columns: 1fr;
  }
  .wct-sidebar {
    display: none; /* Hidden on mobile - use sticky bar instead */
  }
  .wct-sticky-bar { display: block; }
  #wct-root { padding-bottom: 100px; }
}

@media (max-width: 600px) {
  .wct-hero { padding: 32px 12px 24px; }
  .wct-textarea { min-height: 260px; }
  .wct-editor-header { flex-wrap: wrap; gap: 8px; }
  .wct-inline-bar { gap: 4px; }
  .wct-inline-pill { font-size: 11px; padding: 3px 8px; }
}

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes wct-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.wct-stat-val.wct-pulse { animation: wct-pulse 0.25s ease; }

@keyframes wct-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wct-word-row { animation: wct-fade-in 0.2s ease both; }
.wct-word-row:nth-child(1) { animation-delay: 0ms; }
.wct-word-row:nth-child(2) { animation-delay: 30ms; }
.wct-word-row:nth-child(3) { animation-delay: 60ms; }
.wct-word-row:nth-child(4) { animation-delay: 90ms; }
.wct-word-row:nth-child(5) { animation-delay: 120ms; }
