/* ============================================================
   CV Analyzer — app.css
   ============================================================ */

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

:root {
  --sidebar-bg:    #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-active:#0f3460;
  --accent:        #4e9af1;
  --accent-dark:   #2d7dd2;
  --accent-light:  #a8d4ff;
  --content-bg:    #f4f6fb;
  --card-bg:       #ffffff;
  --text-primary:  #1e293b;
  --text-secondary:#64748b;
  --text-light:    #94a3b8;
  --border:        #e2e8f0;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition:    .18s ease;
  --sidebar-width: 220px;
  --header-h:      56px;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; color: var(--text-primary); background: var(--content-bg); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; }

/* ----- Layout ----- */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ----- Sidebar ----- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo h1 {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.sidebar-logo span {
  color: var(--accent);
}
.sidebar-logo p {
  color: rgba(255,255,255,.4);
  font-size: 11px;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .75; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; border-left-color: var(--accent); }
.nav-item.active svg { opacity: 1; }
.nav-item span { font-size: 13.5px; font-weight: 500; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.3);
  font-size: 11px;
}

/* ----- Main content ----- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--header-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.topbar-sub   { font-size: 13px; color: var(--text-secondary); margin-left: auto; }

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ----- Tabs / Panels ----- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ----- Cards ----- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 17px; height: 17px; color: var(--accent); }

/* ----- Two-column layout ----- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 960px) { .two-col, .three-col { grid-template-columns: 1fr; } }

/* ----- Builder layout ----- */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1200px) { .builder-layout { grid-template-columns: 1fr; } }

/* ----- Form styles ----- */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 600px) { .form-row, .form-row.three { grid-template-columns: 1fr; } }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
  line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78,154,241,.15);
}
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: var(--text-light); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

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

