/* STM CV Builder — journey, animation and assistant UI (loaded by layouts.admin). */
:root {
    --stm-navy: #1A5276;
    --stm-teal: #21c4cf;
    --stm-teal-dark: #149aa3;
    --stm-gold: #f6c453;
    --stm-ink: #0f2233;
    --stm-muted: #5b6b7b;
    --stm-line: #e3e9ef;
}

/* ── Journey stepper ───────────────────────────────────────────────────── */
.stm-journey { display: flex; align-items: center; gap: .5rem; list-style: none; padding: .85rem 1rem; margin: 0 0 1.25rem; background: #fff; border: 1px solid var(--stm-line); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.stm-journey::-webkit-scrollbar { display: none; }
.stm-journey li { display: flex; align-items: center; gap: .55rem; white-space: nowrap; color: var(--stm-muted); font-weight: 600; font-size: .9rem; }
.stm-journey li + li::before { content: ''; width: 28px; height: 2px; background: var(--stm-line); border-radius: 2px; margin-right: .35rem; }
.stm-journey .stm-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: #eef3f7; color: var(--stm-muted); transition: background .3s ease, color .3s ease, transform .3s ease; }
.stm-journey li.is-done { color: var(--stm-ink); }
.stm-journey li.is-done .stm-dot { background: #e6f8f0; color: #18794e; }
.stm-journey li.is-done + li::before, .stm-journey li.is-current + li::before { background: linear-gradient(90deg, var(--stm-teal), var(--stm-line)); }
.stm-journey li.is-current { color: var(--stm-navy); }
.stm-journey li.is-current .stm-dot { background: linear-gradient(135deg, var(--stm-navy), var(--stm-teal)); color: #fff; transform: scale(1.08); box-shadow: 0 6px 14px -6px rgba(26,82,118,.7); }
.stm-journey a { color: inherit; text-decoration: none; }
.stm-journey a:hover { color: var(--stm-navy); }
@media (max-width: 575px) { .stm-journey li:not(.is-current) .stm-label { display: none; } }

/* ── Reveal ───────────────────────────────────────────────────────────── */
.stm-js [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); transition-delay: var(--reveal-delay, 0s); }
.stm-js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ── Template gallery ─────────────────────────────────────────────────── */
.stm-template-card .submit-preference { border-radius: 12px; transition: transform .25s ease, box-shadow .25s ease; cursor: pointer; }
.stm-template-card .submit-preference:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -24px rgba(15,34,51,.55); }
.stm-template-card .submit-preference:focus-visible { outline: 3px solid var(--stm-teal); outline-offset: 3px; }
.favourite-btn i { transition: transform .2s ease, color .2s ease; }
.favourite-btn.is-pop i { animation: stm-pop .35s ease; }
@keyframes stm-pop { 50% { transform: scale(1.45); } }

.stm-continue { border: 0; border-radius: 16px; background: linear-gradient(120deg, #fff 0%, #f1fbfc 100%); box-shadow: 0 10px 30px -18px rgba(15,34,51,.4); }
.stm-continue .progress { height: 8px; border-radius: 999px; background: #e6eef4; }
.stm-continue .progress-bar { background: linear-gradient(90deg, var(--stm-navy), var(--stm-teal)); transition: width 1s ease; }

/* ── Builder: section nav ─────────────────────────────────────────────── */
.stm-sections { position: sticky; top: 64px; z-index: 20; display: flex; gap: .4rem; flex-wrap: nowrap; overflow-x: auto; padding: .6rem; margin: 0 0 1rem; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border: 1px solid var(--stm-line); border-radius: 14px; scrollbar-width: none; }
.stm-sections::-webkit-scrollbar { display: none; }
.stm-sections a { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .4rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--stm-ink); text-decoration: none; border: 1px solid transparent; }
.stm-sections a:hover { background: #f1f6f9; }
.stm-sections a.is-active { background: var(--stm-navy); color: #fff; }
.stm-sections .stm-state { width: 8px; height: 8px; border-radius: 50%; background: #c9d4dd; }
.stm-sections .stm-state.is-saved { background: #34c38f; }

/* ── Builder: assistant panel ─────────────────────────────────────────── */
.stm-assistant { border: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 16px 40px -28px rgba(15,34,51,.6); }
.stm-assistant-head { background: linear-gradient(120deg, #123b56, var(--stm-navy) 55%, #17708a); color: #fff; padding: 1.1rem 1.25rem; }
.stm-assistant-head h5 { margin: 0; font-weight: 800; }
.stm-assistant-tabs { display: flex; gap: .4rem; margin-top: .85rem; flex-wrap: wrap; }
.stm-assistant-tabs button { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 999px; padding: .35rem .9rem; font-weight: 600; font-size: .85rem; }
.stm-assistant-tabs button.is-active { background: #fff; color: var(--stm-navy); }
.stm-dropzone { border: 2px dashed #b9cbd8; border-radius: 14px; padding: 1.75rem 1rem; text-align: center; transition: border-color .2s ease, background .2s ease; cursor: pointer; }
.stm-dropzone:hover, .stm-dropzone.is-over { border-color: var(--stm-teal); background: #f1fbfc; }
.stm-dropzone i { font-size: 2rem; color: var(--stm-teal-dark); }
.stm-steps-live { list-style: none; padding: 0; margin: 1rem 0 0; }
.stm-steps-live li { display: flex; align-items: center; gap: .6rem; padding: .25rem 0; color: var(--stm-muted); transition: color .3s ease; }
.stm-steps-live li.is-active { color: var(--stm-ink); font-weight: 600; }
.stm-steps-live li.is-done { color: #18794e; }
.stm-steps-live .fa-spin { color: var(--stm-teal-dark); }
.stm-result { border-radius: 14px; background: #f3fbf7; border: 1px solid #c6ecd8; padding: 1rem 1.1rem; }
.stm-result .stm-chips span { display: inline-block; background: #fff; border: 1px solid #c6ecd8; border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; margin: .15rem .2rem 0 0; }

/* Fields filled by the assistant glow briefly */
.stm-filled { animation: stm-glow 1.8s ease; }
@keyframes stm-glow { 0% { box-shadow: 0 0 0 0 rgba(33,196,207,.0); background-color: #eafafb; } 30% { box-shadow: 0 0 0 4px rgba(33,196,207,.25); } 100% { box-shadow: none; background-color: inherit; } }

/* Improve-with-AI buttons */
.stm-improve { display: inline-flex; align-items: center; gap: .3rem; margin-top: .35rem; border: 0; background: none; color: var(--stm-teal-dark); font-weight: 700; font-size: .8rem; padding: 0; }
.stm-improve:hover { color: var(--stm-navy); }
.stm-improve[disabled] { opacity: .6; }

/* ── Builder: writing tools (phrase ideas + CV strength) ──────────────── */
.stm-score { order: 99; margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: .5rem; padding: .2rem .8rem .2rem .25rem; border: 1px solid var(--stm-line); border-radius: 999px; background: #fff; color: var(--stm-ink); font-size: .85rem; line-height: 1.1; text-align: left; transition: border-color .2s ease, box-shadow .2s ease; }
.stm-score:hover { border-color: var(--stm-teal); box-shadow: 0 6px 16px -10px rgba(26,82,118,.6); }
.stm-score:focus-visible, .stm-drawer button:focus-visible, .stm-ideas-btn:focus-visible { outline: 3px solid var(--stm-teal); outline-offset: 2px; }
.stm-score small { display: block; font-size: .64rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--stm-muted); }
.stm-score strong { font-weight: 800; }
.stm-score-count { min-width: 1.35rem; padding: .1rem .4rem; border-radius: 999px; background: #d64545; color: #fff; font-size: .72rem; font-weight: 800; text-align: center; }
.stm-score-ring { --p: 0; --ring: var(--stm-teal); flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--ring) calc(var(--p) * 1%), #e3e9ef 0); }
.stm-score-ring > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; font-size: .72rem; font-weight: 800; color: var(--stm-ink); }
.stm-score-ring.is-lg { width: 68px; height: 68px; }
.stm-score-ring.is-lg > span { width: 54px; height: 54px; font-size: 1.2rem; }
.stm-score-ring[data-band="weak"] { --ring: #d64545; }
.stm-score-ring[data-band="fair"] { --ring: #e8a317; }
.stm-score-ring[data-band="good"] { --ring: var(--stm-teal); }
.stm-score-ring[data-band="strong"] { --ring: #2fb37f; }
@media (max-width: 767.98px) { .stm-score { order: -1; margin-left: 0; } }

.stm-drawer-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(15,34,51,.45); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s; }
.stm-drawer-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.stm-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1045; display: flex; flex-direction: column; width: min(440px, 100%); background: #fff; box-shadow: -18px 0 40px -24px rgba(15,34,51,.55); transform: translateX(100%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s linear .28s; }
.stm-drawer.is-open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.stm-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--stm-line); }
.stm-drawer-head h5 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--stm-navy); }
.stm-drawer-close { flex: 0 0 auto; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f6f9; color: var(--stm-ink); }
.stm-drawer-close:hover { background: #e3edf3; }
.stm-drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.25rem 1.5rem; }
.stm-drawer-note { margin: .75rem 0; font-size: .8rem; color: var(--stm-muted); }
.stm-drawer-note mark { padding: 0 .15rem; border-radius: 3px; background: #fff2cc; color: inherit; }
html.stm-drawer-locked { overflow: hidden; }
@media (max-width: 575.98px) {
    .stm-drawer { top: auto; height: 88vh; width: 100%; border-radius: 18px 18px 0 0; transform: translateY(100%); }
}

.stm-check-summary { display: flex; align-items: center; gap: 1rem; }
.stm-check-band { font-size: 1.2rem; font-weight: 800; color: var(--stm-ink); }
.stm-filter { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .85rem; }
.stm-filter button { padding: .25rem .75rem; border: 1px solid var(--stm-line); border-radius: 999px; background: #fff; color: var(--stm-ink); font-size: .8rem; font-weight: 600; }
.stm-filter button[aria-pressed="true"] { border-color: var(--stm-navy); background: var(--stm-navy); color: #fff; }
.stm-issues { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.stm-issue { display: flex; gap: .7rem; padding: .75rem .85rem; border: 1px solid var(--stm-line); border-left-width: 4px; border-radius: 12px; background: #fff; }
.stm-issue > i { margin-top: .15rem; }
.stm-issue.is-error { border-left-color: #d64545; } .stm-issue.is-error > i { color: #d64545; }
.stm-issue.is-warning { border-left-color: #e8a317; } .stm-issue.is-warning > i { color: #c9880a; }
.stm-issue.is-tip { border-left-color: var(--stm-teal); } .stm-issue.is-tip > i { color: var(--stm-teal-dark); }
.stm-issue-body { min-width: 0; flex: 1; }
.stm-issue-where { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--stm-muted); overflow-wrap: anywhere; }
.stm-issue p { margin: .15rem 0 .55rem; font-size: .9rem; color: var(--stm-ink); }
.stm-issue-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.stm-issue-actions .btn { padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; white-space: normal; text-align: left; }
.stm-empty { padding: 2rem 1rem; text-align: center; color: var(--stm-muted); }
.stm-empty > i { display: block; margin-bottom: .5rem; font-size: 2rem; color: #2fb37f; }
.stm-empty .fa-spin { color: var(--stm-teal-dark); }

.stm-ideas-btn { display: inline-flex; align-items: center; gap: .3rem; margin: .35rem .9rem 0 0; padding: 0; border: 0; background: none; color: var(--stm-navy); font-size: .8rem; font-weight: 700; }
.stm-ideas-btn i, .stm-ideas-bar > span > i { color: #e0a800; }
.stm-ideas-btn:hover { color: var(--stm-teal-dark); }
.stm-ideas-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; padding: .55rem .8rem; border: 1px solid #f3e2b3; border-radius: 12px; background: #fffaf0; font-size: .85rem; color: var(--stm-ink); }
.stm-ideas-bar .btn { border-radius: 999px; font-size: .8rem; font-weight: 700; }
.stm-idea-controls { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.stm-idea-label { display: block; margin: 0 0 .2rem; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--stm-muted); }
.stm-idea-target { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .25rem .6rem; margin-top: .6rem; }
.stm-idea-target .stm-idea-label { grid-column: 1 / -1; }
.stm-idea-slots { font-size: .78rem; font-weight: 700; color: #18794e; white-space: nowrap; padding-bottom: .3rem; }
.stm-idea-slots.is-full { color: #b3261e; }
.stm-phrases { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.stm-phrase { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; width: 100%; padding: .65rem .8rem; border: 1px solid var(--stm-line); border-radius: 12px; background: #fff; color: var(--stm-ink); font-size: .88rem; text-align: left; transition: border-color .15s ease, background .15s ease; }
.stm-phrase:hover { border-color: var(--stm-teal); background: #f6fdfd; }
.stm-phrase mark, .stm-chip mark { padding: 0 .15rem; border-radius: 3px; background: #fff2cc; color: inherit; }
.stm-phrase small { display: block; margin-top: .2rem; color: var(--stm-muted); }
.stm-phrase .stm-phrase-family { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stm-phrase-add { flex: 0 0 auto; color: var(--stm-teal-dark); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.stm-phrase.is-used { border-color: #c6ecd8; background: #f3fbf7; }
.stm-phrase.is-used .stm-phrase-add { color: #18794e; }
.stm-chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.stm-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border: 1px solid var(--stm-line); border-radius: 999px; background: #fff; color: var(--stm-ink); font-size: .82rem; font-weight: 600; }
.stm-chip:hover { border-color: var(--stm-teal); }
.stm-chip i { font-size: .7rem; color: var(--stm-teal-dark); }
.stm-chip.is-used { border-color: #c6ecd8; background: #f3fbf7; color: #18794e; cursor: default; }
.stm-chip.is-used i { color: #18794e; }

@media (prefers-reduced-motion: reduce) {
    .stm-drawer, .stm-drawer.is-open, .stm-drawer-backdrop, .stm-drawer-backdrop.is-open { transition: none; }
    .stm-js [data-reveal] { opacity: 1; transform: none; transition: none; }
    .stm-filled, .favourite-btn.is-pop i { animation: none; }
    .stm-template-card .submit-preference, .stm-continue .progress-bar { transition: none; }
}
form[id$="DetailsForm"] { scroll-margin-top: 150px; }

/* ── Bootstrap 5 utilities used by some admin pages ───────────────────────
   The admin layout loads Bootstrap 4 CSS, where these classes don't exist — so rows
   with g-3 stacked their columns on mobile with no space between cards. */
.row.g-0 { margin-left: 0; margin-right: 0; }
.row.g-0 > [class*="col"] { padding-left: 0; padding-right: 0; }
.row.g-3 { margin-left: -.5rem; margin-right: -.5rem; row-gap: 1rem; }
.row.g-3 > [class*="col"] { padding-left: .5rem; padding-right: .5rem; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; } .gap-4 { gap: 1.5rem; }
.me-1 { margin-right: .25rem; } .me-2 { margin-right: .5rem; } .me-3 { margin-right: 1rem; }
.ms-1 { margin-left: .25rem; } .ms-2 { margin-left: .5rem; } .ms-3 { margin-left: 1rem; }

/* .btn-stm is width:100% in custom.css (stacked buttons). Use this where buttons sit side by side. */
.btn-stm.stm-btn-auto { width: auto; }

/* CV photo picker: the avatar previews the chosen photo straight away */
.stm-photo-picker { position: relative; display: inline-block; cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.stm-photo-picker img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; border: 2px solid rgba(33,196,207,.6); background: #f1f5f8; transition: opacity .2s ease, border-color .2s ease; }
.stm-photo-picker:hover img { opacity: .85; border-color: var(--stm-teal); }
.stm-photo-badge { position: absolute; right: 0; bottom: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--stm-teal); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.stm-photo-field:focus-within .stm-photo-picker { outline: 3px solid rgba(33,196,207,.45); outline-offset: 3px; }
.stm-photo-field.is-pending .stm-photo-picker img { border-color: #e59b2f; }
.stm-photo-field.is-invalid .stm-photo-picker img { border-color: #e55353; }
.stm-photo-field #photo-undo { color: var(--stm-teal-dark); font-weight: 600; }
