/* ==========================================================================
   Crescent Public School — Careers Portal theme
   Loaded after the legacy template CSS. All new components are prefixed "cp-".
   ========================================================================== */

:root {
    --cp-navy: #1b2f6b;
    --cp-navy-600: #233c86;
    --cp-navy-50: #eef2fb;
    --cp-red: #c8202f;
    --cp-red-50: #fdeced;
    --cp-green: #1f8a4c;
    --cp-green-50: #e8f6ee;
    --cp-amber: #b7791f;
    --cp-amber-50: #fdf4e3;
    --cp-ink: #1c2333;
    --cp-ink-2: #4a5468;
    --cp-ink-3: #7a8499;
    --cp-line: #e3e7ef;
    --cp-bg: #f5f7fb;
    --cp-card: #ffffff;
    --cp-radius: 14px;
    --cp-radius-sm: 9px;
    --cp-shadow: 0 1px 2px rgba(20, 33, 70, .06), 0 4px 16px rgba(20, 33, 70, .06);
    --cp-font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- Base ---------- */
body.cp-body {
    background: var(--cp-bg) !important;
    color: var(--cp-ink);
    font-family: var(--cp-font);
    font-size: 15px;
    line-height: 1.55 !important;
    padding: 0 !important;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}
.cp-body h1, .cp-body h2, .cp-body h3, .cp-body h4, .cp-body h5, .cp-body h6 {
    font-family: var(--cp-font);
    color: var(--cp-ink);
    font-weight: 700;
    letter-spacing: -.01em;
}
.cp-body a { color: var(--cp-navy-600); }
.cp-body a:hover { color: var(--cp-red); text-decoration: none; }
#load { display: none; }

/* ---------- Header ---------- */
.cp-header {
    background: #fff;
    border-bottom: 1px solid var(--cp-line);
    position: sticky;
    top: 0;
    z-index: 100;
}
.cp-header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.cp-brand { display: flex; align-items: center; gap: 12px; color: var(--cp-ink) !important; }
.cp-brand img { height: 44px; width: auto; }
.cp-brand-name { font-weight: 800; font-size: 16px; line-height: 1.15; display: block; color: var(--cp-navy); }
.cp-brand-sub { font-size: 12px; color: var(--cp-ink-3); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.cp-nav { display: flex; gap: 4px; margin-left: 8px; }
.cp-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--cp-ink-2) !important;
    font-weight: 600;
    font-size: 14px;
}
.cp-nav a:hover { background: var(--cp-navy-50); color: var(--cp-navy) !important; }
.cp-nav a.active { background: var(--cp-navy); color: #fff !important; }
.cp-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.cp-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--cp-navy-50); color: var(--cp-navy);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.cp-user-name { font-weight: 600; font-size: 14px; color: var(--cp-ink); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-logout {
    font-size: 13px; font-weight: 600; color: var(--cp-ink-2) !important;
    border: 1px solid var(--cp-line); padding: 6px 12px; border-radius: 999px;
}
.cp-logout:hover { border-color: var(--cp-red); color: var(--cp-red) !important; }
#load_spinner { width: 1rem; height: 1rem; border-width: .15em; color: var(--cp-navy); }

/* ---------- Page hero ---------- */
.cp-hero {
    background: linear-gradient(120deg, var(--cp-navy) 0%, var(--cp-navy-600) 70%, #2d4aa0 100%);
    color: #fff;
    padding: 34px 0 78px;
}
.cp-hero h1 { color: #fff !important; font-size: 28px; margin: 0 0 6px; }
.cp-hero p { color: rgba(255,255,255,.82); margin: 0; font-size: 15px; max-width: 640px; }
.cp-eyebrow {
    display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: rgba(255,255,255,.7); margin-bottom: 8px;
}

/* ---------- Layout ---------- */
.cp-container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.cp-main { margin-top: -50px; padding-bottom: 48px; }
.cp-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
    .cp-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
    .cp-grid-side { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
}

/* ---------- Cards ---------- */
.cp-card {
    background: var(--cp-card);
    border: 1px solid var(--cp-line);
    border-radius: var(--cp-radius);
    box-shadow: var(--cp-shadow);
    padding: 24px;
}
.cp-card + .cp-card { margin-top: 20px; }
.cp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cp-card-title { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 10px; }
.cp-card-sub { color: var(--cp-ink-3); font-size: 13.5px; margin: 4px 0 0; }
.cp-icon-badge {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--cp-navy-50); color: var(--cp-navy);
    display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
}
.cp-count {
    font-size: 12px; font-weight: 700; color: var(--cp-ink-2);
    background: var(--cp-bg); border: 1px solid var(--cp-line);
    padding: 1px 9px; border-radius: 999px;
}

/* ---------- Buttons ---------- */
.cp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--cp-font); font-weight: 700; font-size: 14.5px;
    padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
    cursor: pointer; transition: background .15s, box-shadow .15s, color .15s, border-color .15s;
    text-decoration: none !important; line-height: 1.2;
}
.cp-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(35, 60, 134, .25); }
.cp-btn-primary { background: var(--cp-navy); color: #fff !important; }
.cp-btn-primary:hover { background: var(--cp-navy-600); color: #fff !important; }
.cp-btn-accent { background: var(--cp-red); color: #fff !important; }
.cp-btn-accent:hover { background: #a91a27; color: #fff !important; }
.cp-btn-ghost { background: #fff; color: var(--cp-navy) !important; border-color: var(--cp-line); }
.cp-btn-ghost:hover { border-color: var(--cp-navy); color: var(--cp-navy) !important; }
.cp-btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.cp-btn-block { width: 100%; }
.cp-btn[disabled] { opacity: .65; cursor: not-allowed; }
.cp-icon-btn {
    border: 0; background: transparent; color: var(--cp-ink-3);
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.cp-icon-btn:hover { background: var(--cp-red-50); color: var(--cp-red) !important; }

/* ---------- Forms ---------- */
.cp-form-grid { display: grid; gap: 16px 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .cp-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cp-form-grid .cp-span-2 { grid-column: 1 / -1; }
.cp-field label {
    display: block; font-size: 13px; font-weight: 700; color: var(--cp-ink-2);
    margin-bottom: 6px;
}
.cp-field .cp-req { color: var(--cp-red); margin-left: 2px; }
.cp-field .cp-hint { font-size: 12.5px; color: var(--cp-ink-3); margin-top: 5px; }
.cp-body .cp-field .form-control,
.cp-body .cp-input {
    height: auto;
    min-height: 44px;
    padding: 10px 13px;
    font-size: 15px;
    font-family: var(--cp-font);
    color: var(--cp-ink);
    background: #fff;
    border: 1px solid #cfd6e3;
    border-radius: var(--cp-radius-sm);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.cp-body .cp-field .form-control:focus,
.cp-body .cp-input:focus {
    border-color: var(--cp-navy-600);
    box-shadow: 0 0 0 3px rgba(35, 60, 134, .15);
}
.cp-body .cp-field .form-control[readonly] { background: var(--cp-bg); color: var(--cp-ink-2); }
.cp-body .cp-field select.form-control { appearance: auto; }
.cp-body .parsley-errors-list { list-style: none; padding: 0; margin: 5px 0 0; font-size: 12.5px; color: var(--cp-red); }
.cp-body .form-control.parsley-error { border-color: var(--cp-red); }
.cp-form-section { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--cp-ink-3); margin: 8px 0 -4px; }
.cp-form-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--cp-line); }

/* ---------- Tables ---------- */
/* position:relative keeps absolutely-positioned children (e.g. .sr-only) inside the scroll box,
   otherwise they widen the page on phones */
.cp-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--cp-line); border-radius: var(--cp-radius-sm); }
.cp-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.cp-table th {
    text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--cp-ink-3); background: #f8f9fc; padding: 10px 12px !important; border-bottom: 1px solid var(--cp-line);
    white-space: nowrap;
}
.cp-table td { padding: 11px 12px !important; border-bottom: 1px solid var(--cp-line); color: var(--cp-ink); vertical-align: middle; }
.cp-table tr:last-child td { border-bottom: 0; }
.cp-table td.cp-col-action { width: 48px; text-align: right; }

/* Definition list (key / value) */
.cp-dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; }
@media (min-width: 640px) { .cp-dl { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } }
.cp-dl > div { padding: 11px 0; border-bottom: 1px dashed var(--cp-line); }
.cp-dl dt { font-size: 12px; font-weight: 700; color: var(--cp-ink-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.cp-dl dd { margin: 0; font-weight: 600; color: var(--cp-ink); word-break: break-word; }

/* ---------- Status & badges ---------- */
.cp-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
    background: var(--cp-navy-50); color: var(--cp-navy);
}
.cp-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.cp-badge-green { background: var(--cp-green-50); color: var(--cp-green); }
.cp-badge-amber { background: var(--cp-amber-50); color: var(--cp-amber); }
.cp-badge-red { background: var(--cp-red-50); color: var(--cp-red); }

/* ---------- Steps / checklist ---------- */
.cp-steps { list-style: none; padding: 0; margin: 0; counter-reset: cpstep; }
.cp-steps li { position: relative; padding: 0 0 18px 46px; }
.cp-steps li:last-child { padding-bottom: 0; }
.cp-steps li::before {
    counter-increment: cpstep; content: counter(cpstep);
    position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
    background: var(--cp-navy-50); color: var(--cp-navy); font-weight: 800; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.cp-steps li::after {
    content: ""; position: absolute; left: 14.5px; top: 34px; bottom: 4px; width: 1px; background: var(--cp-line);
}
.cp-steps li:last-child::after { display: none; }
.cp-steps strong { display: block; font-size: 14.5px; }
.cp-steps span { font-size: 13.5px; color: var(--cp-ink-3); }

.cp-checklist { list-style: none; padding: 0; margin: 0; }
.cp-checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--cp-line); font-size: 14.5px; }
.cp-checklist li:last-child { border-bottom: 0; }
.cp-checklist a { color: var(--cp-ink) !important; font-weight: 600; flex: 1; }
.cp-checklist a:hover { color: var(--cp-navy) !important; }
.cp-check {
    width: 24px; height: 24px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
    border: 2px solid var(--cp-line); color: transparent;
}
.cp-check.done { background: var(--cp-green); border-color: var(--cp-green); color: #fff; }
.cp-progress { height: 8px; background: var(--cp-bg); border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.cp-progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--cp-green), #36b56c); border-radius: 999px; }

.cp-notes { padding-left: 18px; margin: 0; color: var(--cp-ink-2); font-size: 14px; }
.cp-notes li { margin-bottom: 8px; }
.cp-notes li:last-child { margin-bottom: 0; }

.cp-callout {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--cp-navy-50); border: 1px solid #d6def3; color: var(--cp-ink-2);
    border-radius: var(--cp-radius-sm); padding: 13px 15px; font-size: 14px;
}
.cp-callout i { color: var(--cp-navy); margin-top: 3px; }
.cp-meta { font-size: 13px; color: var(--cp-ink-3); }

/* Empty state */
.cp-empty {
    text-align: center; padding: 22px 16px; border: 1px dashed #cfd6e3; border-radius: var(--cp-radius-sm);
    color: var(--cp-ink-3); font-size: 14px; background: #fbfcfe;
}

/* ---------- Application (detail) page ---------- */
.cp-sidenav { position: sticky; top: 84px; padding: 14px; }
.cp-sidenav a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 12px; border-radius: 8px; color: var(--cp-ink-2) !important; font-weight: 600; font-size: 14px;
}
.cp-sidenav a:hover { background: var(--cp-navy-50); color: var(--cp-navy) !important; }
.cp-sidenav .cp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cp-line); flex: none; }
.cp-sidenav .cp-dot.done { background: var(--cp-green); }
.cp-section { scroll-margin-top: 90px; }
.cp-add-panel {
    display: none; margin-top: 16px; padding: 18px; border-radius: var(--cp-radius-sm);
    background: #f8f9fc; border: 1px solid var(--cp-line);
}
.cp-add-panel.open { display: block; }
.cp-add-panel .cp-form-actions { margin-top: 16px; padding-top: 14px; }
@media (max-width: 991px) { .cp-sidenav-wrap { display: none; } }

