/* ISA Assistant - LLM-style home screen with hidable sidebar */

.isa-shell {
  display: flex;
  min-height: calc(100vh - 72px);
  background: #fff;
  position: relative;
}

/* ---------- Sidebar ---------- */
.isa-sidebar {
  width: 290px;
  flex: 0 0 290px;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 20px;
  gap: 14px;
  overflow-y: auto;
  transition: margin-left .25s ease, transform .25s ease;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: calc(100vh - 72px);
}

.isa-shell.sidebar-collapsed .isa-sidebar {
  margin-left: -290px;
}

.isa-sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.isa-sidebar__new {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  color: var(--gray-900);
  font-weight: 600;
  cursor: pointer;
}

.isa-sidebar__new:hover { border-color: var(--orange-500); color: var(--orange-600); }

.isa-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--gray-900);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.isa-icon-btn:hover { background: var(--gray-100); }

.isa-sidebar__section h4 {
  margin: 4px 8px 6px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 700;
}

.isa-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-900);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.isa-nav-item:hover { background: var(--gray-100); }
.isa-nav-item.active { background: #FDEBD9; color: var(--orange-600); font-weight: 600; }
.isa-nav-item__icon { width: 20px; text-align: center; }
.isa-nav-item__count {
  margin-left: auto;
  font-size: 11px;
  background: var(--gray-200);
  color: var(--gray-900);
  border-radius: 999px;
  padding: 1px 8px;
}

.isa-session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.isa-session-list li button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--gray-900);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.isa-session-list li button:hover { background: var(--gray-100); }
.isa-session-list li button.active { background: #FDEBD9; }
.isa-session-list .isa-empty { padding: 8px 10px; font-size: 13px; color: var(--gray-500); }

.isa-sidebar__footer { margin-top: auto; font-size: 12px; color: var(--gray-500); padding: 0 8px; }

/* ---------- Main column ---------- */
.isa-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.isa-topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 0;
}

.isa-topbar__title { font-weight: 600; color: var(--gray-900); font-size: 14px; }
.isa-topbar__tool { font-size: 12px; color: var(--gray-500); }

.isa-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px 20px;
  max-width: 720px;
}

.isa-welcome__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-lg);
}

.isa-welcome h1 {
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--gray-900);
  font-weight: 700;
}

.isa-welcome h1 .isa-welcome__ask { display: block; }
.isa-welcome p { margin: 0; color: var(--gray-500); font-size: 15px; }

.isa-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.isa-chip {
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-900);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.isa-chip:hover { border-color: var(--orange-500); color: var(--orange-600); }

/* ---------- Chat ---------- */
.isa-chat {
  flex: 1;
  width: 100%;
  max-width: 820px;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.isa-msg { display: flex; gap: 10px; align-items: flex-start; }
.isa-msg--user { justify-content: flex-end; }

.isa-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 32px;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.isa-msg__bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--gray-900);
  word-break: break-word;
}

.isa-msg--user .isa-msg__bubble { background: var(--gray-100); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.isa-msg--assistant .isa-msg__bubble { background: #fff; border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; }
.isa-msg__bubble p { margin: 0 0 8px; }
.isa-msg__bubble p:last-child { margin-bottom: 0; }
.isa-msg__bubble ul, .isa-msg__bubble ol { margin: 6px 0 8px 20px; padding: 0; }
.isa-msg__bubble li { margin: 2px 0; }
.isa-msg__bubble a { color: var(--orange-600); text-decoration: underline; }
.isa-msg__bubble pre {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
  font-size: 12.5px;
  white-space: pre-wrap;
}
.isa-msg__meta { font-size: 11px; color: var(--gray-500); margin-top: 6px; }

.isa-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.isa-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gray-500);
  animation: isa-bounce 1.2s infinite ease-in-out;
}
.isa-typing span:nth-child(2) { animation-delay: .15s; }
.isa-typing span:nth-child(3) { animation-delay: .3s; }
.isa-typing__note { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--gray-500); }
.isa-li-note { font-size: 13px; color: var(--gray-600); }
@keyframes isa-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

