/* ===== Reset & Variables ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:       #1a56db;
  --primary-light: #ebf2ff;
  --primary-dark:  #1141a3;
  --bg:            #f3f4f6;
  --card:          #ffffff;
  --border:        #e5e7eb;
  --text:          #111827;
  --text-sm:       #6b7280;
  --text-xs:       #9ca3af;
  --success:       #0e9f6e;
  --warning:       #c27803;
  --danger:        #e02424;
  --shadow:        0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius:        8px;
  --radius-lg:     12px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ===== Header ===== */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.brand h1 { font-size: 1.05rem; font-weight: 700; }
.brand p  { font-size: 0.72rem; color: var(--text-sm); }

.header-badge {
  margin-left: auto;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ===== Page ===== */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ===== Search Screen ===== */
.search-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 640px;
  margin: 2.5rem auto;
  box-shadow: var(--shadow-md);
}

.search-header h2  { font-size: 1.45rem; font-weight: 700; margin-bottom: 0.4rem; }
.search-header .desc { color: var(--text-sm); font-size: 0.88rem; margin-bottom: 2rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  margin-bottom: 0.38rem;
}
.req   { color: var(--danger); }
.optional { font-weight: 400; color: var(--text-sm); }

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 0.62rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.input-hint { font-size: 0.73rem; color: var(--text-sm); margin-top: 0.3rem; }

.error-text {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ===== Buttons ===== */
.btn-primary {
  width: 100%;
  padding: 0.8rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.18s, transform 0.1s;
}
.btn-primary:hover  { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--text-sm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.18s;
}
.btn-ghost:hover { background: var(--bg); }

.btn-secondary {
  display: block;
  text-align: center;
  padding: 0.6rem 1.1rem;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s;
}
.btn-secondary:hover { background: var(--primary-light); }

/* ===== Feature List ===== */
.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 2rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg);
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
}
.fi-icon { font-size: 1rem; flex-shrink: 0; }
.fi-text  { font-size: 0.78rem; color: var(--text-sm); font-weight: 500; }

/* ===== Loading Screen ===== */
.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
}

.loading-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 1.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.35rem; }
.loading-sub   { font-size: 0.8rem; color: var(--text-sm); }

.loading-steps { margin-top: 1.4rem; text-align: left; }
.loading-step {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0;
  font-size: 0.83rem;
  color: var(--text-sm);
  border-bottom: 1px solid var(--border);
}
.loading-step:last-child { border-bottom: none; }
.step-icon { font-size: 0.95rem; width: 20px; text-align: center; }

.progress-wrap {
  width: 100%; height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 1.4rem;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

/* ===== Dashboard ===== */
.dash-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.dash-topbar h2     { font-size: 1.15rem; font-weight: 600; }
.dash-actions       { margin-left: auto; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 560px) { .stats-row { grid-template-columns: 1fr 1fr; } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-val { font-size: 1.55rem; font-weight: 700; }
.stat-lbl { font-size: 0.7rem; color: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.2rem; }

/* Two-column layout */
.dash-grid {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

.right-col { display: flex; flex-direction: column; gap: 1.25rem; }

/* Charts row */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 600px) { .charts-row { grid-template-columns: 1fr; } }

/* ===== Card ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-sm);
  margin-bottom: 1rem;
}

/* ===== Profile Card ===== */
.candidate-avatar {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 3px solid var(--border);
  display: block;
  margin: 0 auto 0.9rem;
}
.candidate-name    { text-align: center; font-size: 1.05rem; font-weight: 700; margin-bottom: 0.18rem; }
.candidate-handle  { text-align: center; color: var(--text-sm); font-size: 0.82rem; margin-bottom: 0.9rem; }
.candidate-bio     { font-size: 0.8rem; color: var(--text-sm); text-align: center; margin-bottom: 1.1rem; line-height: 1.55; }

.candidate-meta    { display: flex; flex-direction: column; gap: 0.45rem; }
.meta-item         { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-sm); }
.mi-icon           { font-size: 0.85rem; width: 18px; flex-shrink: 0; }

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

/* ===== ATS Score Card ===== */
.ats-score-wrap { text-align: center; padding: 0.4rem 0 0.8rem; }

.circular-score {
  position: relative;
  width: 128px; height: 128px;
  margin: 0 auto 1rem;
}
.circular-score svg { transform: rotate(-90deg); display: block; }

.score-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.score-num { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.score-max { font-size: 0.68rem; color: var(--text-sm); }

.ats-tier {
  display: inline-block;
  padding: 0.28rem 0.85rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.tier-exceptional { background: #edf7f0; color: #046c4e; }
.tier-strong      { background: #ebf2ff; color: #1a56db; }
.tier-good        { background: #f5f3ff; color: #7e3af2; }
.tier-average     { background: #fdf4c2; color: #c27803; }
.tier-below       { background: #fde8e8; color: #e02424; }

.hire-rec {
  padding: 0.65rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  margin-top: 0.5rem;
}
.hire-strong-hire { background: #edf7f0; color: #046c4e; border: 1px solid #84e1bc; }
.hire-hire        { background: #ebf2ff; color: #1a56db; border: 1px solid #a4cafe; }
.hire-maybe       { background: #fdf4c2; color: #c27803; border: 1px solid #faca15; }
.hire-no-hire     { background: #fde8e8; color: #e02424; border: 1px solid #f98080; }

/* ===== Score Dimensions ===== */
.dimension-list { display: flex; flex-direction: column; gap: 1rem; }

.dim-row        { display: flex; flex-direction: column; gap: 0.28rem; }
.dim-header     { display: flex; justify-content: space-between; align-items: center; }
.dim-label      { font-size: 0.82rem; font-weight: 600; }
.dim-score      { font-size: 0.82rem; font-weight: 700; color: var(--text-sm); }
.dim-bar-wrap   { width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.dim-bar        { height: 100%; border-radius: 4px; width: 0%; transition: width 1.2s ease; }
.dim-hint       { font-size: 0.7rem; color: var(--text-xs); }

.bar-technical     { background: #1a56db; }
.bar-quality       { background: #7e3af2; }
.bar-activity      { background: #0e9f6e; }
.bar-collaboration { background: #e3a008; }
.bar-portfolio     { background: #e02424; }

/* ===== Chart Containers ===== */
.chart-container { position: relative; height: 260px; }

/* ===== Job Match ===== */
.job-match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 480px) { .job-match-grid { grid-template-columns: 1fr; } }

.job-match-item {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.jm-role     { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.jm-bar-wrap { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 0.3rem; }
.jm-bar      { height: 100%; border-radius: 3px; }
.jm-pct      { font-size: 0.73rem; color: var(--text-sm); }

/* ===== Top Repos ===== */
.repo-list { display: flex; flex-direction: column; gap: 0.7rem; }

.repo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.repo-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}
.repo-icon  { font-size: 1rem; flex-shrink: 0; }
.repo-info  { flex: 1; min-width: 0; }
.repo-name  { font-size: 0.85rem; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-desc  { font-size: 0.76rem; color: var(--text-sm); margin-top: 0.18rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-stats { display: flex; gap: 0.7rem; margin-top: 0.38rem; }
.repo-stat  { display: flex; align-items: center; gap: 0.22rem; font-size: 0.73rem; color: var(--text-sm); }
.lang-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ===== Print ===== */
@media print {
  .app-header      { position: relative; }
  .dash-actions    { display: none; }
  #backBtn         { display: none; }
  #searchScreen,
  #loadingScreen   { display: none !important; }
  body             { background: #fff; }
  .card            { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .dash-grid       { grid-template-columns: 260px 1fr; }
}
