/* ============================================================
   CVCORE — features.css
   ATS Scanner · Completeness Meter · Spell Check · Job Title AI
   ============================================================ */

/* ──────────────────────────────────────────────
   COMPLETENESS METER
────────────────────────────────────────────── */
.meter-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.meter-ring-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.meter-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.meter-track {
  fill: none;
  stroke: var(--surface3);
  stroke-width: 3.5;
}

.meter-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s cubic-bezier(.4,0,.2,1), stroke 0.4s ease;
}

.meter-pct {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
  transition: color 0.4s ease;
  white-space: nowrap;
}

.meter-info { flex: 1; min-width: 0; }

.meter-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.meter-missing {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.3s;
}

/* Inline meter in nav bar */
.nav-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.nav-meter:hover { border-color: var(--border2); }
.nav-meter-ring {
  width: 28px; height: 28px;
  flex-shrink: 0;
}
.nav-meter-ring .meter-track { stroke-width: 4; }
.nav-meter-ring .meter-fill  { stroke-width: 4; }
.nav-meter-ring .meter-pct   { font-size: 0.5rem; }
.nav-meter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Completeness panel (shown in step footer or panel) */
.completeness-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.completeness-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.625rem;
}
.completeness-bar-outer {
  height: 4px;
  background: var(--surface3);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.completeness-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.6s cubic-bezier(.4,0,.2,1), background 0.3s;
}
.completeness-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.completeness-item {
  font-size: 0.7rem;
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  border: 1px solid;
}
.completeness-item.done {
  background: rgba(200,255,71,.08);
  border-color: rgba(200,255,71,.2);
  color: var(--accent);
}
.completeness-item.todo {
  background: rgba(248,113,113,.06);
  border-color: rgba(248,113,113,.15);
  color: #f87171;
}

/* ──────────────────────────────────────────────
   ATS KEYWORD SCANNER
────────────────────────────────────────────── */
.ats-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ats-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 110px;
  max-height: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ats-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,255,71,.06);
}
.ats-textarea::placeholder { color: var(--text-faint); }

.ats-score-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

.ats-score-num {
  font-size: 1.5rem;
  font-weight: 900;
  font-family: var(--serif);
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.3s;
}

.ats-score-track {
  flex: 1;
  height: 5px;
  background: var(--surface3);
  border-radius: 100px;
  overflow: hidden;
}

.ats-score-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1), background 0.3s;
}

.ats-score-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

.ats-keywords-section {
  margin-top: 0.875rem;
}

.ats-kw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ats-kw-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ats-kw-count {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 100px;
}

.ats-kw-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.ats-kw {
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-weight: 500;
}

.ats-kw.matched {
  background: rgba(200,255,71,.1);
  color: var(--accent);
  border: 1px solid rgba(200,255,71,.2);
}

.ats-kw.missing {
  background: rgba(248,113,113,.08);
  color: #f87171;
  border: 1px solid rgba(248,113,113,.15);
  cursor: pointer;
  transition: all 0.2s;
}
.ats-kw.missing:hover {
  background: rgba(248,113,113,.15);
}

.ats-tip {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.625rem;
  line-height: 1.55;
  padding: 0.625rem 0.75rem;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-border);
}

/* ──────────────────────────────────────────────
   SPELL CHECK
────────────────────────────────────────────── */
.spell-error {
  text-decoration: underline wavy #f87171;
  text-underline-offset: 2px;
  cursor: help;
  position: relative;
}

.spell-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.2);
  color: #f87171;
  cursor: pointer;
  transition: all 0.2s;
}
.spell-badge:hover { background: rgba(248,113,113,.18); }
.spell-badge.clear {
  background: rgba(200,255,71,.08);
  border-color: rgba(200,255,71,.2);
  color: var(--accent);
  cursor: default;
}

