/* ================================================================
   TalentLane — components.css
   UI component library. Requires main.css.
   ================================================================ */

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: .5rem 1rem;
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -.01em;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--t-fast),
    color var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    transform var(--t-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:active         { transform: scale(.98); }
.btn:disabled       { opacity: .5; pointer-events: none; }
.btn:hover          { text-decoration: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-dk);
  border-color: var(--color-primary-dk);
  box-shadow: 0 2px 10px rgba(27,79,216,.3);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn-secondary:hover {
  background: var(--color-primary-lt);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  box-shadow: 0 2px 8px rgba(220,38,38,.3);
  color: #fff;
}

.btn-sm {
  padding: .3125rem .75rem;
  font-size: .8125rem;
  border-radius: var(--radius-sm);
  gap: var(--space-1);
}

.btn-lg {
  padding: .75rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.card-hover {
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card-hover:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: .1875rem .625rem;
  border-radius: var(--radius-full);
  font-size: .725rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: .01em;
  text-transform: uppercase;
}

/* Job status */
.badge-open   { background: var(--color-success-lt); color: var(--color-success); }
.badge-closed { background: var(--color-surface-sunken); color: var(--color-text-muted); }
.badge-draft  { background: var(--color-warning-lt); color: var(--color-warning); }
.badge-filled { background: var(--color-info-lt); color: var(--color-info); }

/* Remote type */
.badge-remote { background: #EEF2FF; color: #1B4FD8; }
.badge-hybrid { background: #F5F3FF; color: #7C3AED; }
.badge-onsite { background: var(--color-surface-sunken); color: var(--color-text-muted); }

/* Application status */
.badge-submitted    { background: var(--color-surface-sunken); color: var(--color-text-muted); }
.badge-reviewing    { background: var(--color-warning-lt);     color: var(--color-warning); }
.badge-shortlisted  { background: #EEF2FF;                     color: #1B4FD8; }
.badge-interviewing { background: #F5F3FF;                     color: #7C3AED; }
.badge-offered      { background: var(--color-success-lt);     color: var(--color-success); }
.badge-rejected     { background: var(--color-danger-lt);      color: var(--color-danger); }
.badge-withdrawn    { background: var(--color-surface-sunken); color: var(--color-text-subtle); }

/* Subscription tier */
.badge-tier-free       { background: var(--color-surface-sunken); color: var(--color-text-muted); font-size: .6875rem; }
.badge-tier-pro        { background: #EEF2FF; color: #1B4FD8; font-size: .6875rem; }
.badge-tier-enterprise { background: linear-gradient(135deg,#1B4FD8,#7C3AED); color: #fff; font-size: .6875rem; }

/* ── Metric cards ─────────────────────────────────────────────────── */
.metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.metric-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.metric-card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--color-primary-lt);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-card-value {
  font-family: var(--font-mono);
  font-size: 1.875rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -.04em;
  line-height: 1;
  margin-top: var(--space-1);
}

.metric-card-label {
  font-size: .8125rem;
  color: var(--color-text-muted);
}

.metric-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: .75rem;
  font-weight: 600;
}

.metric-card-trend.up   { color: var(--color-success); }
.metric-card-trend.down { color: var(--color-danger); }

/* ── Job card ──────────────────────────────────────────────────────── */
.job-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

/* Color sweep — reveals primary on hover */
.job-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2.5px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t);
}

.job-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.job-card:hover::before { transform: scaleX(1); }

.job-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.job-card-logo {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--color-text-muted);
  overflow: hidden;
}

.job-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -.015em;
  line-height: 1.3;
  margin-bottom: 2px;
}

.job-card:hover .job-card-title { color: var(--color-primary); }

.job-card-company {
  font-size: .875rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.job-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: .8125rem;
  color: var(--color-text-muted);
}

.job-card-location {
  display: flex;
  align-items: center;
  gap: 3px;
}

.job-card-salary { font-weight: 500; color: var(--color-text); }

.job-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.job-card-posted { font-size: .75rem; color: var(--color-text-subtle); }

.save-btn {
  background: none;
  border: none;
  padding: var(--space-1);
  color: var(--color-text-subtle);
  border-radius: var(--radius-sm);
  transition: color var(--t-fast), background var(--t-fast);
  cursor: pointer;
  display: flex;
  align-items: center;
  line-height: 1;
}
.save-btn:hover { color: var(--color-danger); background: var(--color-danger-lt); }
.save-btn.saved { color: var(--color-danger); }

/* Compact variant */
.job-card-compact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: background var(--t-fast), border-color var(--t-fast);
  text-decoration: none;
  color: inherit;
}
.job-card-compact:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border-strong);
  text-decoration: none;
  color: inherit;
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  text-decoration: none;
}
.sidebar-logo:hover { text-decoration: none; }

