/* InstantCV builder + tool styles. Loaded on the front page and the
 * Templates / Examples / ATS-checker page templates. */
:root {
  --icv-paper: #faf7f1;
  --icv-ink: #0f2540;
  --icv-accent: #a65c28;
  --icv-accent-soft: #c49a6c;
  --icv-card: #ffffff;
  --icv-line: rgba(15, 37, 64, 0.12);
  --icv-muted: rgba(15, 37, 64, 0.72);
  --icv-radius: 14px;
  --icv-shadow: 0 10px 30px rgba(15, 37, 64, 0.08);
}

/* ---------- buttons ---------- */
.icv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 14px/1.2 Inter, system-ui, sans-serif;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.icv-btn:focus-visible { outline: 2px solid var(--icv-accent); outline-offset: 2px; }
.icv-btn-primary { background: var(--icv-accent); color: #fff; box-shadow: 0 4px 14px rgba(166, 92, 40, .28); }
.icv-btn-primary:hover { background: #8f4e22; transform: translateY(-1px); }
.icv-btn-outline { background: var(--icv-card); border-color: var(--icv-line); color: var(--icv-ink); }
.icv-btn-outline:hover { border-color: var(--icv-accent); color: var(--icv-accent); }
.icv-btn-ghost { background: transparent; color: var(--icv-muted); padding: 10px 12px; }
.icv-btn-ghost:hover { color: var(--icv-ink); background: rgba(15, 37, 64, .05); }
.icv-btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.icv-btn-block { width: 100%; border-style: dashed; }
.icv-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.icv-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; border: none; background: transparent;
  border-radius: 8px; cursor: pointer; color: var(--icv-muted); font-size: 15px;
}
.icv-icon-btn:hover { background: rgba(15, 37, 64, .07); color: var(--icv-ink); }
.icv-icon-btn.danger:hover { color: #a33b3b; background: rgba(163, 59, 59, .08); }
.icv-icon-btn[disabled] { opacity: .35; cursor: default; }

/* ---------- form fields ---------- */
.icv-field { margin-bottom: 14px; }
.icv-field label, .icv-label {
  display: block; font: 600 13px/1.3 Inter, system-ui, sans-serif;
  color: var(--icv-ink); margin-bottom: 6px;
}
.icv-field input, .icv-field textarea, .icv-field select,
.icv-entry input, .icv-entry textarea,
.icv-modal-body textarea, .icv-modal-body input,
.icv-ats-panel input, .icv-ats-panel textarea, .icv-ats-panel select {
  width: 100%; font: 400 14px/1.45 Inter, system-ui, sans-serif; color: var(--icv-ink);
  background: #fff; border: 1px solid var(--icv-line); border-radius: 10px;
  padding: 10px 12px; transition: border-color .12s ease, box-shadow .12s ease;
}
.icv-field textarea, .icv-entry textarea { resize: vertical; }
.icv-field input:focus, .icv-field textarea:focus, .icv-field select:focus,
.icv-entry input:focus, .icv-entry textarea:focus {
  outline: none; border-color: var(--icv-accent);
  box-shadow: 0 0 0 3px rgba(166, 92, 40, .15);
}
.icv-grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .icv-grid2 { grid-template-columns: 1fr 1fr; } }
.icv-hint { font-size: 12px; color: var(--icv-muted); margin: 6px 0 0; }
.icv-optional { font-size: 11px; font-weight: 400; color: var(--icv-muted); text-transform: none; letter-spacing: 0; }

/* ---------- step nav ---------- */
.icv-progress { height: 6px; border-radius: 999px; background: rgba(15, 37, 64, .1); overflow: hidden; margin: 10px 0; }
.icv-progress > div { height: 100%; background: var(--icv-accent); border-radius: 999px; transition: width .25s ease; }
.icv-step-pills { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.icv-step-pills::-webkit-scrollbar { display: none; }
.icv-step-pill {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--icv-line); background: #fff; border-radius: 999px;
  padding: 6px 12px; font: 500 12px Inter, system-ui, sans-serif; color: var(--icv-ink); cursor: pointer;
}
.icv-step-pill:hover { border-color: var(--icv-accent); }
.icv-step-pill.active { background: var(--icv-accent); border-color: transparent; color: #fff; }
.icv-step-pill .icv-check { color: #2f7a3d; font-weight: 700; }
.icv-step-pill.active .icv-check { color: #fff; }
.icv-step-pill .icv-num { opacity: .6; font-size: 11px; }
.icv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icv-step-title { font: 600 17px Fraunces, Georgia, serif; margin: 18px 0 14px; }
.icv-step-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--icv-line); padding-top: 14px; margin-top: 18px; }
.icv-step-foot-right { display: flex; gap: 8px; }

/* ---------- entries ---------- */
.icv-entry { border: 1px solid var(--icv-line); border-radius: 12px; padding: 14px; background: #fff; margin-bottom: 12px; }
.icv-entry-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font: 600 14px Inter, system-ui, sans-serif; }
.icv-entry-actions { display: flex; gap: 2px; }
.icv-entry input, .icv-entry textarea { margin-bottom: 8px; }

/* ---------- photo ---------- */
.icv-photo-row { display: flex; gap: 16px; align-items: flex-start; }
.icv-photo-thumb {
  width: 80px; height: 80px; border-radius: 999px; background: rgba(15, 37, 64, .06);
  border: 1px solid var(--icv-line); overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: var(--icv-muted); font-size: 28px;
}
.icv-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.icv-photo-row input[type="file"] { margin: 4px 0 8px; font-size: 13px; }

/* ---------- sticky toolbar ---------- */
.icv-toolbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: rgba(250, 247, 241, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--icv-line); border-radius: var(--icv-radius);
  padding: 10px 14px; box-shadow: var(--icv-shadow);
}
.icv-theme-btn { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--icv-line); border-radius: 10px; padding: 8px 12px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; color: var(--icv-ink); }
.icv-theme-btn:hover { border-color: var(--icv-accent); }
.icv-theme-btn-swatch { width: 18px; height: 18px; border-radius: 6px; display: inline-block; }
.icv-toolbar-sep { width: 1px; align-self: stretch; background: var(--icv-line); }
.icv-toolbar-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icv-toolbar-label { font: 600 12px Inter, system-ui, sans-serif; color: var(--icv-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- preview frame ---------- */
.icv-frame { position: relative; overflow: hidden; background: #e9e4d8; border-radius: 8px; }
.icv-frame .icv-scale { position: absolute; top: 0; left: 0; }
.icv-frame.is-sample .icv-sheet, .icv-frame.is-sample .icv-scale { opacity: .92; }
.icv-preview-shell { border: 1px solid var(--icv-line); border-radius: var(--icv-radius); background: #efeae0; padding: 12px; }
@media (min-width: 640px) { .icv-preview-shell { padding: 24px; } }
.icv-preview-note { text-align: center; font-size: 12px; color: var(--icv-muted); margin-top: 8px; }
.icv-mini .icv-sheet { box-shadow: none; }

/* ---------- ATS meter ---------- */
.icv-meter-card, .icv-ats-panel, .icv-export-card, .icv-form-card, .icv-draft-card {
  background: var(--icv-card); border: 1px solid var(--icv-line);
  border-radius: var(--icv-radius); padding: 18px; box-shadow: var(--icv-shadow);
}
.icv-meter { display: flex; align-items: center; gap: 14px; }
.icv-meter-label { font: 700 18px Fraunces, Georgia, serif; }
.icv-meter-sub { font-size: 12px; color: var(--icv-muted); margin-top: 2px; }
.icv-fixes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.icv-fixes li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; background: var(--icv-paper); border: 1px solid var(--icv-line);
  border-radius: 10px; padding: 8px 10px;
}
.icv-fixes button, .icv-fix-link {
  flex-shrink: 0; font: 600 12px Inter, system-ui, sans-serif; color: var(--icv-accent);
  background: none; border: none; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 4px;
}

/* ---------- modal ---------- */
.icv-modal { position: fixed; inset: 0; z-index: 100; padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.icv-modal-backdrop { position: fixed; inset: 0; background: rgba(15, 37, 64, .5); backdrop-filter: blur(2px); }
.icv-modal-card {
  position: relative; background: #fff; border-radius: 18px; width: 100%; max-width: min(560px, 100%);
  max-height: none; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(15, 37, 64, .3);
  margin: 6vh auto;
}
.icv-modal.wide .icv-modal-card { max-width: min(960px, 100%); }
.icv-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--icv-line); }
.icv-modal-head h3 { font: 600 19px Fraunces, Georgia, serif; margin: 0; }
.icv-modal-body { padding: 20px; overflow-y: auto; }
.icv-modal-lead { font-size: 14px; color: var(--icv-muted); margin: 0 0 14px; }
.icv-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- tabs ---------- */
.icv-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.icv-tab {
  border: 1px solid var(--icv-line); background: #fff; border-radius: 999px;
  padding: 7px 14px; font: 600 13px Inter, system-ui, sans-serif; color: var(--icv-ink); cursor: pointer;
}
.icv-tab:hover { border-color: var(--icv-accent); }
.icv-tab.active { background: var(--icv-ink); border-color: var(--icv-ink); color: #fff; }

/* ---------- theme cards ---------- */
.icv-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.icv-theme-card {
  border: 1px solid var(--icv-line); border-radius: 12px; overflow: hidden; background: #fff;
  cursor: pointer; padding: 0; text-align: left; font: inherit; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.icv-theme-card:hover { transform: translateY(-2px); box-shadow: var(--icv-shadow); border-color: var(--icv-accent); }
.icv-theme-card.selected { border-color: var(--icv-accent); box-shadow: 0 0 0 2px rgba(166, 92, 40, .35); }
.icv-theme-card .icv-frame { border-radius: 0; }
.icv-theme-card-meta { padding: 10px 12px; }
.icv-theme-card-meta strong { font-size: 14px; }
.icv-theme-card-meta p { font-size: 12px; color: var(--icv-muted); margin: 4px 0 0; }
.icv-badge {
  display: inline-block; font: 700 10px Inter, system-ui, sans-serif; letter-spacing: .04em;
  background: rgba(47, 122, 61, .12); color: #2f7a3d; border-radius: 999px; padding: 3px 8px; vertical-align: 1px;
}

/* ---------- gallery cards (templates / examples pages) ---------- */
.icv-tgroup { margin-bottom: 40px; }
.icv-tgroup > h2 { font: 600 24px Fraunces, Georgia, serif; margin: 0 0 16px; }
.icv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.icv-card { background: #fff; border: 1px solid var(--icv-line); border-radius: 14px; overflow: hidden; box-shadow: var(--icv-shadow); display: flex; flex-direction: column; }
.icv-card .icv-frame { border-radius: 0; }
.icv-card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.icv-card-title { font-size: 16px; }
.icv-card-tag { font-size: 13px; color: var(--icv-muted); margin: 0; }
.icv-card-best { font-size: 13px; margin: 0; }
.icv-card-best span { font-weight: 600; }
.icv-card-body .icv-btn { margin-top: auto; align-self: flex-start; }

/* ---------- example picker rows ---------- */
.icv-example-list { display: grid; gap: 8px; }
.icv-example-row {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  border: 1px solid var(--icv-line); border-radius: 12px; padding: 12px; background: #fff;
  cursor: pointer; font: inherit; color: inherit; width: 100%;
}
.icv-example-row:hover { border-color: var(--icv-accent); }
.icv-example-dot { width: 14px; height: 14px; border-radius: 999px; flex-shrink: 0; margin-top: 3px; }
.icv-example-row strong { font-size: 14px; }
.icv-example-industry { font-size: 11px; font-weight: 700; color: var(--icv-accent); margin-left: 8px; text-transform: uppercase; letter-spacing: .05em; }
.icv-example-tagline { display: block; font-size: 12px; color: var(--icv-muted); margin-top: 2px; }

/* ---------- draft bar / privacy note / loaded banner ---------- */
.icv-draft-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.icv-draft-status { font-size: 13px; color: var(--icv-muted); }
.icv-privacy-note {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(166, 92, 40, .08); border: 1px solid rgba(166, 92, 40, .25);
  border-radius: 12px; padding: 12px 14px; font-size: 13px;
}
.icv-privacy-note p { margin: 0; flex: 1; }
.icv-loaded-banner {
  background: var(--icv-accent); color: #fff; border-radius: 0;
  padding: 10px 16px; font-size: 14px;
}
.icv-loaded-banner .icv-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icv-loaded-banner button { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; opacity: .85; }
.icv-loaded-banner button:hover { opacity: 1; }

/* ---------- mobile preview ---------- */
.icv-view-toggle { display: none; }
#icv-preview-shell-desktop, #icv-preview-note { display: none; }
@media (min-width: 1024px) {
  #icv-preview-shell-desktop, #icv-preview-note { display: block; }
}
@media (max-width: 1023px) {
  .icv-view-toggle {
    display: inline-flex; margin: 0 0 14px; background: #fff;
    border: 1px solid var(--icv-line); border-radius: 999px; padding: 3px; gap: 2px;
    box-shadow: var(--icv-shadow);
  }
  .icv-view-toggle button {
    border: none; background: none; border-radius: 999px; padding: 9px 26px;
    font: 600 14px Inter, system-ui, sans-serif; color: var(--icv-muted); cursor: pointer;
  }
  .icv-view-toggle button.active { background: var(--icv-ink); color: #fff; }
  #icv-builder-grid.view-edit .builder-preview-col { display: none; }
  #icv-builder-grid.view-preview .builder-form-col { display: none; }
  #icv-builder-grid.view-preview #icv-preview-shell-desktop,
  #icv-builder-grid.view-preview #icv-preview-note { display: block; }
  #icv-builder-grid.view-preview .builder-preview-col > .sticky { position: static; }
}

/* ---------- toast ---------- */
.icv-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--icv-ink); color: #fff; font: 500 14px Inter, system-ui, sans-serif;
  padding: 12px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 200; max-width: 90vw; text-align: center;
}
.icv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.icv-toast.error { background: #a33b3b; }

/* ---------- ATS tool page ---------- */
.icv-ats-panel { margin-bottom: 20px; }
.icv-ats-panel h3 { font: 600 18px Fraunces, Georgia, serif; margin: 0 0 10px; }
.icv-ats-result { margin-top: 16px; border-top: 1px solid var(--icv-line); padding-top: 16px; }
.icv-ats-score { font: 700 20px Inter, system-ui, sans-serif; }
.icv-ats-num { font-size: 44px; }
.icv-ats-den { font-size: 18px; color: var(--icv-muted); }
.icv-ats-label { font: 600 20px Fraunces, Georgia, serif; margin: 2px 0 6px; }

/* ---------- print: only the A4 sheet ---------- */
#icv-print-root { display: none; }
@page { size: A4; margin: 0; }
@media print {
  body.icv-printing > *:not(#icv-print-root) { display: none !important; }
  body.icv-printing #icv-print-root { display: block !important; }
  body.icv-printing #icv-print-root .icv-sheet {
    width: 210mm !important; min-height: auto !important; margin: 0 !important;
    box-shadow: none !important; border-radius: 0 !important;
  }
  body.icv-printing { background: #fff !important; }
}
