/* ===================================================================
   STYLE.CSS — Reusable UI components
=================================================================== */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

button {
  font-family: inherit;
}

a {
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  user-select: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-gold {
  background: var(--gold);
  color: #2a2007;
}

.btn-gold:hover {
  background: var(--gold-600);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

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

/* ---------- Inputs ---------- */
.field {
  margin-bottom: var(--space-4);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field-label .req {
  color: var(--danger);
  margin-left: 3px;
}

.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: 5px;
}

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: 5px;
  display: none;
}

.field.has-error .field-error {
  display: block;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: var(--danger);
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888'%3E%3Cpath d='M6 9l6 6 6-6' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.char-counter {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 4px;
}

.char-counter.is-warn {
  color: var(--gold-600);
}

.char-counter.is-over {
  color: var(--danger);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Tag input */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
}

.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.tag-input input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 90px;
  font-size: var(--fs-sm);
  background: transparent;
  color: var(--text-primary);
  padding: 4px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 4px 6px 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.tag-chip button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tag-chip button:hover {
  background: rgba(0, 0, 0, .1);
}

.tag-chip select {
  border: none;
  background: transparent;
  font-size: var(--fs-xs);
  color: inherit;
  font-weight: 600;
}

/* File upload / photo */
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: var(--space-5);
  text-align: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.upload-zone:hover,
.upload-zone.is-drag {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.photo-preview-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.photo-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-md);
}

/* ---------- Entry card (repeatable item) ---------- */
.entry-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  margin-bottom: var(--space-3);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.entry-card.is-dragging {
  box-shadow: var(--shadow-lg);
  opacity: 0.85;
}

.entry-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 12px;
  cursor: pointer;
  background: var(--bg-app);
}

.entry-card__handle {
  cursor: grab;
  color: var(--text-tertiary);
  display: flex;
}

.entry-card__handle:active {
  cursor: grabbing;
}

.entry-card__title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card__sub {
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  font-weight: 400;
}

.entry-card__actions {
  display: flex;
  gap: 2px;
}

.entry-card__body {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.entry-card__body.is-collapsed {
  display: none;
}

.entry-card__chevron {
  transition: transform var(--transition-fast);
}

.entry-card.is-collapsed .entry-card__chevron {
  transform: rotate(-90deg);
}

.bullets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.bullet-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.bullet-row .textarea {
  min-height: 44px;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-5);
  color: var(--text-secondary);
}

