/* ==========================================================================
   Online Admission Application form
   Extracted from resources/views/admissions/online-form.blade.php
   ==========================================================================

   THEME COLOURS
   -------------
   Every colour here comes from the custom properties injected by
   resources/views/partials/theme-color.blade.php, so the form picks up the
   branch's own palette.

   That partial was NOT included on this page before. Every var(--primary-color)
   in the old inline <style> therefore resolved to nothing — an invalid value,
   which CSS drops — so section headings, active tab pills and focus rings all
   fell back to inherited/browser defaults, and the page rendered in the
   platform's colours no matter which university it belonged to. The
   workaround was a hardcoded rgba(19, 0, 106, …) sprinkled through the file,
   which is the default purple written out by hand and does not follow a
   rebranded branch at all.

   Both are fixed: the partial is now included by the view, and the literals
   below use rgba(var(--primary-color-rgb), …).

   Available (see theme-color.blade.php):
     --primary-color / --primary-color-rgb   --third-color / --third-color-rgb
     --dark-primary-color   --secondary-color   --primary-light
     --student-success   --student-warning   --student-danger
     --font-family-primary
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
body {
    font-family: var(--font-family-primary, 'Inter', sans-serif);
    background-color: #f8f9fa;
}

.application-form-header {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.application-form-header .header-logo {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
}

.application-form-header h1,
.application-form-header h2,
.application-form-header h3 {
    color: var(--primary-color, #2E1C7B);
}

.application-form-header h2 {
    font-size: 28px;
    font-weight: 700;
}

/* A required marker that reads to screen readers as well as sighted users is
   handled in the markup; this is the visual asterisk only. */
