/* ============================================================================
   Kyadondo Technical Institute — Public admission form
   Plain CSS. No framework, no CDN, no external requests.
   Fonts are served from the local copy already shipped with the project.
   ========================================================================== */

/* ── Fonts (local files — works fully offline) ───────────────────────────── */
@font-face {
    font-family: 'Roboto';
    src: url('../../../frontend/assets/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('../../../frontend/assets/Roboto-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('../../../frontend/assets/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
    --kti-primary:      #312f93;
    --kti-primary-dark: #1a1860;
    --kti-danger:       #c11b2e;
    --kti-required:     #ef4444;
    --kti-border:       #d1d5db;
    --kti-border-soft:  #e5e7eb;
    --kti-text:         #111827;
    --kti-label:        #374151;
    --kti-muted:        #6b7280;
    --kti-placeholder:  #9ca3af;
    --kti-page-bg:      #f3f4f6;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #fff;
}

body { overflow: hidden; }

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--kti-text);
    -webkit-text-size-adjust: 100%;
}

/* ── Page shell ──────────────────────────────────────────────────────────── */
.kti-page-wrap {
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    background: #fff;
    display: grid;
    grid-template-columns: minmax(320px, .78fr) minmax(0, 1.22fr);
    box-shadow: 0 0 24px rgba(0, 0, 0, .06);
}

/* ── Information panel ──────────────────────────────────────────────────── */
.kti-info-panel {
    height: 100vh;
    overflow: hidden;
    padding: 34px 30px 30px;
    color: var(--kti-text);
    background: #f7f8fc;
    border-right: 1px solid #e5e7eb;
}
.kti-info-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    margin-bottom: 25px;
    padding: 9px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
}
.kti-info-brand img { display: block; width: 100%; height: auto; }
.kti-info-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.kti-info-heading .kti-info-brand {
    flex: 0 0 74px;
    margin-bottom: 0;
}
.kti-info-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.kti-info-title strong {
    color: var(--kti-primary-dark);
    font-size: 16px;
    line-height: 1.2;
}
.kti-info-title span {
    color: var(--kti-muted);
    font-size: 11px;
    letter-spacing: .6px;
    text-transform: uppercase;
}
.kti-student-slideshow {
    position: relative;
    height: clamp(360px, 66vh, 640px);
    overflow: hidden;
    margin: 2px 0 24px;
    background: #e5e7eb;
    border-radius: 14px;
}
.kti-slide {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    transition: opacity .7s ease;
}
.kti-slide.is-active { opacity: 1; }
.kti-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.kti-slide::after {
    position: absolute;
    inset: 45% 0 0;
    content: "";
    background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}
.kti-slide figcaption {
    position: absolute;
    z-index: 1;
    right: 18px;
    bottom: 18px;
    left: 18px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}
