/* ============================================================
   HireXA - Candidate Application (public) - glass redesign
   Design tokens from Figma: liquid-glass cards, Inter, blue #007EE8
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #ECEBF0;
    --ink: #0F172A;          /* text primary   */
    --ink-2: #334155;        /* text secondary */
    --ink-3: #64748B;        /* text tertiary  */
    --ink-4: #94A3B8;        /* placeholder    */
    --line: #CBD5E1;         /* borders        */
    --field: #FAFAFA;        /* input bg       */
    --blue: #007EE8;
    --blue-2: #0B90F3;
    --glass: rgba(255, 255, 255, 0.2);
    --glow: inset 0 0 22.6px #FFFFFF;
    --radius-card: 24px;
    --rail: 80px;
}

html, body {
    background: var(--bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Brand rail ---------- */
.ja-rail {
    position: fixed;
    top: 24px; left: 24px;
    width: var(--rail);
    padding: 24px 16px;
    display: flex; flex-direction: column; align-items: center;
    background: var(--glass);
    box-shadow: var(--glow);
    border-radius: 16px;
    z-index: 20;
}
.ja-app-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.ja-app-icon img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Shell ---------- */
.ja-shell {
    margin-left: calc(var(--rail) + 48px);
    padding: 24px 40px 48px 24px;
    max-width: 1400px;
}

/* ---------- Top bar ---------- */
.ja-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    background: var(--glass);
    box-shadow: var(--glow);
    border-radius: 16px;
}
.ja-crumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--ink-3); font-weight: 400;
    min-width: 0;
}
.ja-crumb strong { color: var(--ink); font-weight: 600; }
.ja-crumb span, .ja-crumb strong {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch;
}
.ja-crumb-sep { color: var(--ink-4); }
.ja-powered { font-size: 13px; color: var(--ink-3); font-weight: 400; }
.ja-powered strong { color: var(--ink-2); font-weight: 700; }
.ai { color: var(--blue); }

/* ---------- Main / states ---------- */
.ja-main { margin-top: 40px; }
.ja-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    min-height: 60vh; gap: 12px; padding: 40px 20px;
}
.ja-state h2 { font-size: 24px; font-weight: 700; }
.ja-state p { color: var(--ink-3); font-size: 15px; max-width: 460px; }
.ja-state .closed-sub { font-size: 13px; color: var(--ink-4); }
.spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 3px solid #dfe4ea; border-top-color: var(--blue);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.success-icon {
    width: 68px; height: 68px; border-radius: 50%;
    background: #CAEBE1; display: flex; align-items: center; justify-content: center;
}
.success-box {
    margin-top: 8px; text-align: left; display: inline-flex; flex-direction: column; gap: 6px;
    background: var(--glass); box-shadow: var(--glow); border-radius: 14px;
    padding: 18px 22px; font-size: 14px; color: var(--ink-2);
}
.success-box strong { color: var(--ink); }

/* ---------- Layout wrap ---------- */
.ja-wrap { display: flex; flex-direction: column; gap: 24px; }

/* ---------- Hero card ---------- */
.ja-hero {
    background: var(--glass);
    box-shadow: var(--glow);
    border-radius: var(--radius-card);
    padding: 24px;
    display: flex; flex-direction: column; gap: 20px;
}
.ja-hero-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.ja-hero-title { display: flex; flex-direction: column; gap: 8px; }
.ja-hero-title h1 { font-size: 30px; line-height: 1.25; font-weight: 600; color: var(--ink); }
.ja-hero-loc {
    display: flex; align-items: center; gap: 6px;
    font-size: 16px; color: var(--ink-2);
}
.ja-hero-tags { display: flex; align-items: center; gap: 12px; }
.ja-tag {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: 16px;
    font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
}
.ja-tag-green { background: #CAEBE1; color: #3C8770; }
.ja-tag-neutral { background: #D6DAE0; color: #5F6B7A; }

.ja-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.ja-stat {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 18px 20px; text-align: center;
    background: linear-gradient(315.92deg, rgba(12,144,243,0.08) 13.11%, rgba(12,144,243,0) 73.64%), #FAFAFA;
    box-shadow: var(--glow);
    border-radius: 12px;
    min-height: 92px;
}
.ja-stat-label { font-size: 14px; color: var(--ink-2); }
.ja-stat-value { font-size: 16px; font-weight: 600; color: var(--ink); }

/* JD toggle */
.ja-jd { border-top: 1px solid rgba(203,213,225,0.7); padding-top: 4px; }
.ja-jd summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--ink-2);
    padding: 8px 0;
}
.ja-jd summary::-webkit-details-marker { display: none; }
.ja-chev { transition: transform .2s ease; }
.ja-jd[open] .ja-chev { transform: rotate(90deg); }
.jd-content {
    font-size: 14px; line-height: 1.65; color: var(--ink-2);
    padding: 8px 2px 6px; max-height: 420px; overflow-y: auto;
}
.jd-content p { margin-bottom: 10px; }
.jd-content a { color: var(--blue); }