.btn-secondary { background: #f1f5f9; color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }

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

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

.btn-ghost     { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-ghost:hover { background: rgba(78,154,241,.08); }

.btn-sm  { padding: 5px 12px; font-size: 12.5px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; }
.btn-icon { padding: 7px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----- Section items (work, edu, etc.) ----- */
.section-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: #fafafa;
  position: relative;
}
.section-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-item-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.section-item-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: .7;
  transition: opacity var(--transition);
}
.section-item-remove:hover { opacity: 1; background: #fff1f0; }

/* ----- Tags / chips ----- */
.tags-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 40px;
  background: #fff;
  cursor: text;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tags-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(78,154,241,.15);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.tag-default { background: #e0eaff; color: #3b5fc0; }
.tag-green   { background: #d1fae5; color: #065f46; }
.tag-red     { background: #fee2e2; color: #991b1b; }
.tag-yellow  { background: #fef3c7; color: #92400e; }
.tag-blue    { background: #dbeafe; color: #1e40af; }
.tag-purple  { background: #ede9fe; color: #5b21b6; }
.tag-gray    { background: #f1f5f9; color: var(--text-secondary); }

.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  line-height: 1;
  padding: 0;
  font-size: 14px;
  display: flex;
}
.tag-remove:hover { opacity: 1; }

.tags-inner-input {
  border: none;
  outline: none;
  font-size: 13px;
  flex: 1;
  min-width: 80px;
  background: transparent;
  font-family: inherit;
  color: var(--text-primary);
}

/* ----- Drag & Drop Upload ----- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(78,154,241,.04);
}
.upload-zone svg { width: 40px; height: 40px; color: var(--text-light); margin-bottom: 10px; }
.upload-zone p { color: var(--text-secondary); font-size: 13.5px; }
.upload-zone p strong { color: var(--accent); }
.upload-zone p.small { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ----- ATS Score ----- */
.ats-score-display {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
}
.ats-score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 5px solid var(--border);
  position: relative;
  background: var(--card-bg);
}
.ats-score-circle .score-num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.ats-score-circle .score-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
}
.score-good   { border-color: var(--success); }
.score-good .score-num { color: var(--success); }
.score-ok     { border-color: var(--warning); }
.score-ok .score-num { color: var(--warning); }
.score-bad    { border-color: var(--danger); }
.score-bad .score-num { color: var(--danger); }

.ats-score-info { flex: 1; }
.ats-score-info h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.ats-score-info p { color: var(--text-secondary); font-size: 13.5px; }

/* ----- Progress bar ----- */
.progress-wrap { margin-bottom: 10px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; color: var(--text-secondary); }
.progress-bar-bg { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.fill-success { background: var(--success); }
.fill-warning { background: var(--warning); }
.fill-danger  { background: var(--danger); }
.fill-info    { background: var(--info); }
.fill-accent  { background: var(--accent); }

/* ----- Match % display ----- */
.match-display {
  text-align: center;
  padding: 24px;
}
.match-percent {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.match-label { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ----- List styles ----- */
.result-list { list-style: none; }
.result-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.result-list li:last-child { border-bottom: none; }
.result-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}
.result-list.success li::before { background: var(--success); }
.result-list.warning li::before { background: var(--warning); }
.result-list.danger  li::before { background: var(--danger); }

/* ----- Interview questions ----- */
.question-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.question-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  background: #fff;
  transition: background var(--transition);
}
.question-header:hover { background: #f8fafc; }
.question-text { font-size: 13.5px; color: var(--text-primary); font-weight: 500; flex: 1; }
.question-toggle { color: var(--text-light); font-size: 18px; line-height: 1; transition: transform var(--transition); }
.question-item.open .question-toggle { transform: rotate(180deg); }
.question-hint {
  display: none;
  padding: 10px 14px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.question-item.open .question-hint { display: block; }

/* ----- Skills Map ----- */
.skills-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.skills-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }

.upwork-section { margin-bottom: 20px; }
.upwork-field-wrap { position: relative; }
.copy-field-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.copy-field-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ----- CV Preview ----- */
.cv-preview-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
}
.cv-preview-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cv-preview-header span { font-weight: 600; font-size: 13px; color: var(--text-secondary); }
.preview-frame {
  width: 100%;
  height: 600px;
  border: none;
  background: #fff;
}
.preview-html {
  padding: 20px;
  min-height: 500px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.4;
}

/* ----- Toast notifications ----- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  border-left: 4px solid var(--info);
  pointer-events: all;
  animation: toast-in .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-msg  { flex: 1; font-size: 13.5px; color: var(--text-primary); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 16px;
  padding: 0 2px; line-height: 1;
  opacity: .7;
}
.toast-close:hover { opacity: 1; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- Loading spinner ----- */
.spinner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,.45);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.spinner-overlay.visible { display: flex; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-text { color: #fff; font-size: 14px; font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline spinner for buttons */
.btn .spinner-inline {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.btn.loading .spinner-inline { display: block; }
.btn.loading .btn-label { opacity: .6; }

/* ----- Section header with add button ----- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); }

/* ----- Collapsible form sections ----- */
.form-section { margin-bottom: 8px; }
.form-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-primary);
  transition: background var(--transition);
}
.form-section-toggle:hover { background: #f1f5f9; }
.form-section-toggle .chevron {
  transition: transform var(--transition);
  color: var(--text-light);
  font-size: 16px;
}
.form-section.open .form-section-toggle .chevron { transform: rotate(180deg); }
.form-section-body {
  display: none;
  padding: 16px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
.form-section.open .form-section-body { display: block; }

/* ----- Job info card ----- */
.job-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.job-info-item { background: #f8fafc; border-radius: var(--radius); padding: 12px; }
.job-info-item .label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); margin-bottom: 4px; }
.job-info-item .value { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* ----- Divider ----- */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ----- Empty state ----- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.empty-state p { font-size: 13.5px; }

/* ----- Alert banners ----- */
.alert {
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ----- Misc utilities ----- */
.mt-0  { margin-top: 0; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-secondary); font-size: 12.5px; }
.font-bold   { font-weight: 700; }
.full-width  { width: 100%; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: fixed; left: -220px; z-index: 800; width: 220px; transition: left .25s ease; height: 100vh; }
  .sidebar.open { left: 0; }
  .content-area { padding: 16px; }
  .builder-layout { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .match-percent { font-size: 48px; }
  .ats-score-circle { width: 80px; height: 80px; }
  .ats-score-circle .score-num { font-size: 22px; }
}

/* Mobile nav toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px;
}
@media (max-width: 768px) { .menu-toggle { display: flex; } }

/* ─── App shell ───────────────────────────────────────────────────────────── */
body { display: flex; height: 100vh; overflow: hidden; }
.sidebar { height: 100vh; overflow-y: auto; }
.main-content { flex: 1; overflow-y: auto; padding: 24px; position: relative; }

/* ─── Brand ──────────────────────────────────────────────────────────────── */
.sidebar-brand { padding: 20px 16px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 12px; }
.brand-name { color: #fff; font-size: 15px; font-weight: 700; }
.nav-list { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.cv-status { font-size: 11px; color: rgba(255,255,255,.35); }
.cv-status.loaded { color: #6ee7b7; }

/* ─── Tab system ──────────────────────────────────────────────────────────── */
.tab-content { display: none; animation: fadeIn .2s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.tab-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.tab-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay { display: none; position: fixed; inset: 0; background: rgba(26,26,46,.55); z-index: 9000; align-items: center; justify-content: center; flex-direction: column; gap: 14px; }
.loading-overlay.visible { display: flex; }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
.loading-text { color: #fff; font-size: 14px; font-weight: 500; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 11px 16px; font-size: 13.5px; min-width: 260px; max-width: 360px; border-left: 4px solid var(--info); opacity: 0; transform: translateX(20px); transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-info    { border-left-color: var(--info); }
.toast-success { border-left-color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }

/* ─── Builder ─────────────────────────────────────────────────────────────── */
.builder-layout { display: grid; grid-template-columns: 1fr 400px; gap: 20px; align-items: start; }
@media (max-width: 1150px) { .builder-layout { grid-template-columns: 1fr; } }
.builder-form { display: flex; flex-direction: column; gap: 8px; }
.builder-preview { position: sticky; top: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.preview-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-secondary); }
#cvPreviewFrame { width: 100%; height: 580px; border: none; background: #fff; }
.select-sm { padding: 5px 10px; font-size: 12.5px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* Form section collapsible */
.form-section { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card-bg); }
.form-section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f8fafc; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-primary); user-select: none; }
.form-section-header:hover { background: #f1f5f9; }
.toggle-icon { font-size: 11px; color: var(--text-light); }
.form-section-body { padding: 14px; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-group.full-width { grid-column: 1 / -1; }
.full-width-textarea { width: 100%; }

/* Dynamic list entries */
.dynamic-entry { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 36px 12px 12px; margin-bottom: 8px; background: #fafcff; }
.btn-remove-entry { position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; opacity: .6; line-height: 1; }
.btn-remove-entry:hover { opacity: 1; }

/* Tag input */
.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); min-height: 38px; background: #fff; cursor: text; }
.tag-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(78,154,241,.12); }
.tag-chip { display: inline-flex; align-items: center; gap: 3px; background: #dbeafe; color: #1e40af; font-size: 11.5px; padding: 2px 7px; border-radius: 20px; }
.tag-remove { background: none; border: none; cursor: pointer; color: inherit; opacity: .6; font-size: 13px; line-height: 1; padding: 0 1px; }
.tag-remove:hover { opacity: 1; }
.tag-add-input { border: none; outline: none; font-size: 12.5px; min-width: 80px; flex: 1; font-family: inherit; color: var(--text-primary); background: transparent; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ─── Analyzer results ────────────────────────────────────────────────────── */
.result-score { font-size: 56px; font-weight: 900; text-align: center; line-height: 1; margin: 6px 0; }
.score-bar-wrap { display: flex; align-items: center; gap: 12px; }
.score-num { font-size: 28px; font-weight: 800; min-width: 50px; }
.score-bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 5px; transition: width .6s ease; }
.muted { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.hidden { display: none !important; }
.placeholder-msg { color: var(--text-light); font-size: 13.5px; text-align: center; padding: 40px 24px; }

/* Tag variants */
.tag-neutral { display: inline-block; background: #f1f5f9; color: var(--text-secondary); font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin: 2px; }
.tag-success { display: inline-block; background: #d1fae5; color: #065f46; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin: 2px; }
.tag-danger  { display: inline-block; background: #fee2e2; color: #991b1b; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin: 2px; }
.tag-info    { display: inline-block; background: #dbeafe; color: #1e40af; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin: 2px; }
.tag-warning { display: inline-block; background: #fef3c7; color: #92400e; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; margin: 2px; }

ul li { margin-bottom: 4px; font-size: 13.5px; }

/* ─── Job match ───────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 28px 16px; cursor: pointer; text-align: center; color: var(--text-secondary); font-size: 13.5px; margin-bottom: 12px; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(78,154,241,.04); }
.dropzone-icon { font-size: 28px; margin-bottom: 6px; }
.divider { text-align: center; color: var(--text-light); font-size: 12px; margin: 8px 0; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.divider::before { left: 0; }
.divider::after  { right: 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.info-row { font-size: 13px; margin-bottom: 6px; }
.info-label { font-weight: 600; color: var(--text-secondary); }
.match-circle { text-align: center; padding: 16px 0; }
.match-num { font-size: 52px; font-weight: 900; line-height: 1; }
.match-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.issue-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.issue-item:last-child { border-bottom: none; }
.issue-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.severity-high   .issue-badge { background: #fee2e2; color: #991b1b; }
.severity-medium .issue-badge { background: #fef3c7; color: #92400e; }
.severity-low    .issue-badge { background: #f1f5f9; color: #64748b; }
.fix-item { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.fix-item:last-child { border-bottom: none; }
.fix-issue { font-weight: 600; color: var(--text-primary); }
.fix-desc { color: var(--text-secondary); margin-top: 2px; }

/* ─── Interview ───────────────────────────────────────────────────────────── */
.question-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; overflow: hidden; }
.question-text { padding: 11px 14px; cursor: pointer; font-size: 13.5px; color: var(--text-primary); font-weight: 500; display: flex; align-items: flex-start; gap: 8px; background: #fff; }
.question-text:hover { background: #f8fafc; }
.q-num { color: var(--accent); font-weight: 700; flex-shrink: 0; }
.q-expand-icon { margin-left: auto; color: var(--text-light); font-size: 11px; transition: transform .2s; flex-shrink: 0; }
.question-item.expanded .q-expand-icon { transform: rotate(180deg); }
.question-hint { display: none; padding: 10px 14px 12px; background: #f8fafc; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.question-item.expanded .question-hint { display: block; }
.hint-label { font-weight: 600; color: var(--text-primary); font-size: 12px; margin-bottom: 4px; }

/* ─── Skills Map ──────────────────────────────────────────────────────────── */
.skills-grid-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .skills-grid-layout { grid-template-columns: 1fr; } }
.top-skills-list { padding-left: 18px; }
.top-skills-list li { padding: 4px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.top-skills-list li:last-child { border-bottom: none; }
.upwork-card { border: 2px solid var(--accent); }
.upwork-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.upwork-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.upwork-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-light); margin-bottom: 5px; }
.upwork-value { font-size: 13.5px; color: var(--text-primary); line-height: 1.5; padding: 6px 8px; background: #f8fafc; border-radius: 4px; }
.upwork-value.editable:focus { outline: 2px solid var(--accent); border-radius: 4px; }
.upwork-rate { font-size: 18px; font-weight: 700; color: var(--success); }
.copy-btn { margin-top: 6px; }

/* ─── Sidebar actions ────────────────────────────────────────────────────── */
.btn-sidebar-action {
  display: block; width: calc(100% - 24px); margin: 4px 12px 0;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.7); font-size: 12px; padding: 6px 10px;
  border-radius: var(--radius); text-align: left; transition: var(--transition);
}
.btn-sidebar-action:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ─── CV banner (Analyzer tab) ───────────────────────────────────────────── */
.cv-banner {
  background: #ecfdf5; border: 1px solid var(--success); color: #065f46;
  padding: 8px 14px; border-radius: var(--radius); margin-bottom: 12px;
  font-size: 13px; font-weight: 500;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card-bg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-wide { max-width: 720px; }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 18px; color: var(--text-light);
  padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.modal-close:hover { background: var(--content-bg); color: var(--text-primary); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 24px; border-top: 1px solid var(--border);
}
.modal-note { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; padding: 8px 10px; background: #fffbeb; border-radius: var(--radius); border-left: 3px solid var(--warning); }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.modal-privacy { font-size: 13px; }
.modal-privacy strong { display: block; margin-bottom: 8px; }
.modal-privacy ul { padding-left: 16px; line-height: 1.8; }
.modal-privacy li { margin-bottom: 4px; }
.field-hint { display: block; font-size: 11px; color: var(--text-light); margin-top: 3px; }
.btn-inline { background: none; border: none; color: var(--accent); font-size: 13px; padding: 0; text-decoration: underline; cursor: pointer; }
.btn-inline:hover { color: var(--accent-dark); }

/* ─── Help modal ─────────────────────────────────────────────────────────── */
.help-body { line-height: 1.6; }
.help-section { margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.help-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.help-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.help-section p { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.help-section ul { padding-left: 16px; }
.help-section li { font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }
.help-section li strong { color: var(--text-primary); }
.help-section li em { color: var(--text-light); }

/* ─── Provider selector ──────────────────────────────────────────────────── */
.provider-selector { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.provider-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s;
}
.provider-option:has(input:checked) {
  border-color: var(--accent); background: rgba(78,154,241,.08);
}
.provider-option.provider-disabled { opacity: .45; cursor: not-allowed; }
.provider-option input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
.provider-label { font-size: 14px; font-weight: 500; flex: 1; }
.provider-badge {
  font-size: 10px; background: var(--border); color: var(--text-light);
  padding: 1px 6px; border-radius: 10px; white-space: nowrap;
}