/* ---------- Auth (login / OTP) ---------- */
.cp-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); background: #fff; }
@media (min-width: 992px) { .cp-auth { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.cp-auth-visual {
    position: relative; color: #fff; padding: 48px; display: none;
    background-size: cover; background-position: center;
}
.cp-auth-visual::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(160deg, rgba(27, 47, 107, .93) 0%, rgba(27, 47, 107, .80) 55%, rgba(200, 32, 47, .65) 100%);
}
.cp-auth-visual > * { position: relative; }
@media (min-width: 992px) { .cp-auth-visual { display: flex; flex-direction: column; justify-content: space-between; } }
.cp-auth-visual h2 { color: #fff !important; font-size: 36px; line-height: 1.15; margin: 0 0 14px; max-width: 460px; }
.cp-auth-visual p { color: rgba(255,255,255,.85); font-size: 16px; max-width: 440px; }
.cp-auth-points { list-style: none; padding: 0; margin: 26px 0 0; }
.cp-auth-points li { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; font-weight: 600; }
.cp-auth-points i {
    width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.15);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.cp-auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px 24px; }
.cp-auth-box { width: 100%; max-width: 410px; margin: 0 auto; }
.cp-auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.cp-auth-logo img { height: 56px; }
.cp-auth-box h1 { font-size: 26px; margin: 0 0 6px; }
.cp-auth-box .cp-lead { color: var(--cp-ink-3); margin: 0 0 26px; }
.cp-auth-box .cp-field { margin-bottom: 18px; }
.cp-auth-steps { display: flex; gap: 8px; margin-bottom: 22px; }
.cp-auth-steps span { flex: 1; height: 4px; border-radius: 999px; background: var(--cp-line); }
.cp-auth-steps span.on { background: var(--cp-navy); }
.cp-auth-foot { margin-top: 30px; font-size: 12.5px; color: var(--cp-ink-3); text-align: center; }
.cp-otp-input { letter-spacing: .5em; font-size: 20px !important; font-weight: 700; text-align: center; }
.cp-recaptcha { margin-bottom: 18px; min-height: 78px; }
@media (max-width: 360px) { .cp-recaptcha { transform: scale(.88); transform-origin: 0 0; } }

/* ---------- Footer ---------- */
.cp-footer { border-top: 1px solid var(--cp-line); background: #fff; padding: 18px 0; font-size: 13px; color: var(--cp-ink-3); }
.cp-footer .cp-container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.cp-footer a { color: var(--cp-ink-2) !important; }

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
    .cp-header-inner { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
    .cp-brand img { height: 38px; }
    .cp-brand-text, .cp-user-name { display: none; }
    .cp-nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
    .cp-container { padding: 0 16px; }
    .cp-hero { padding: 24px 0 70px; }
    .cp-hero h1 { font-size: 23px; }
    .cp-card { padding: 18px; }
    .cp-card-head { flex-wrap: wrap; }
    .cp-form-actions { flex-direction: column-reverse; align-items: stretch; }
    .cp-form-actions .cp-btn { width: 100%; }

    /* tables become stacked cards on phones */
    .cp-table-wrap { border: 0; overflow: visible; }
    .cp-table, .cp-table tbody, .cp-table tr, .cp-table td { display: block; width: 100%; }
    .cp-table thead { display: none; }
    .cp-table tr {
        position: relative; border: 1px solid var(--cp-line); border-radius: var(--cp-radius-sm);
        padding: 8px 44px 8px 0; margin-bottom: 10px; background: #fff;
    }
    .cp-table tr:last-child { margin-bottom: 0; }
    .cp-table td {
        display: flex; gap: 12px; border: 0 !important; padding: 5px 14px !important; font-size: 14px;
    }
    .cp-table td[data-label]::before {
        content: attr(data-label); flex: 0 0 42%; font-size: 11.5px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .04em; color: var(--cp-ink-3); padding-top: 2px;
    }
    .cp-table td.cp-col-action { position: absolute; top: 6px; right: 4px; width: auto; padding: 0 !important; }
}
/* prevent any stray element from making the whole page wider than the phone screen */
html, body.cp-body { max-width: 100%; overflow-x: clip; }