/* ---------- Tabs ---------- */
.ja-tabs {
    display: flex; gap: 40px;
    border-bottom: 1px solid var(--line);
    padding: 0 4px;
}
.ja-tab {
    background: none; border: none; cursor: pointer;
    padding: 12px 4px; margin-bottom: -1px;
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-3);
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.ja-tab:hover { color: var(--ink-2); }
.ja-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- Steps ---------- */
.ja-form { display: flex; flex-direction: column; gap: 24px; }
.ja-step { display: flex; flex-direction: column; gap: 24px; }

/* ---------- Cards ---------- */
.ja-card {
    background: var(--glass);
    box-shadow: var(--glow);
    border-radius: var(--radius-card);
    padding: 22px 24px;
    display: flex; flex-direction: column; gap: 16px;
}
.ja-card-head { display: flex; flex-direction: column; gap: 4px; }
.ja-card-head h2 { font-size: 20px; font-weight: 600; color: var(--ink); }
.ja-card-head p { font-size: 12px; color: var(--ink-3); }

/* ---------- Grid + fields ---------- */
.ja-grid { display: grid; gap: 16px; }
.ja-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ja-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ja-grid-align { align-items: stretch; }
.ja-grid-align > .ja-card { height: 100%; }

.ja-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ja-field > label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.ja-field .req { color: #E63946; }
.ja-field .opt { font-weight: 400; color: var(--ink-3); }

.ja-input {
    display: flex; align-items: center; gap: 8px;
    background: var(--field);
    border: 1px solid var(--line);
    box-shadow: var(--glow);
    border-radius: 12px;
    padding: 8px 16px;
    height: 40px;
}
.ja-input:focus-within { border-color: var(--blue); }
.ja-input input,
.ja-input select {
    width: 100%; border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
}
.ja-input input::placeholder { color: var(--ink-4); font-weight: 500; }

/* salary row (currency + amount) */
.ja-sal-row { display: flex; gap: 8px; }
.ja-sal-row .ja-input:last-child { flex: 1; }
/* native selects are enhanced into .ja-cs by JS; hide the raw control */
select.ja-enhance { display: none; }

/* ---------- Custom dropdown (styled select) ---------- */
.ja-cs { position: relative; flex: 1; }
.ja-cs.ja-cs-cur { flex: 0 0 auto; width: 88px; }
.ja-cs-trigger {
    width: 100%; height: 40px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: var(--field); border: 1px solid var(--line); box-shadow: var(--glow);
    border-radius: 12px; padding: 8px 14px;
    font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
    cursor: pointer; text-align: left;
    transition: border-color .15s ease;
}
.ja-cs-trigger:hover { border-color: var(--blue-2); }
.ja-cs.open .ja-cs-trigger { border-color: var(--blue); }
.ja-cs-trigger.placeholder .ja-cs-label { color: var(--ink-4); }
.ja-cs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-cs-chev { flex: none; transition: transform .2s ease; color: var(--ink-2); }
.ja-cs.open .ja-cs-chev { transform: rotate(180deg); }
.ja-cs-menu {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
    background: #FFFFFF; border: 1px solid #E2E8F0; border-radius: 12px;
    box-shadow: 0 14px 34px -12px rgba(15,23,42,0.28);
    padding: 6px; max-height: 264px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: #CBD5E1 transparent;
}
.ja-cs-menu::-webkit-scrollbar { width: 8px; }
.ja-cs-menu::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 8px; }
.ja-cs-opt {
    padding: 9px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.ja-cs-opt:hover { background: #F1F5F9; }
.ja-cs-opt.selected { background: rgba(0,126,232,0.1); color: var(--blue); font-weight: 600; }

/* ---------- Resume upload ---------- */
.ja-upload-zone {
    border: 1.5px dashed var(--line);
    border-radius: 16px;
    background: rgba(250,250,250,0.5);
    padding: 40px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer; text-align: center;
    transition: border-color .15s ease, background .15s ease;
}
.ja-upload-zone:hover { border-color: var(--blue-2); background: rgba(11,144,243,0.04); }
.ja-upload-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: rgba(11,144,243,0.1);
    display: flex; align-items: center; justify-content: center;
}
.ja-upload-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.ja-upload-hint { font-size: 12px; color: var(--ink-3); }
.ja-upload-file {
    display: flex; align-items: center; gap: 10px;
    background: var(--field); border: 1px solid var(--line);
    box-shadow: var(--glow); border-radius: 12px; padding: 12px 16px;
    font-size: 13px; font-weight: 500; color: var(--ink);
}
.ja-upload-file span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ja-remove {
    background: none; border: none; cursor: pointer;
    color: #E63946; font-family: inherit; font-size: 12px; font-weight: 600;
}

/* ---------- Identity photo ---------- */
.ja-photo { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.ja-photo-stage {
    width: 132px; height: 132px; flex: 0 0 auto;
    border-radius: 14px; overflow: hidden;
    border: 1.5px dashed var(--line);
    background: #F1F3F6;
    display: flex; align-items: center; justify-content: center;
}
.ja-photo-stage video,
.ja-photo-stage img { width: 100%; height: 100%; object-fit: cover; display: none; }
#ja-photo-empty { display: flex; align-items: center; justify-content: center; }
.ja-photo-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.ja-photo-note { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.ja-photo-actions { display: flex; flex-direction: column; gap: 8px; }

.ja-btn-ghost, .ja-btn-primary, .ja-btn-file {
    padding: 10px 16px; border-radius: 12px;
    font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    text-align: center; white-space: nowrap;
}
.ja-btn-ghost {
    background: rgba(255,255,255,0.7); border: 1px solid var(--line); color: var(--ink-2);
    box-shadow: var(--glow);
}
.ja-btn-ghost:hover { border-color: var(--blue-2); color: var(--blue); }
.ja-btn-primary, .ja-btn-file {
    background: var(--blue-2); border: 1px solid #8AC9FF; color: #fff;
    box-shadow: 0 4px 10px -6px rgba(0,0,0,0.2), inset 0 0 7.7px rgba(255,255,255,0.4);
}
.ja-btn-primary:hover, .ja-btn-file:hover { background: var(--blue); }
#ja-photo-capture-btn, #ja-photo-retake-btn { display: none; }

/* ---------- Choice rows (relocate) ---------- */
.ja-choice-group { display: flex; flex-direction: column; gap: 12px; }
.ja-choice {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    border: 1px solid var(--line); background: var(--field);
    box-shadow: var(--glow); cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.ja-choice input { position: absolute; opacity: 0; pointer-events: none; }
.ja-choice-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ja-choice-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.ja-choice-sub { font-size: 12px; color: var(--ink-3); }
.ja-choice-dot {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--line); flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s ease, background .15s ease;
}
.ja-choice input:checked ~ .ja-choice-dot {
    border-color: var(--blue); background: var(--blue);
    box-shadow: inset 0 0 0 3px #fff;
}
.ja-choice:has(input:checked) {
    border-color: var(--blue); background: rgba(0,126,232,0.05);
}

/* ---------- Footer ---------- */
.ja-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 22px 24px;
    background: var(--glass);
    box-shadow: var(--glow);
    border-radius: 16px;
}
.ja-btn-back {
    padding: 12px 20px; border-radius: 15px;
    background: linear-gradient(179deg, rgba(0,126,232,0) 39%, rgba(0,126,232,0.14) 151%), rgba(255,255,255,0.7);
    border: 1px solid var(--line); box-shadow: var(--glow);
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.ja-btn-back:hover { border-color: var(--blue-2); color: var(--blue); }
.ja-btn-continue {
    padding: 12px 22px; border-radius: 15px;
    background: linear-gradient(180deg, rgba(0,126,232,0) 8%, rgba(0,126,232,0.5) 152%), var(--blue-2);
    border: 1px solid #8AC9FF;
    box-shadow: 0 4px 10px -6px rgba(0,0,0,0.2), inset 0 0 7.7px rgba(255,255,255,0.4);
    font-family: inherit; font-size: 14px; font-weight: 600; color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
}
.ja-btn-continue:hover { background: var(--blue); }
.ja-btn-continue:disabled { opacity: .7; cursor: default; }
.btn-spinner {
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff;
    animation: spin .7s linear infinite;
}
.ja-disclaimer { font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px;
    font-size: 14px; font-weight: 500; z-index: 100;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.4);
    max-width: 90vw;
}
.toast.error { background: #E63946; }
.toast.info { background: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .ja-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .ja-rail { display: none; }
    .ja-shell { margin-left: 0; padding: 16px; }
    .ja-stats { grid-template-columns: repeat(2, 1fr); }
    .ja-grid-2, .ja-grid-3 { grid-template-columns: 1fr; }
    .ja-hero-title h1 { font-size: 24px; }
    .ja-powered { display: none; }
}
@media (max-width: 480px) {
    .ja-stats { grid-template-columns: 1fr; }
    .ja-footer { flex-wrap: wrap; }
    .ja-footer button { flex: 1; }
}
