/* ============================================================
   components.css
   All reusable UI components.
   Colours come from CSS custom properties (theme files).
   ============================================================ */

/* ── Trust pill ── */
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 12.5px;
  color: var(--color-muted);
}

/* ── Textarea panel ── */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.panel:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  gap: 10px;
}

.panel__label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
}

.panel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--blue  { background: var(--accent); }
.dot--teal  { background: #14b8a6; }

.panel__char-count {
  font-size: 12px;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel__textarea {
  flex: 1;
  width: 100%;
  min-height: 280px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  padding: 18px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--color-text);
  font-family: var(--font-sans);
  caret-color: var(--accent-mid);
  transition: color var(--transition);
}

.panel__textarea::placeholder {
  color: var(--color-muted);
  opacity: 0.55;
}

.panel__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 9px 14px;
  border-top: 1px solid var(--color-border);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition:
    transform     var(--transition),
    box-shadow    var(--transition),
    opacity       var(--transition),
    border-color  var(--transition),
    color         var(--transition);
}

/* Primary — analyse */
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  color: #fff;
  font-size: 16px;
  padding: 14px 36px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 24px rgba(108, 99, 255, 0.38);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px rgba(108, 99, 255, 0.50);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--primary.is-loading .spinner    { display: block; }
.btn--primary.is-loading .btn__icon  { display: none; }

/* Ghost — reset, scroll-up */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 14px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
}

.btn--ghost:hover {
  border-color: var(--color-muted);
  color: var(--color-text);
}

/* Inline clear */
.btn--clear {
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn--clear:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

/* Small copy button (panel headers) */
.btn--copy {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn--copy:hover          { border-color: var(--accent); color: var(--accent-mid); }
.btn--copy.is-copied      { border-color: var(--green);  color: var(--green); }

/* Outline — copy-all row */
.btn--outline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 14px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn--outline:hover   { border-color: var(--accent); color: var(--accent-mid); }
.btn--outline.is-copied { border-color: var(--green); color: var(--green); }

/* ── Score card ── */
.score-card {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 28px 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

/* Ring */
.score-ring {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  flex-shrink: 0;
}

.score-ring svg {
  width: var(--ring-size);
  height: var(--ring-size);
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: var(--ring-stroke);
  stroke-linecap: round;
}

.ring__track { stroke: var(--color-surface-2); }

.ring__fill {
  stroke: var(--accent);
  stroke-dasharray: var(--ring-circ);
  stroke-dashoffset: var(--ring-circ);
  transition: stroke-dashoffset 0.9s cubic-bezier(0.25, 1, 0.5, 1),
              stroke 0.4s ease;
}

.score-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.score-ring__pct {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
}

.score-ring__sub {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

/* Score text block */
.score-info { flex: 1; min-width: 200px; }

.score-info__title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--color-text);
}

.score-info__desc {
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 0;
}

/* Stat pills */
.stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 13px;
  color: var(--color-text);
}

.stat-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Result panel (keyword lists + highlight) ── */
.result-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.result-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  gap: 10px;
}

.result-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
}

/* Coloured icon chip */
.rp-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.rp-icon--red    { background: var(--red-bg);    color: var(--red);    }
.rp-icon--green  { background: var(--green-bg);  color: var(--green);  }
.rp-icon--accent { background: var(--accent-light); color: var(--accent-mid); }

/* ── Keyword list ── */
.kw-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 440px;
  overflow-y: auto;
  flex: 1;
}

.kw-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  border: 1px solid transparent;
  gap: 10px;
  transition: border-color var(--transition);
}

.kw-item:hover { border-color: var(--color-border); }

.kw-item__text {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  word-break: break-word;
}

.kw-item__text--phrase { color: var(--accent-mid); }
.kw-item__text--single { color: var(--color-text); }

.kw-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.kw-item__freq {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-hover);
  padding: 2px 7px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

/* Priority dots */
.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot--high { background: var(--red);    }
.priority-dot--mid  { background: var(--orange); }
.priority-dot--low  { background: var(--color-muted); }

/* Legend bar */
.kw-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-muted);
}

.kw-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kw-legend__phrase {
  color: var(--accent-mid);
  font-weight: 600;
  margin-left: auto;
}

/* Empty state */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
  font-size: 14px;
}

.empty-state__emoji {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

/* ── Highlighted resume ── */
.highlight-body {
  padding: 20px 22px;
  font-size: 14px;
  line-height: 1.9;
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
}

mark.kw-hit {
  background: var(--green-bg);
  color: #86efac;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}

/* Light mode override for mark */
[data-theme="light"] mark.kw-hit {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

/* ── How-it-works card ── */
.how-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.how-card__num {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-light);
  border: 1px solid rgba(108, 99, 255, 0.28);
  color: var(--accent-mid);
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.how-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.how-card p {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.65;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 14px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast--error   { border-color: var(--red);   }
.toast--success { border-color: var(--green);  }