.required-field::after {
    content: " *";
    color: var(--student-danger, #8B0000);
}

/* --------------------------------------------------------------------------
   Field guidance
   --------------------------------------------------------------------------
   Bootstrap's .form-text is the help slot every x-form.* component renders
   into. Raw <label>/<input> blocks in this form now use it too, so guidance
   looks identical whether or not a field went through a component. */
.form-text {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #5f6b7a;
}

.form-text .fa-circle-info,
.form-text .fa-info-circle {
    color: var(--primary-color, #2E1C7B);
    opacity: 0.75;
    margin-right: 0.35rem;
}

/* --------------------------------------------------------------------------
   Step navigation (left pills)
   -------------------------------------------------------------------------- */
.nav-pills-custom {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 1rem;
    position: sticky;
    top: 20px;
}

.nav-pills-custom .nav-link {
    color: #495057;
    padding: 12px 16px;
    margin-bottom: 5px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-pills-custom .nav-link:hover {
    background-color: rgba(var(--primary-color-rgb, 46, 28, 123), 0.04);
    color: var(--primary-color, #2E1C7B);
    border-left-color: var(--third-color, #2E1C7B);
}

.nav-pills-custom .nav-link.active {
    background: rgba(var(--primary-color-rgb, 46, 28, 123), 0.06);
    color: var(--primary-color, #2E1C7B) !important;
    border-left: 3px solid var(--primary-color, #2E1C7B);
}

.nav-pills-custom .nav-link .nav-icon {
    width: 24px;
    text-align: center;
}

.nav-pills-custom .nav-link .nav-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: rgba(var(--primary-color-rgb, 46, 28, 123), 0.08);
    color: var(--primary-color, #2E1C7B);
    font-size: 12px;
    font-weight: 600;
}

.nav-pills-custom .nav-link.active .nav-number {
    background: var(--primary-color, #2E1C7B);
    color: #fff;
}

.nav-pills-custom .nav-link.completed {
    color: var(--student-success, #10b981);
}

.nav-pills-custom .nav-link.completed .nav-number {
    background: rgba(var(--student-success-rgb, 16, 185, 129), 0.15);
    color: var(--student-success, #10b981);
}

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */
.tab-content-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.tab-pane {
    animation: admissionFadeIn 0.3s ease;
}

@keyframes admissionFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.section-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.section-header h4 {
    color: var(--primary-color, #2E1C7B);
    font-weight: 600;
    margin: 0;
}

.section-header p {
    color: #6c757d;
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

/* A short "what this step is for" note under each section heading. */
.section-guidance {
    background: rgba(var(--primary-color-rgb, 46, 28, 123), 0.04);
    border-left: 3px solid var(--primary-color, #2E1C7B);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #495057;
}

.section-guidance i {
    color: var(--primary-color, #2E1C7B);
    margin-right: 0.4rem;
}

/* --------------------------------------------------------------------------
   Step buttons
   --------------------------------------------------------------------------
   Previous display problems, all fixed here:

     - The row was `justify-content: space-between` with no wrapping, so on a
       narrow screen "Next: Previous Education" and "Previous" were squeezed
       onto one line until the labels wrapped mid-word.
     - The first step had an empty <div></div> purely to push its single
       button right. Replaced by `margin-left: auto` on the lone button.
     - The submit button carried .btn-nav AND .btn-lg, whose paddings fought;
       it rendered a different height from every other button in the flow.
     - Long labels + an inline icon had no minimum tap target on mobile. */
.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

/* When a step has only a "next" button, push it to the right without needing
   a filler element in the markup. */
.tab-navigation > .btn-nav:only-child {
    margin-left: auto;
}

.btn-nav {
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;          /* comfortable tap target */
    white-space: nowrap;
}

/* .btn-nav owns the sizing; neutralise .btn-lg so the submit button lines up
   with the Previous button beside it. */
.btn-nav.btn-lg {
    padding: 10px 28px;
    font-size: 1rem;
}

.btn-nav:disabled,
.btn-nav.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Theme-coloured buttons
   -------------------------------------------------------------------------- */
.btn-primary {
    background-color: var(--primary-color, #2E1C7B);
    border-color: var(--primary-color, #2E1C7B);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--third-color, #2E1C7B);
    border-color: var(--third-color, #2E1C7B);
}

.btn-primary:focus-visible,
.btn-outline-primary:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb, 46, 28, 123), 0.35);
}

.btn-outline-primary {
    color: var(--primary-color, #2E1C7B);
    border-color: var(--primary-color, #2E1C7B);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color, #2E1C7B);
    border-color: var(--primary-color, #2E1C7B);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Portal banner
   --------------------------------------------------------------------------
   This sits on a white .card. It previously used .btn-light and
   .btn-outline-light — near-white on white — so both links were effectively
   invisible until hovered. Given a tinted panel and theme-coloured buttons. */
.portal-banner {
    background: rgba(var(--primary-color-rgb, 46, 28, 123), 0.05);
    border: 1px solid rgba(var(--primary-color-rgb, 46, 28, 123), 0.15);
    border-radius: 12px;
}

.portal-banner h5 {
    color: var(--primary-color, #2E1C7B);
}

.portal-banner .btn {
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */
.progress-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.progress-wrapper .progress {
    height: 8px;
    border-radius: 4px;
}

.progress-wrapper .progress-bar {
    background-color: var(--student-success, #10b981);
    transition: width 0.3s ease;
}

.progress-wrapper .badge {
    background-color: var(--primary-color, #2E1C7B) !important;
}

.progress-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Inputs
   -------------------------------------------------------------------------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color, #2E1C7B);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb, 46, 28, 123), 0.2);
}

.phone-code-select {
    max-width: 110px;
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Conditional blocks
   -------------------------------------------------------------------------- */
.transfer-notice {
    display: none;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    background: rgba(var(--student-warning-rgb, 245, 158, 11), 0.12);
    border: 1px solid var(--student-warning, #f59e0b);
}

.transfer-notice.show {
    display: block;
}

.enrollment-type-details {
    display: none;
    margin-top: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.enrollment-type-details.show {
    display: block;
}

.enrollment-type-details .section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color, #2E1C7B);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
}

.enrollment-type-details .section-title i {
    margin-right: 8px;
}

/* --------------------------------------------------------------------------
   Documents checklist
   -------------------------------------------------------------------------- */
.document-checklist .form-check {
    padding: 0.5rem 0.5rem 0.5rem 2rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.document-checklist .form-check:hover {
    background-color: rgba(var(--primary-color-rgb, 46, 28, 123), 0.04);
}

.form-check-input:checked {
    background-color: var(--primary-color, #2E1C7B);
    border-color: var(--primary-color, #2E1C7B);
}

.form-check-input:focus {
    border-color: var(--primary-color, #2E1C7B);
    box-shadow: 0 0 0 0.25rem rgba(var(--primary-color-rgb, 46, 28, 123), 0.2);
}

.declaration-check .form-check-input {
    width: 20px;
    height: 20px;
}

.declaration-check .form-check-label {
    line-height: 1.8;
}

/* --------------------------------------------------------------------------
   Flatpickr
   -------------------------------------------------------------------------- */
.flatpickr-calendar {
    font-family: var(--font-family-primary, 'Inter', sans-serif) !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #e2e8f0 !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.selected:hover {
    background: var(--primary-color, #2E1C7B) !important;
    border-color: var(--primary-color, #2E1C7B) !important;
    color: #fff !important;
}

.flatpickr-day.today {
    border-color: var(--third-color, #2E1C7B) !important;
}

.flatpickr-day.today:hover {
    background: var(--third-color, #2E1C7B) !important;
    border-color: var(--third-color, #2E1C7B) !important;
    color: #fff !important;
}

.flatpickr-day:hover {
    background: rgba(var(--primary-color-rgb, 46, 28, 123), 0.08) !important;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
span.flatpickr-weekday {
    color: var(--primary-color, #2E1C7B) !important;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .nav-pills-custom {
        position: relative;
        top: 0;
        margin-bottom: 1rem;
    }

    .nav-pills-custom .nav-link {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .nav-pills-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-pills-custom {
        flex-direction: row !important;
        flex-wrap: nowrap;
        min-width: max-content;
    }

    .nav-pills-custom .nav-link {
        white-space: nowrap;
    }

    .tab-content-wrapper {
        padding: 1.25rem;
    }

    /* Full-width stacked buttons rather than two cramped ones side by side.
       Order is reversed so the primary action sits on top under the thumb. */
    .tab-navigation {
        flex-direction: column-reverse;
    }

    .tab-navigation > .btn-nav,
    .tab-navigation > .btn-nav:only-child {
        width: 100%;
        margin-left: 0;
    }

    .application-form-header {
        gap: 0.75rem;
    }

    .application-form-header .header-logo {
        max-width: 120px;
    }
}

/* The header repeats the branch logo on both sides purely for symmetry; one is
   plenty on a phone. */
@media (max-width: 575.98px) {
    .application-form-header .header-logo + .content-middle ~ .header-logo,
    .application-form-header .header-logo:last-of-type {
        display: none;
    }
}