/* Artifacts */
.isa-artifact { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.isa-artifact__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Formatted resume "sheet": the builder's HTML, laid out like the .docx the
   user downloads (white page, document margins). The inner markup carries its
   own typography; these rules only reset the chat/folder list styling. */
.isa-resume-sheet {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
  padding: 28px 32px;
  max-height: 560px;
  overflow: auto;
  color: #222;
}
.isa-resume-sheet p { margin: 0; }
.isa-resume-sheet ul, .isa-resume-sheet ol { margin: 0; padding-left: 18px; }
.isa-resume-sheet li { margin: 0 0 3px; }
.isa-resume-sheet h1, .isa-resume-sheet h2 { font-weight: 700; }
.isa-resume-sheet pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: none; border: 0; padding: 0; max-height: none; }
@media (max-width: 640px) {
  .isa-resume-sheet { padding: 16px 14px; }
  .isa-resume-sheet ul[style*="columns"] { columns: 2 !important; -webkit-columns: 2 !important; }
}
.isa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-900);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.isa-btn:hover { border-color: var(--orange-500); color: var(--orange-600); }
/* `.isa-msg__bubble a` would otherwise recolour primary links orange-on-orange */
.isa-btn--primary, .isa-msg__bubble a.isa-btn--primary { background: linear-gradient(135deg, var(--orange-500), var(--orange-600)); color: #fff; border: none; text-decoration: none; }
.isa-btn--primary:hover, .isa-msg__bubble a.isa-btn--primary:hover { color: #fff; opacity: .95; }
.isa-btn.is-on { background: #FDEBD9; border-color: var(--orange-500); color: var(--orange-600); }
/* Job card buttons that run a tool through ISA (Create resume / Mock Interview) */
.isa-btn--tool { border-color: var(--orange-500); color: var(--orange-600); background: #FFF7F0; font-weight: 600; }
.isa-btn--tool:hover { background: #FDEBD9; }
.isa-btn[disabled] { opacity: .6; cursor: default; }

.isa-job-card {
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  /* main column | side column (View posting + thumbs, top-right); actions span both */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: start;
}
.isa-job-card__main { min-width: 0; }
.isa-job-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.isa-job-card__side .isa-job-card__view { padding: 6px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.isa-job-card__prefs { display: inline-flex; gap: 6px; }
.isa-pref {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border-radius: 8px; border: 1px solid var(--gray-200); background: #fff; color: var(--gray-500);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.isa-pref svg { width: 16px; height: 16px; }
.isa-pref--up:hover, .isa-pref--up.is-on { color: #059669; border-color: #059669; background: #ECFDF5; }
.isa-pref--down:hover, .isa-pref--down.is-on { color: #DC2626; border-color: #DC2626; background: #FEF2F2; }
.isa-pref.is-on svg { fill: currentColor; }
.isa-pref[disabled] { opacity: .6; cursor: default; }
.isa-job-card__title { font-weight: 700; font-size: 14px; margin: 0; }
.isa-job-card__sub { font-size: 12.5px; color: var(--gray-500); margin: 2px 0 8px; }
/* Job Finder fit analysis (mirrors job-finder.html's .fit-score / .fit-reasoning) */
.isa-job-card__fit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.isa-fit { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; }
.isa-fit--high { background: #059669; }
.isa-fit--medium { background: #D97706; }
.isa-fit--low { background: #DC2626; }
.isa-fit-badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--gray-100); color: var(--gray-900); }
.isa-fit-badge--warn { background: #FEF3C7; color: #92400E; }
.isa-job-card__why {
  margin: 0 0 8px; padding: 8px 10px; font-size: 13px; line-height: 1.5;
  color: var(--gray-600); background: var(--gray-50); border-left: 3px solid var(--gray-300); border-radius: 6px;
}
.isa-job-card__why strong { color: var(--gray-900); }
.isa-job-card__why--warn { background: #FFFBEB; border-left-color: #F59E0B; color: #92400E; }
.isa-job-card__why--muted { background: transparent; border-left-color: var(--gray-200); color: var(--gray-500); font-style: italic; padding: 2px 10px; }
.isa-job-card__skills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.isa-job-card__skills-label { font-size: 11.5px; color: var(--gray-500); }
.isa-skill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #ECFDF5; color: #065F46; }
.isa-job-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.isa-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-900);
}
.isa-tag--on { background: #FDEBD9; color: var(--orange-600); }
.isa-job-card__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.isa-job-card__actions:empty { display: none; }
.isa-job-card__actions .isa-btn { padding: 5px 10px; font-size: 12px; }

/* ---------- Composer ---------- */
.isa-composer-wrap {
  width: 100%;
  max-width: 820px;
  padding: 8px 16px 18px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
}

.isa-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 18px;
  padding: 10px 10px 10px 16px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.isa-composer:focus-within { border-color: var(--orange-500); box-shadow: 0 6px 24px rgba(240,146,53,.18); }

.isa-composer textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  max-height: 180px;
  min-height: 24px;
  padding: 4px 0;
  background: transparent;
  color: var(--gray-900);
}
.isa-composer textarea::placeholder { color: var(--gray-500); transition: opacity .3s; }
.isa-composer textarea.placeholder-fade::placeholder { opacity: 0; }

.isa-composer__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.isa-composer__send[disabled] { opacity: .5; cursor: default; }

.isa-composer__hint { text-align: center; font-size: 11px; color: var(--gray-500); margin-top: 6px; }

/* ---------- Folder panel ---------- */
.isa-folder {
  flex: 1;
  width: 100%;
  max-width: 900px;
  padding: 10px 16px 30px;
  display: none;
  flex-direction: column;
  gap: 12px;
}
.isa-folder.open { display: flex; }

.isa-folder__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.isa-folder__head h2 { margin: 0; font-size: 20px; }
.isa-folder__filters { display: flex; flex-wrap: wrap; gap: 6px; }
.isa-filter {
  border: 1px solid var(--gray-200);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--gray-900);
}
.isa-filter.active { background: #FDEBD9; border-color: var(--orange-500); color: var(--orange-600); font-weight: 600; }

.isa-folder__list { display: flex; flex-direction: column; gap: 10px; }
.isa-record {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.isa-record__row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.isa-record__title { font-weight: 700; margin: 0; font-size: 15px; }
.isa-record__sub { font-size: 12.5px; color: var(--gray-500); margin: 2px 0 0; }
.isa-record__body { margin-top: 10px; font-size: 13.5px; line-height: 1.5; display: none; }
.isa-record.open .isa-record__body { display: block; }
.isa-record__body pre { white-space: pre-wrap; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px; font-size: 12.5px; max-height: 320px; overflow: auto; }
.isa-record__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Interview transcript rendered as chat bubbles (Interviewer left, Candidate right) */
.isa-transcript { display: flex; flex-direction: column; gap: 10px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 10px; padding: 12px; max-height: 420px; overflow: auto; }
.isa-transcript__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--gray-500); padding-bottom: 8px; border-bottom: 1px dashed var(--gray-200); }
.isa-transcript__note { font-size: 12px; color: var(--gray-500); font-style: italic; text-align: center; white-space: pre-wrap; }
.isa-transcript__turn { display: flex; flex-direction: column; max-width: 82%; }
.isa-transcript__turn--interviewer { align-self: flex-start; align-items: flex-start; }
.isa-transcript__turn--candidate { align-self: flex-end; align-items: flex-end; }
.isa-transcript__bubble { font-size: 13px; line-height: 1.5; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.isa-transcript__turn--interviewer .isa-transcript__bubble { background: #fff; border: 1px solid var(--gray-200); border-bottom-left-radius: 4px; }
.isa-transcript__turn--candidate .isa-transcript__bubble { background: #fff3e8; border: 1px solid #ffd9b8; border-bottom-right-radius: 4px; }
.isa-record__actions .isa-btn { padding: 5px 10px; font-size: 12px; }
.isa-folder__empty { color: var(--gray-500); text-align: center; padding: 30px 10px; }

/* ---------- Tool pages wrapped by js/isa-shell.js ---------- */
.isa-shell--page { width: 100%; }
.isa-shell--page .isa-sidebar { top: 72px; }          /* stay below the sticky header */
.isa-sidebar a.isa-sidebar__new { text-decoration: none; }
.isa-main--page { padding: 0 0 32px; align-items: center; }
.isa-main--page > * { width: 100%; box-sizing: border-box; }   /* page content keeps its own max-width */

/* Sidebar toggle in header */
.isa-sidebar-toggle {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .isa-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1500;
    max-height: none;
    box-shadow: var(--shadow-lg);
    transform: translateX(0);
    margin-left: 0;
  }
  .isa-shell.sidebar-collapsed .isa-sidebar { transform: translateX(-100%); margin-left: 0; }
  .isa-sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1400; display: none;
  }
  .isa-shell:not(.sidebar-collapsed) .isa-sidebar-backdrop { display: block; }
  .isa-msg__bubble { max-width: 92%; }
}
