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

:root {
  --bg:    #08080f;
  --s1:    #111118;
  --s2:    #18181f;
  --s3:    #22222c;
  --bd:    #2e2e3e;
  --bd2:   #3e3e52;
  --acc:   #7c6dfa;
  --acc2:  #fa6d8a;
  --grn:   #4ade80;
  --ylw:   #fbbf24;
  --blu:   #60a5fa;
  --tx:    #e2e2f0;
  --mt:    #6b6b82;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --font-body:    'Instrument Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ── */
.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--bd);
  flex-wrap: wrap;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #fff;
  letter-spacing: -.02em;
}
.logo span { color: var(--acc); }

.nav-tabs {
  display: flex;
  gap: .25rem;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 3px;
  flex-wrap: wrap;
}

.nav-tab {
  padding: 6px 15px;
  border-radius: 7px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--mt);
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--tx); }
.nav-tab.active { background: var(--acc); color: #fff; }

.menu-toggle {
  display: none;
  background: var(--s2);
  border: 1px solid var(--bd);
  color: var(--tx);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 16px;
  margin-left: auto;
}

/* ── Tab Sections ── */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ── Panels ── */
.panel {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: border-color .2s;
}
.panel:hover { border-color: var(--bd2); }

.panel-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

.panel-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.panel-title { font-size: 14px; font-weight: 500; color: #fff; }
.panel-sub   { font-size: 11px; color: var(--mt); margin-top: 1px; }
.ml-auto     { margin-left: auto; }

/* ── Grid Layouts ── */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }

/* ── Form Fields ── */
.field { display: flex; flex-direction: column; gap: 4px; }

.field label {
  font-size: 10px;
  color: var(--mt);
  font-family: var(--font-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select,
input.standalone,
textarea.standalone {
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--tx);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  width: 100%;
  transition: border-color .2s;
}
.field input:focus,
.field textarea:focus,
.field select:focus,
input.standalone:focus { border-color: var(--acc); }

.field textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.field select option { background: #18181f; }

/* ── Buttons ── */
.btn {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: background .2s, border-color .2s, color .2s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-p  { background: var(--acc); color: #fff; }
.btn-p:hover { background: #6a5de0; }
.btn-p:disabled { opacity: .5; cursor: default; }

.btn-o  { background: transparent; border: 1px solid var(--bd); color: var(--tx); }
.btn-o:hover { border-color: var(--acc); color: var(--acc); }

.btn-g  { background: rgba(74,222,128,.15); border: 1px solid rgba(74,222,128,.3); color: var(--grn); }
.btn-g:hover { background: rgba(74,222,128,.25); }

.btn-r  { background: rgba(250,109,138,.1); border: 1px solid rgba(250,109,138,.2); color: var(--acc2); }

.btn-sm { padding: 5px 11px; font-size: 11px; }

/* ── GitHub Import ── */
.gh-row { display: flex; gap: .5rem; }
.gh-row input {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 8px 11px;
  color: var(--tx);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.gh-row input:focus { border-color: var(--acc); }

.status-box {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 7px 11px;
  border-radius: 7px;
  margin-top: .5rem;
  line-height: 1.5;
}
.sb-ok  { background: rgba(74,222,128,.08); color: var(--grn); border: 1px solid rgba(74,222,128,.2); }
.sb-err { background: rgba(250,109,138,.08); color: var(--acc2); border: 1px solid rgba(250,109,138,.2); }
.sb-ld  { background: rgba(251,191,36,.08); color: var(--ylw); border: 1px solid rgba(251,191,36,.2); }

/* ── Repo Cards ── */
.repo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }

.repo-card {
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: .7rem;
  cursor: pointer;
  transition: border-color .2s;
  position: relative;
  user-select: none;
}
.repo-card:hover { border-color: rgba(124,109,250,.4); }
.repo-card.selected { border-color: var(--acc); background: rgba(124,109,250,.08); }
.repo-card.selected::after { content: '✓'; position: absolute; top: 6px; right: 8px; color: var(--acc); font-size: 12px; font-weight: 600; }

.repo-name { font-size: 12px; font-weight: 500; color: #fff; margin-bottom: 2px; }
.repo-desc { font-size: 10px; color: var(--mt); line-height: 1.4; margin-bottom: .4rem; }
.repo-meta { display: flex; gap: .4rem; font-size: 10px; font-family: var(--font-mono); color: var(--mt); }
.repo-lang { background: rgba(74,222,128,.1); color: var(--grn); padding: 1px 6px; border-radius: 8px; }

/* ── Experience Cards ── */
.exp-card {
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: .6rem;
  position: relative;
}
.exp-del { position: absolute; top: .6rem; right: .6rem; }

/* ── Tags & Skills ── */
.tags-wrap { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; min-height: 28px; }

.tag {
  background: rgba(124,109,250,.15);
  border: 1px solid rgba(124,109,250,.25);
  color: #b8b0ff;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
}
.tag-x { cursor: pointer; opacity: .5; font-size: 13px; line-height: 1; transition: opacity .15s; }
.tag-x:hover { opacity: 1; }

.tag-input-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.tag-input-row input {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--bd);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--tx);
  font-size: 12px;
  outline: none;
  transition: border-color .2s;
}
.tag-input-row input:focus { border-color: var(--acc); }

.skill-suggest { display: flex; flex-wrap: wrap; gap: .3rem; }
.sug {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px dashed var(--bd);
  color: var(--mt);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: border-color .15s, color .15s;
}
.sug:hover { border-color: var(--acc); color: var(--acc); }

/* ── Template Grid ── */
.tmpl-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .6rem;
  margin-bottom: 1rem;
}

.tmpl-card-wrap { cursor: pointer; }

.tmpl-thumb {
  border: 2px solid var(--bd);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: .72;
  background: #fff;
  transition: border-color .2s;
  display: flex;
  flex-direction: column;
}
.tmpl-thumb:hover { border-color: var(--acc); }
.tmpl-thumb.selected { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(124,109,250,.25); }

.tmpl-name {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--mt);
  text-align: center;
  margin-top: .3rem;
}

/* ── Preview ── */
.preview-wrap {
  background: var(--s1);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.preview-inner {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  min-height: 420px;
}
.preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: #aaa;
  font-size: 13px;
}

.action-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}

.ai-out {
  font-size: 12px;
  line-height: 1.8;
  color: var(--tx);
  white-space: pre-wrap;
  font-family: var(--font-mono);
  background: var(--s2);
  border-radius: 8px;
  padding: 1rem;
  margin-top: .5rem;
  max-height: 320px;
  overflow-y: auto;
}

/* ── ATS ── */
.ats-wrap { margin-top: .8rem; }
.score-big {
  font-family: var(--font-display);
  font-size: 3rem;
  text-align: center;
  padding: .8rem 0 .2rem;
}
.score-grade {
  font-size: 13px;
  font-family: var(--font-mono);
  text-align: center;
  margin-bottom: 1rem;
}
.ats-item { margin-bottom: .8rem; }
.ats-label { display: flex; justify-content: space-between; font-size: 12px; font-family: var(--font-mono); margin-bottom: .2rem; }
.ats-bar-bg { background: var(--s3); border-radius: 20px; height: 8px; overflow: hidden; }
.ats-bar { height: 8px; border-radius: 20px; transition: width 1s ease; }
.ats-tip { font-size: 11px; color: var(--mt); margin-top: .25rem; line-height: 1.5; }

#jdResult { margin-top: .8rem; }

/* ── Utilities ── */
.empty-msg  { font-size: 12px; color: var(--mt); padding: .4rem 0; }
.hint-text  { font-size: 11px; color: var(--mt); font-family: var(--font-mono); line-height: 1.5; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tab-section.active { animation: fadeIn .25s ease; }

/* ── Responsive ── */
@media (max-width: 720px) {
  .row3 { grid-template-columns: 1fr 1fr; }
  .tmpl-grid { grid-template-columns: repeat(3, 1fr); }
  .repo-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .tmpl-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-tabs { display: none; }
  .nav-tabs.open { display: flex; flex-direction: column; width: 100%; order: 3; }
  .menu-toggle { display: block; }
  .topbar { flex-wrap: wrap; }
}