.kti-slide-dots {
    position: absolute;
    z-index: 2;
    right: 16px;
    bottom: 10px;
    display: flex;
    gap: 5px;
}
.kti-slide-dots span {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,.55);
    border-radius: 50%;
}
.kti-slide-dots span.is-active { background: #fff; }
.kti-info-kicker {
    margin: 0 0 8px;
    color: var(--kti-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.kti-info-panel h1 {
    max-width: 330px;
    margin: 0;
    color: var(--kti-primary-dark);
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.12;
}
.kti-info-lead {
    max-width: 390px;
    margin: 14px 0 0;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.7;
}
.kti-info-stat {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 17px 0;
    margin: 25px 0 4px;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}
.kti-info-stat div { display: flex; flex-direction: column; }
.kti-info-stat strong { color: var(--kti-primary); font-size: 21px; }
.kti-info-stat span { color: #6b7280; font-size: 10px; }
.kti-info-section { margin-top: 22px; }
.kti-info-section h2 {
    padding-bottom: 7px;
    margin: 0 0 10px;
    color: var(--kti-primary);
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
    letter-spacing: .8px;
    text-transform: uppercase;
}
.kti-info-list {
    padding: 0 0 0 17px;
    margin: 0;
    color: #4b5563;
    font-size: 12px;
}
.kti-info-list li { margin: 7px 0; padding-left: 3px; }
.kti-requirement { display: grid; grid-template-columns: 74px 1fr; gap: 8px; margin: 9px 0; color: #4b5563; font-size: 11px; line-height: 1.45; }
.kti-requirement strong { color: var(--kti-primary); font-size: 11px; }
.kti-info-note { margin: 12px 0 0; color: #6b7280; font-size: 11px; line-height: 1.5; }
.kti-steps > div { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0; color: #4b5563; font-size: 11px; line-height: 1.4; }
.kti-steps b { display: grid; width: 22px; height: 22px; flex: 0 0 22px; place-items: center; color: #fff; background: var(--kti-primary); border-radius: 50%; font-size: 11px; }
.kti-steps span { display: flex; flex-direction: column; }
.kti-steps strong { color: var(--kti-primary-dark); font-size: 11px; }
.kti-info-contact { display: flex; flex-direction: column; gap: 3px; padding-top: 17px; margin-top: 23px; color: #6b7280; border-top: 1px solid #e5e7eb; font-size: 10px; }
.kti-info-contact strong { color: var(--kti-primary-dark); font-size: 12px; }

/* ── Form panel ──────────────────────────────────────────────────────────── */
.kti-form-panel {
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    background: #fff;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.kti-header {
    background: linear-gradient(90deg, var(--kti-primary) 0%, var(--kti-primary-dark) 100%);
    padding: 18px 20px 14px;
    text-align: center;
    color: #fff;
}
.kti-header h2 { font-size: 18px; font-weight: 700; margin: 0 0 4px; color: #fff; }
.kti-header-kicker { font-size: 10px !important; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.kti-header p  { font-size: 11px; margin: 2px 0; color: rgba(255, 255, 255, .8); }

/* ── Form body ───────────────────────────────────────────────────────────── */
.kti-form  { display: flex; flex-direction: column; flex: 1; }
.kti-body  { flex: 1; padding: 4px 0 16px; }

/* ── Fieldsets ───────────────────────────────────────────────────────────── */
.kti-fieldset {
    border: 0;
    margin: 14px 12px 0;
    padding: 0;
}
.kti-fieldset > legend {
    display: block;
    width: 100%;
    padding: 0 0 6px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--kti-primary);
    border-bottom: 1px solid var(--kti-border-soft);
}
.kti-hint {
    margin: -4px 0 12px;
    font-size: 12px;
    color: var(--kti-muted);
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.kti-field { display: flex; flex-direction: column; margin-bottom: 14px; }

.kti-field > label {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--kti-label);
}
.kti-field.is-required > label::after {
    content: ' *';
    color: var(--kti-required);
}
.kti-field .kti-optional {
    font-weight: 400;
    color: var(--kti-placeholder);
}

.kti-field input,
.kti-field select {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--kti-text);
    background: #fff;
    border: 1px solid var(--kti-border);
    border-radius: 6px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.kti-field select { padding-right: 6px; }
.kti-field input::placeholder { color: var(--kti-placeholder); }

.kti-field input:focus,
.kti-field select:focus {
    outline: none;
    border-color: var(--kti-primary);
    box-shadow: 0 0 0 3px rgba(49, 47, 147, .12);
}
.kti-field input:disabled,
.kti-field select:disabled { background: #f9fafb; color: var(--kti-muted); }

/* Only flag invalid fields once the browser has attempted validation */
.kti-form.was-validated .kti-field input:invalid,
.kti-form.was-validated .kti-field select:invalid {
    border-color: var(--kti-required);
}

.kti-help {
    margin: 5px 0 0;
    font-size: 11px;
    color: var(--kti-muted);
}

/* ── Admission fee banner ────────────────────────────────────────────────── */
.kti-fee-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    margin: 4px 0 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}
.kti-fee-lbl { font-size: 13px; font-weight: 500; color: #1e40af; }
.kti-fee-amt { font-size: 17px; font-weight: 700; color: var(--kti-danger); }

/* ── Status box ──────────────────────────────────────────────────────────── */
.kti-status {
    margin: 8px 12px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    border-radius: 8px;
}
.kti-status[hidden] { display: none; }
.kti-s-pending { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.kti-s-ok      { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.kti-s-fail    { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.kti-s-wait    { background: #fefce8; border: 1px solid #fde047; color: #713f12; }

/* ── Submit bar ──────────────────────────────────────────────────────────── */
.kti-submit-bar {
    position: sticky;
    bottom: 0;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid var(--kti-border-soft);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
}
.kti-btn {
    display: block;
    width: 100%;
    padding: 13px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    background: var(--kti-primary);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .15s ease;
}
.kti-btn:hover:not(:disabled)  { background: #272573; }
.kti-btn:focus-visible         { outline: 3px solid rgba(49, 47, 147, .35); outline-offset: 2px; }
.kti-btn:disabled              { opacity: .65; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
@keyframes kti-spin { to { transform: rotate(360deg); } }
.kti-spin {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 7px;
    vertical-align: middle;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: kti-spin .7s linear infinite;
}

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.kti-toasts {
    position: fixed;
    top: 12px;
    right: 12px;
    left: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.kti-toast {
    max-width: 320px;
    padding: 11px 15px;
    font-size: 13px;
    color: #fff;
    background: #166534;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .25s ease, transform .25s ease;
}
.kti-toast.is-error { background: var(--kti-required); }
.kti-toast.is-shown { opacity: 1; transform: translateY(0); }

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .kti-info-panel { padding: 25px 18px; }
    .kti-fieldset { margin: 12px 10px 0; }
    .kti-status   { margin: 8px 10px; }
}

@media (max-width: 900px) {
    body { overflow: auto; }
    .kti-page-wrap { display: block; height: auto; }
    .kti-info-panel { display: none; }
    .kti-form-panel { height: auto; overflow: visible; }
}
