/* =========================================================================
   CPVIA Candidate Application Wizard — public styling
   Reuses site tokens (--primary-blue #3D1A8A, --primary-orange #FF5500).
   Modular: only loaded on apply.php.
   ========================================================================= */

.apply-wrap {
    --ap-blue: var(--primary-blue, #3D1A8A);
    --ap-orange: var(--primary-orange, #FF5500);
    --ap-text: var(--text-dark, #0F0B1F);
    --ap-muted: var(--text-light, #6B6880);
    --ap-border: #E8E3F5;
    max-width: 1360px;
    margin: 0 auto;
    padding: 2rem 5% 3rem;
    font-family: var(--font-sans, 'Montserrat', sans-serif);
}

/* ---- Compact job summary bar ---- */
.apply-summary {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: #fff;
    border: 1px solid var(--ap-border);
    border-left: 4px solid var(--ap-orange);
    border-radius: 14px;
    padding: 0.9rem 1.3rem;
    margin-bottom: 1rem;
    box-shadow: 0 6px 22px rgba(61, 26, 138, 0.05);
}
.apply-summary-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--ap-muted);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.82rem;
    padding-right: 1.2rem;
    border-right: 1px solid var(--ap-border);
    flex-shrink: 0;
}
.apply-summary-back:hover { color: var(--ap-blue); }
.apply-summary-main { min-width: 0; flex: 1; }
.apply-summary-eyebrow { display: block; font-size: 0.62rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ap-orange); }
.apply-summary-title { font-size: 1.15rem; margin: 0.1rem 0 0; color: var(--ap-blue); font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apply-summary-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; flex-shrink: 0; }
.apply-pill {
    background: var(--ap-orange);
    color: #fff;
    padding: 0.35rem 0.9rem;
    border-radius: 30px;
    font-size: 0.74rem;
    font-weight: 700;
}
.apply-pill-soft { background: #F0EBF7; color: var(--ap-blue); }

.apply-alert {
    background: #FDE8E8; color: #B91C1C; border: 1px solid #F5C2C2;
    border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; font-weight: 600; font-size: 0.92rem;
}
.apply-restore {
    background: #FFF6E9; color: #8a5a00; border: 1px solid #ffd98a;
    border-radius: 12px; padding: 0.9rem 1.2rem; margin-bottom: 1.2rem; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.apply-restore-clear {
    border: none; background: var(--ap-blue); color: #fff; font-weight: 700;
    padding: 0.5rem 1rem; border-radius: 30px; cursor: pointer; font-size: 0.82rem;
}

/* ---- Progress ---- */
.apply-progress {
    background: #fff; border: 1px solid var(--ap-border); border-radius: 16px;
    padding: 1.1rem 1.6rem 1rem; margin-bottom: 1.1rem; box-shadow: 0 8px 30px rgba(61, 26, 138, 0.06);
}
.apply-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.apply-step-count { font-size: 0.75rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ap-orange); }
.apply-step-name { font-size: 1.05rem; font-weight: 800; color: var(--ap-blue); }
.apply-progress-track { height: 6px; background: #ECE7F6; border-radius: 999px; overflow: hidden; margin-bottom: 1.3rem; }
.apply-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ap-blue), var(--ap-orange)); border-radius: 999px; transition: width 0.4s ease; }