.empty-state svg {
  width: 52px;
  height: 52px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.empty-state h3 {
  font-size: var(--fs-md);
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: var(--fs-sm);
  max-width: 320px;
  margin: 0 auto var(--space-4);
}

/* ---------- Section progress ring ---------- */
.progress-ring {
  width: 20px;
  height: 20px;
}

.progress-ring circle {
  fill: none;
  stroke-width: 2.5;
}

.progress-ring .track {
  stroke: var(--border-default);
}

.progress-ring .fill {
  stroke: var(--gold);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset var(--transition-base);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-gold {
  background: var(--gold-soft);
  color: var(--gold-600);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-neutral {
  background: var(--bg-sunken);
  color: var(--text-secondary);
}

/* ---------- Toggle switch ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.switch .track::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.switch input:checked+.track {
  background: var(--accent);
}

.switch input:checked+.track::before {
  transform: translateX(18px);
}

.switch input:focus-visible+.track {
  box-shadow: var(--shadow-focus);
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--ink-900);
  color: var(--paper-0);
  padding: 12px 14px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  animation: toast-in var(--transition-base);
}

.toast svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.toast.toast-success svg {
  color: #4fd8a8;
}

.toast.toast-error svg {
  color: #ff8f80;
}

.toast.toast-info svg {
  color: #8ab6ff;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 15, 30, .55);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  padding: var(--space-5);
  animation: modal-in var(--transition-base);
}

.modal h3 {
  margin-bottom: var(--space-2);
}

.modal p {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.modal--wide {
  max-width: 720px;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: #fff;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

/* Use for controls anchored near the bottom of the viewport (e.g. floating action buttons)
   so the tooltip doesn't get clipped by the viewport edge. */
[data-tooltip].tooltip-top:hover::after,
[data-tooltip].tooltip-top:focus-visible::after {
  top: auto;
  bottom: calc(100% + 8px);
}

/* Left/right-edge safe variants for the outermost items in a toolbar row. */
[data-tooltip].tooltip-left:hover::after,
[data-tooltip].tooltip-left:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
}

[data-tooltip].tooltip-right:hover::after,
[data-tooltip].tooltip-right:focus-visible::after {
  left: 0;
  transform: none;
}

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ---------- ATS score gauge ---------- */
.ats-gauge-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.ats-gauge {
  position: relative;
  width: 128px;
  height: 128px;
  flex: 0 0 auto;
}

.ats-gauge svg circle.track {
  stroke: var(--bg-sunken);
}

.ats-gauge svg circle.fill {
  stroke: var(--gold);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 700ms cubic-bezier(.4, 0, .2, 1);
}

.ats-gauge__num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ats-gauge__num b {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}

.ats-gauge__num span {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ats-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.ats-check-row:last-child {
  border: none;
}

.ats-check-row .status-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.ats-check-row .status-icon.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.ats-check-row .status-icon.warn {
  background: var(--gold-soft);
  color: var(--gold-600);
}

.ats-check-row .status-icon.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.ats-check-row .status-icon svg {
  width: 12px;
  height: 12px;
}

.ats-check-row__title {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.ats-check-row__desc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Helper containers ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
}

.section-intro {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  margin-bottom: var(--space-4);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: 5px;
  padding: 1px 6px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  z-index: 300;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 10px;
}

/* Learning center content cards */
.learn-card {
  padding: var(--space-4);
}

.learn-card h4 {
  margin-bottom: 8px;
  font-size: var(--fs-md);
}

.learn-card p,
.learn-card li {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.learn-card ul {
  padding-left: 20px;
  margin: 8px 0;
}

.compare-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: 8px;
}

.compare-col {
  padding: var(--space-3);
  border-radius: var(--r-sm);
}

.compare-col.weak {
  background: var(--danger-soft);
}

.compare-col.strong {
  background: var(--accent-soft);
}

.compare-col h5 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}

.preview-footnote {
  font-size: .75rem;
  color: var(--ink-faint);
  text-align: center;
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

/* ---------- Calendar date picker (js/datepicker.js) ---------- */
.dp-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: var(--fs-sm);
  font-family: var(--font-body);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dp-trigger:hover {
  border-color: var(--border-strong);
}

.dp-trigger:focus-visible,
.dp-trigger:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.dp-trigger-icon {
  display: flex;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.dp-trigger-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dp-trigger.is-empty .dp-trigger-label {
  color: var(--text-tertiary);
}

.dp-panel {
  z-index: 120;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  width: 260px;
  animation: dp-pop 120ms ease;
}

@keyframes dp-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dp-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.dp-panel-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.dp-nav {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dp-nav:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dp-year-quick {
  flex: 0 0 84px;
  padding: 5px 22px 5px 8px;
  font-size: var(--fs-xs);
  background-position: right 6px center;
}

.dp-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.dp-weekday-row span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.dp-day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day,
.dp-day--empty {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.dp-day:hover {
  background: var(--bg-hover);
}

.dp-day.is-today {
  font-weight: 700;
  color: var(--accent);
}

.dp-day.is-selected {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 700;
}

.dp-day--empty {
  cursor: default;
}

.dp-month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.dp-month-btn {
  padding: 10px 4px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--bg-sunken);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: center;
}

.dp-month-btn:hover {
  background: var(--bg-hover);
}

.dp-month-btn.is-selected {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 700;
}

.dp-panel-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.dp-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-sm);
}

.dp-link-btn:hover {
  background: var(--bg-hover);
}

.dp-link-btn--muted {
  color: var(--text-tertiary);
}