/* Spell check dropdown suggestion */
.spell-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 180px;
  overflow: hidden;
}
.spell-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}
.spell-dropdown-item:hover { background: var(--surface2); }
.spell-dropdown-item .fix { color: var(--accent); font-weight: 600; }

/* Spell check indicator in step header */
.spell-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  margin-left: 0.75rem;
}
.spell-indicator.has-errors {
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.2);
  color: #f87171;
}
.spell-indicator.no-errors {
  background: rgba(200,255,71,.08);
  border: 1px solid rgba(200,255,71,.18);
  color: var(--accent);
}

/* ──────────────────────────────────────────────
   JOB TITLE AUTOCOMPLETE
────────────────────────────────────────────── */
.jt-wrapper { position: relative; }

.jt-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.jt-dropdown::-webkit-scrollbar { width: 4px; }
.jt-dropdown::-webkit-scrollbar-track { background: transparent; }
.jt-dropdown::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.jt-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.jt-item:last-child { border-bottom: none; }
.jt-item:hover, .jt-item.highlighted { background: var(--surface2); }

.jt-item-left { min-width: 0; }
.jt-item-title { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.jt-item-skills {
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
  max-width: 240px;
}

.jt-item-apply {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  flex-shrink: 0;
  white-space: nowrap;
}

.jt-skills-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--accent-dim), rgba(167,139,250,.06));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  margin-top: 0.625rem;
}
.jt-skills-banner-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #09090B;
}
.jt-skills-banner-title { font-size: 0.78rem; font-weight: 700; margin-bottom: 0.375rem; }
.jt-skills-banner-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.jt-skills-banner-chip {
  font-size: 0.7rem; font-weight: 500;
  padding: 0.175rem 0.55rem;
  border-radius: 100px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.jt-skills-banner-chip:hover {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ──────────────────────────────────────────────
   COVER LETTER PAGE
────────────────────────────────────────────── */
.cl-page  { padding-top: var(--nav-h); min-height:100svh; display:flex; flex-direction:column; }
.cl-body  {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  flex: 1;
  min-height: calc(100svh - var(--nav-h));
}

/* Step sidebar (reuses builder styles) */

/* Form area */
.cl-form-area {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Tone selector */
.tone-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.tone-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
  text-align: center;
}
.tone-card:hover { border-color: var(--border2); background: var(--surface); }
.tone-card.active { border-color: var(--accent-border); background: var(--accent-dim); }
.tone-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  margin: 0 auto 0.625rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tone-card.active .tone-card-icon { background: var(--accent); border-color: var(--accent); color: #09090B; }
.tone-card-label { font-size: 0.875rem; font-weight: 600; }
.tone-card-desc  { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* CL preview */
.cl-preview {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cl-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cl-preview-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.cl-preview-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: #2a2a30;
}
.cl-paper {
  background: #fff;
  border-radius: 2px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  line-height: 1.7;
  color: #222;
  min-height: 500px;
}
.cl-paper-name  { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.cl-paper-sub   { font-size: 9px; color: #666; margin-bottom: 12px; }
.cl-paper-date  { font-size: 9px; color: #888; margin-bottom: 14px; }
.cl-paper-body  { font-size: 10.5px; line-height: 1.75; color: #333; }
.cl-paper-para  { margin-bottom: 10px; }
.cl-paper-sig   { margin-top: 16px; font-size: 10.5px; }

/* Phrase suggestions for CL */
.phrase-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.875rem;
}
.phrase-panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.phrase-panel-title { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.phrase-list { max-height: 240px; overflow-y: auto; }
.phrase-item {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}
.phrase-item:last-child { border-bottom: none; }
.phrase-item:hover { background: var(--surface2); color: var(--text); }
.phrase-add {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
}
.phrase-item:hover .phrase-add { background: var(--accent); color: #09090B; }

/* ──────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .cl-body { grid-template-columns: 220px 1fr 300px; }
}
@media (max-width: 900px) {
  .cl-body { grid-template-columns: 1fr; }
  .cl-preview { display: none; }
}