.apply-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.apply-step-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; min-width: 0; }
.apply-step-item:not(:first-child)::before { content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: #E4DEF3; z-index: 0; }
.apply-step-item.is-active:not(:first-child)::before, .apply-step-item.is-complete:not(:first-child)::before { background: var(--ap-orange); }
.apply-step-dot {
    width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #E4DEF3;
    color: #b3a9d0; display: flex; align-items: center; justify-content: center; font-weight: 800;
    font-size: 0.85rem; position: relative; z-index: 1; transition: 0.25s;
}
.apply-step-dot .dot-check { display: none; }
.apply-step-item.is-active .apply-step-dot { border-color: var(--ap-blue); background: var(--ap-blue); color: #fff; box-shadow: 0 0 0 4px rgba(61, 26, 138, 0.12); }
.apply-step-item.is-complete .apply-step-dot { border-color: var(--ap-orange); background: var(--ap-orange); color: #fff; }
.apply-step-item.is-complete .apply-step-dot .dot-num { display: none; }
.apply-step-item.is-complete .apply-step-dot .dot-check { display: inline; }
.apply-step-item.is-active, .apply-step-item.is-complete { cursor: pointer; }
.apply-step-label { font-size: 0.72rem; font-weight: 700; color: #9b93b5; line-height: 1.2; }
.apply-step-item.is-active .apply-step-label { color: var(--ap-blue); }
.apply-step-item.is-complete .apply-step-label { color: var(--ap-orange); }

/* ---- Cards / panels ---- */
.apply-card {
    background: #fff; border: 1px solid var(--ap-border); border-radius: 20px;
    padding: 2.2rem 2.4rem; box-shadow: 0 12px 40px rgba(61, 26, 138, 0.06);
}
.apply-panel { display: none; }
.apply-panel.is-active { display: block; animation: apFade 0.35s ease; }
@keyframes apFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.apply-card h2 { font-size: 1.5rem; color: var(--ap-blue); font-weight: 800; margin: 0 0 0.3rem; }
.apply-card-sub { color: var(--ap-muted); font-size: 0.92rem; margin: 0 0 1.8rem; }

/* ---- Step 1: AI preparation note ---- */
.apply-ai-note {
    display: flex; align-items: flex-start; gap: 0.8rem;
    background: linear-gradient(120deg, #F4F2FF, #FFF6F0);
    border: 1px solid #E8E3F5; border-radius: 14px;
    padding: 1rem 1.2rem; margin-bottom: 1.4rem;
    color: var(--ap-text); font-size: 0.9rem; line-height: 1.55;
}
.apply-ai-badge {
    flex-shrink: 0; background: var(--ap-blue); color: #fff;
    font-size: 0.66rem; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
    padding: 0.3rem 0.7rem; border-radius: 30px; margin-top: 0.1rem;
}

/* ---- Fields ---- */
.apply-field { margin-bottom: 1.4rem; }
.apply-grid-2, .apply-grid-3 { display: grid; gap: 1.4rem; align-items: start; }
.apply-grid-2 { grid-template-columns: repeat(2, 1fr); }
.apply-grid-3 { grid-template-columns: repeat(3, 1fr); }
.apply-grid-2 > .apply-field, .apply-grid-3 > .apply-field { margin-bottom: 0; }

.apply-field label { display: block; margin-bottom: 0.5rem; font-weight: 700; color: var(--ap-blue); font-size: 0.85rem; }
.apply-field .req { color: var(--ap-orange); }
.apply-field .opt { color: #aaa; font-weight: 500; }
.apply-field input[type=text], .apply-field input[type=email], .apply-field input[type=url],
.apply-field input[type=number], .apply-field select, .apply-field textarea {
    width: 100%; padding: 0.85rem 1rem; border: 1.5px solid var(--ap-border); border-radius: 12px;
    font-family: inherit; font-size: 0.95rem; color: var(--ap-text); background: #fdfdfd; transition: border-color 0.25s, box-shadow 0.25s;
}
.apply-field input:focus, .apply-field select:focus, .apply-field textarea:focus {
    outline: none; border-color: var(--ap-orange); background: #fff; box-shadow: 0 0 0 4px rgba(255, 85, 0, 0.08);
}
.apply-field textarea { resize: vertical; line-height: 1.6; }
.apply-field input.has-error, .apply-field select.has-error, .apply-field textarea.has-error {
    border-color: #e02424; box-shadow: 0 0 0 4px rgba(224, 36, 36, 0.08);
}
.apply-err { display: block; margin-top: 6px; color: #e02424; font-size: 0.78rem; font-weight: 700; }
.apply-hint, .apply-count { display: block; margin-top: 6px; color: #9a94ab; font-size: 0.78rem; }
.apply-count { text-align: right; }
.apply-note { color: #9a94ab; font-size: 0.8rem; margin: 0.6rem 0 0; }
.apply-note-inline { color: #8a5a00; }

/* ---- File upload ---- */
.apply-file { position: relative; }
.apply-file input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
.apply-file-face {
    border: 1.5px dashed #D8CFF2; border-radius: 12px; background: #FAFAFF; padding: 1.3rem 1.2rem;
    display: flex; align-items: center; gap: 1rem; transition: border-color 0.25s, background 0.25s;
}
.apply-file:hover .apply-file-face, .apply-file.has-file .apply-file-face { border-color: var(--ap-orange); background: #FFF6F0; }
.apply-file.dragging .apply-file-face { border-color: var(--ap-orange); background: #FFF0E6; box-shadow: 0 0 0 4px rgba(255, 85, 0, 0.08); }

.apply-file--drop .apply-file-face { flex-direction: column; text-align: center; padding: 2.2rem 1.2rem; gap: 0.7rem; }
.apply-file--drop .apply-file-icon { width: 52px; height: 52px; }
.apply-file-icon { width: 40px; height: 40px; border-radius: 10px; background: #F0EBF7; color: var(--ap-blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.apply-file-text strong { display: block; color: var(--ap-blue); font-size: 0.9rem; word-break: break-all; }
.apply-file-text span { color: var(--ap-muted); font-size: 0.78rem; }

/* ---- Skills chips ---- */
.apply-skill-searchwrap { position: relative; }
.apply-skill-search { width: 100%; padding: 0.85rem 1rem; border: 1.5px solid var(--ap-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; background: #fdfdfd; }
.apply-skill-search:focus { outline: none; border-color: var(--ap-orange); background: #fff; box-shadow: 0 0 0 4px rgba(255, 85, 0, 0.08); }
.apply-skill-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff;
    border: 1px solid var(--ap-border); border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
    z-index: 40; max-height: 240px; overflow-y: auto; padding: 6px;
}
.apply-skill-dropdown.open { display: block; }
.apply-skill-option { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--ap-text); }
.apply-skill-option:hover, .apply-skill-option.active { background: #F0EBF7; color: var(--ap-blue); }
.apply-skill-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.apply-chip { display: inline-flex; align-items: center; gap: 8px; background: #F0EBF7; color: var(--ap-blue); padding: 7px 8px 7px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.apply-chip-x { border: none; background: rgba(61, 26, 138, 0.12); color: var(--ap-blue); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.apply-chip-x:hover { background: var(--ap-orange); color: #fff; }

/* ---- Radios ---- */
.apply-radios { display: flex; gap: 1rem; flex-wrap: wrap; }
.apply-radio { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem; border: 1.5px solid var(--ap-border); border-radius: 12px; cursor: pointer; font-weight: 700; color: var(--ap-text); background: #fdfdfd; }
.apply-radio input { accent-color: var(--ap-orange); }
.apply-radio:has(input:checked) { border-color: var(--ap-orange); background: #FFF6F0; color: var(--ap-blue); }

/* ---- Declarations ---- */
.apply-declarations { margin-top: 1.6rem; padding-top: 1.6rem; border-top: 1px solid var(--ap-border); display: flex; flex-direction: column; gap: 0.4rem; }
.apply-check { display: flex; align-items: flex-start; gap: 0.7rem; font-size: 0.9rem; color: var(--ap-text); font-weight: 600; cursor: pointer; margin-top: 0.6rem; }
.apply-check input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--ap-orange); flex-shrink: 0; }

/* ---- Review ---- */
.apply-review { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.apply-review-card { border: 1px solid var(--ap-border); border-radius: 14px; padding: 1.2rem 1.4rem; background: #fcfbff; }
.apply-review-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.apply-review-head h3 { margin: 0; font-size: 0.98rem; color: var(--ap-blue); }
.apply-review-edit { border: none; background: none; color: var(--ap-orange); font-weight: 700; cursor: pointer; font-size: 0.8rem; }
.apply-review-edit:hover { text-decoration: underline; }
.apply-review-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #eee; font-size: 0.85rem; }
.apply-review-row:last-child { border-bottom: none; }
.apply-review-row span:first-child { flex: 0 0 42%; color: #8b849f; font-weight: 700; }
.apply-review-row span:last-child { flex: 1; color: var(--ap-text); word-break: break-word; }
.apply-review-chip { display: inline-block; background: #F0EBF7; color: var(--ap-blue); padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; margin: 2px 2px 0 0; }

/* ---- Nav ---- */
.apply-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; flex-wrap: wrap; }
.apply-nav-right { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.apply-btn { border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 0.9rem; padding: 0.9rem 2rem; border-radius: 30px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; transition: 0.25s; }
.apply-btn-primary { background: var(--ap-orange); color: #fff; box-shadow: 0 10px 24px rgba(255, 85, 0, 0.25); }
.apply-btn-primary:hover { background: #e04a00; transform: translateY(-2px); }
.apply-btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.apply-btn-ghost { background: #f0f0f0; color: #555; }
.apply-btn-ghost:hover { background: #e2e2e2; }

/* ---- Success / not available ---- */
.apply-success { background: #fff; border: 1px solid var(--ap-border); border-radius: 20px; padding: 3.5rem 2.5rem; text-align: center; box-shadow: 0 12px 40px rgba(61, 26, 138, 0.06); max-width: 640px; margin: 0 auto; }
.apply-success-icon { width: 76px; height: 76px; border-radius: 50%; background: #e6f7eb; color: #10b981; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }
.apply-icon-warn { background: #FDECEC; color: #e02424; }
.apply-success h1 { font-size: 1.8rem; color: var(--ap-blue); font-weight: 800; margin: 0 0 0.7rem; }
.apply-success p { color: var(--ap-muted); font-size: 1rem; line-height: 1.6; margin: 0 auto 1.5rem; max-width: 460px; }
.apply-ref { display: inline-block; background: #F4F2FF; color: var(--ap-blue); font-size: 0.85rem; padding: 0.6rem 1.2rem; border-radius: 30px; margin-bottom: 1.5rem; }
.apply-success-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .apply-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .apply-review { grid-template-columns: 1fr; }
    .apply-step-label { display: none; }
}
@media (max-width: 820px) {
    .apply-summary { flex-wrap: wrap; }
    .apply-summary-meta { justify-content: flex-start; width: 100%; }
    .apply-summary-title { white-space: normal; }
}
@media (max-width: 640px) {
    .apply-wrap { padding: 5.5rem 6% 3rem; }
    .apply-summary { padding: 0.8rem 1rem; gap: 0.8rem; }
    .apply-summary-back { padding-right: 0.8rem; }
    .apply-card { padding: 1.5rem 1.4rem; border-radius: 16px; }
    .apply-grid-2, .apply-grid-3 { grid-template-columns: 1fr; }
    .apply-nav { flex-direction: column-reverse; align-items: stretch; }
    .apply-nav-right { flex-direction: column; align-items: stretch; }
    .apply-btn { width: 100%; }
    .apply-step-dot { width: 28px; height: 28px; font-size: 0.78rem; }
    .apply-step-item:not(:first-child)::before { top: 13px; }
}