.sidebar-logo-mark {
  width: 28px; height: 28px;
  background: var(--color-primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -.02em;
}
.sidebar-logo-text span { color: var(--color-primary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar-section-label {
  font-size: .6875rem;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-2) var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .4375rem var(--space-3);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.sidebar-link:hover { background: var(--color-surface-alt); color: var(--color-text); text-decoration: none; }
.sidebar-link.active { background: var(--color-primary-lt); color: var(--color-primary); }

.sidebar-link svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: .65;
}
.sidebar-link.active svg,
.sidebar-link:hover  svg { opacity: 1; }

.sidebar-link-count {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 600;
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  padding: 0 .375rem;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  flex-shrink: 0;
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius);
}

.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: var(--radius-full);
  background: var(--color-primary-lt);
  color: var(--color-primary);
  font-size: .6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: .8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-logout:hover { background: var(--color-danger-lt); color: var(--color-danger); text-decoration: none; }

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

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 64px);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; }

.modal-close {
  background: none;
  border: none;
  padding: var(--space-1);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--color-surface-sunken); color: var(--color-text); }

.modal-body    { flex: 1; overflow-y: auto; padding: var(--space-6); }

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 420px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left-width: 3px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text);
}

.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-info    { border-left-color: var(--color-primary); }
.toast-warning { border-left-color: var(--color-warning); }

.toast-icon { flex-shrink: 0; width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--color-success); }
.toast-error   .toast-icon { color: var(--color-danger); }
.toast-info    .toast-icon { color: var(--color-primary); }
.toast-warning .toast-icon { color: var(--color-warning); }

.toast-message { flex: 1; line-height: 1.4; }

.toast-dismiss {
  background: none; border: none;
  cursor: pointer;
  color: var(--color-text-subtle);
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--t-fast);
}
.toast-dismiss:hover { color: var(--color-text); }

/* ── Data table ──────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }

.data-table thead tr {
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border-strong);
}

.data-table thead th {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  font-size: .6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background var(--t-fast);
}

.data-table tbody .table-row-hover:hover { background: var(--color-surface-alt); cursor: pointer; }

.data-table td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  vertical-align: middle;
}

/* ── Progress ring ───────────────────────────────────────────────── */
.progress-ring-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px; height: 80px;
}

.progress-ring svg { transform: rotate(-90deg); }

.progress-ring-track { fill: none; stroke: var(--color-border); stroke-width: 6; }

.progress-ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .7s cubic-bezier(.4,0,.2,1);
}

.progress-ring-fill.score-high { stroke: var(--color-success); }
.progress-ring-fill.score-mid  { stroke: var(--color-warning); }
.progress-ring-fill.score-low  { stroke: var(--color-danger); }

.progress-ring-value {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -.04em;
}

.progress-ring-label {
  font-size: .6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ── Score card ──────────────────────────────────────────────────── */
.score-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}

.score-card-feedback   { flex: 1; min-width: 0; }
.score-card-title      { font-size: .875rem; font-weight: 600; margin-bottom: var(--space-2); }
.score-card-text       { font-size: .8125rem; color: var(--color-text-muted); line-height: 1.65; }

/* ── Timeline ────────────────────────────────────────────────────── */
.timeline {
  padding-left: var(--space-4);
  border-left: 2px dashed var(--color-border);
}

.timeline-item {
  position: relative;
  padding-left: var(--space-5);
  padding-bottom: var(--space-5);
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-5) - 4px);
  top: 5px;
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
}
.timeline-dot.active { background: var(--color-primary); border-color: var(--color-primary); }

.timeline-date  { font-size: .75rem; color: var(--color-text-subtle); margin-bottom: 1px; }
.timeline-label { font-size: .875rem; font-weight: 500; }
.timeline-desc  { font-size: .8125rem; color: var(--color-text-muted); margin-top: 2px; line-height: 1.5; }

/* ── Upgrade gate ────────────────────────────────────────────────── */
.upgrade-gate          { position: relative; border-radius: var(--radius-lg); overflow: hidden; }
.upgrade-gate-content  { filter: blur(4px); pointer-events: none; user-select: none; }

.upgrade-gate-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248,249,252,.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  backdrop-filter: blur(1px);
}

.upgrade-gate-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.upgrade-gate-title { font-size: .9375rem; font-weight: 600; }
.upgrade-gate-desc  { font-size: .8125rem; color: var(--color-text-muted); max-width: 240px; line-height: 1.5; }

/* ── Mobile responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Toast: full-width on narrow phones, anchored to bottom edge */
  .toast-container {
    bottom: var(--space-3);
    right: var(--space-3);
    left: var(--space-3);
  }
  .toast {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  /* Data tables: allow horizontal scroll on small screens */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Modal: full-screen on narrow phones */
  .modal-content {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    overflow-y: auto;
  }
}
