/* =========================================================
   EXACTSUB EXAM PIN V1
   Compact fintech purchase UI
   Backend contract preserved: checkpin GET, processresult POST
   ========================================================= */

:root {
    --exam-primary: #022A7B;
    --exam-primary-dark: #011E59;
    --exam-green: #29BA22;
    --exam-bg: #f5f7fb;
    --exam-card: #ffffff;
    --exam-text: #14213d;
    --exam-muted: #64748b;
    --exam-border: #e3e8f0;
    --exam-danger: #dc3545;
    --exam-warning: #b86b00;
    --exam-radius: 16px;
    --exam-shadow: 0 5px 20px rgba(15,23,42,.055);
}

.exam-page,
.exam-page *,
.exam-page *::before,
.exam-page *::after {
    box-sizing: border-box;
}

.exam-page {
    width: 100%;
    min-height: 100%;
    padding: 18px 14px 34px;
    background: var(--exam-bg);
    color: var(--exam-text);
    overflow-x: hidden;
}

.exam-shell {
    width: min(100%, 760px);
    margin: 0 auto;
}

.exam-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}

.exam-header-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

.exam-header-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eaf0ff;
    color: var(--exam-primary);
    font-size: 17px;
}

.exam-header-copy {
    min-width: 0;
}

.exam-eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--exam-primary);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .9px;
}

.exam-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: -.35px;
    font-weight: 800;
}

.exam-header-copy p {
    margin: 3px 0 0;
    color: var(--exam-muted);
    font-size: 10px;
    line-height: 1.35;
}

.exam-balance {
    flex: 0 0 auto;
    display: grid;
    gap: 2px;
    min-width: 110px;
    padding: 8px 10px;
    border: 1px solid #dce9dc;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--exam-shadow);
    text-align: right;
}

.exam-balance span {
    color: var(--exam-muted);
    font-size: 8px;
    font-weight: 600;
}

.exam-balance strong {
    color: var(--exam-primary);
    font-size: 12px;
    font-weight: 800;
}

.exam-card {
    background: var(--exam-card);
    border: 1px solid var(--exam-border);
    border-radius: var(--exam-radius);
    box-shadow: var(--exam-shadow);
    overflow: hidden;
}

.exam-section {
    padding: 17px 18px;
}

.exam-section + .exam-section {
    border-top: 1px solid #edf0f5;
}

.section-heading {
    display: flex;
    align-items: center;
    margin-bottom: 11px;
}

.section-heading > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.section-step {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eaf0ff;
    color: var(--exam-primary);
    font-size: 11px;
    font-weight: 800;
}

.section-heading h2 {
    margin: 0;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 800;
}

.section-heading p {
    margin: 2px 0 0;
    color: var(--exam-muted);
    font-size: 9px;
    line-height: 1.4;
}

.exam-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.exam-type-card {
    position: relative;
    min-width: 0;
    min-height: 67px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 11px;
    border: 1px solid var(--exam-border);
    border-radius: 13px;
    background: #fff;
    color: var(--exam-text);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.exam-type-card:hover {
    border-color: #aebdde;
    transform: translateY(-1px);
}

.exam-type-card.selected {
    border-color: var(--exam-primary);
    background: #f2f6ff;
    box-shadow: 0 0 0 2px rgba(2,42,123,.07);
}

.exam-type-icon {
    width: 35px;
    height: 35px;
    flex: 0 0 35px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eaf0ff;
    color: var(--exam-primary);
    font-size: 13px;
}

.exam-type-card.selected .exam-type-icon {
    background: var(--exam-primary);
    color: #fff;
}

.exam-type-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.exam-type-copy strong {
    font-size: 11px;
    line-height: 1.25;
}

.exam-type-copy small {
    color: var(--exam-muted);
    font-size: 8px;
    line-height: 1.3;
}

.exam-type-check {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--exam-primary);
    color: #fff;
    font-size: 7px;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .16s ease, transform .16s ease;
}

.exam-type-card.selected .exam-type-check {
    opacity: 1;
    transform: scale(1);
}

.quantity-control {
    width: min(100%, 310px);
    min-height: 58px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    border: 1px solid var(--exam-border);
    border-radius: 14px;
    background: #fafbfc;
    overflow: hidden;
}

.quantity-button {
    width: 48px;
    height: 58px;
    border: 0;
    background: transparent;
    color: var(--exam-primary);
    font: inherit;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
}

.quantity-button:hover {
    background: #edf2ff;
}

.quantity-value-wrap {
    display: grid;
    justify-items: center;
    gap: 1px;
}

.quantity-value-wrap span {
    color: var(--exam-muted);
    font-size: 8px;
    font-weight: 600;
}

.quantity-value-wrap strong {
    color: var(--exam-text);
    font-size: 17px;
    font-weight: 800;
}

.exam-form-fields form {
    margin: 0;
}

.exam-form-fields .form-group {
    margin-bottom: 10px;
}

.exam-form-fields label {
    display: block;
    margin-bottom: 5px;
    color: var(--exam-text);
    font-size: 10px;
    font-weight: 700;
}

.exam-form-fields .form-control,
.exam-form-fields input,
.exam-form-fields select {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid #d5dce7;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--exam-text);
    font: inherit;
    font-size: 11px;
    box-shadow: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.exam-form-fields .form-control:focus,
.exam-form-fields input:focus,
.exam-form-fields select:focus {
    border-color: #7f9bdd;
    box-shadow: 0 0 0 3px rgba(2,42,123,.07);
}

.exam-form-fields .help-block,
.exam-form-fields .form-text,
.exam-form-fields small {
    display: block;
    margin-top: 4px;
    color: var(--exam-muted);
    font-size: 8px;
    line-height: 1.4;
}

.exam-form-fields .invalid-feedback,
.exam-form-fields .text-danger {
    font-size: 9px;
}

/* Crispy renders all fields. Exam type and quantity are represented by our custom controls. */
.exam-hidden-field,
#div_id_exam_type,
#div_id_quantity {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.exam-buy-button,
.exam-primary-button,
.exam-secondary-button {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 11px;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, opacity .16s ease, transform .16s ease;
}

.exam-buy-button,
.exam-primary-button {
    border: 1px solid var(--exam-primary);
    background: var(--exam-primary);
    color: #fff;
}

.exam-buy-button:hover:not(:disabled),
.exam-primary-button:hover:not(:disabled) {
    background: var(--exam-primary-dark);
    border-color: var(--exam-primary-dark);
    transform: translateY(-1px);
}

.exam-secondary-button {
    border: 1px solid #d0d5dd;
    background: #fff;
    color: var(--exam-text);
}

.exam-buy-button:disabled,
.exam-primary-button:disabled,
.exam-secondary-button:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: examSpin .75s linear infinite;
}

.loading .btn-spinner {
    display: inline-block;
}

.exam-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(7,17,38,.58);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.exam-modal-backdrop[aria-hidden="false"] {
    display: flex;
}

.exam-modal {
    position: relative;
    width: min(100%, 410px);
    max-height: calc(100svh - 24px);
    padding: 18px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0,0,0,.24);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.exam-modal-close {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f2f4f7;
    color: #667085;
    cursor: pointer;
}

.exam-modal-icon,
.exam-pin-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin: 0 auto 9px;
    border-radius: 12px;
    background: #eaf0ff;
    color: var(--exam-primary);
    font-size: 17px;
}

.exam-pin-icon {
    background: #eef9ee;
    color: #198a20;
}

.exam-modal h2 {
    margin: 0;
    color: var(--exam-text);
    text-align: center;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
}

.exam-modal-subtitle {
    margin: 5px 0 12px;
    color: var(--exam-muted);
    text-align: center;
    font-size: 9px;
    line-height: 1.45;
}

.exam-confirm-rows {
    border-top: 1px solid #eef0f3;
}

.exam-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eef0f3;
}

.exam-confirm-row span {
    color: var(--exam-muted);
    font-size: 9px;
}

.exam-confirm-row strong {
    max-width: 62%;
    color: var(--exam-text);
    text-align: right;
    font-size: 9px;
    overflow-wrap: anywhere;
}

.exam-confirm-row.exam-confirm-total {
    padding-top: 11px;
    border-bottom: 0;
}

.exam-confirm-total span {
    color: var(--exam-text);
    font-weight: 800;
}

.exam-confirm-total strong {
    color: var(--exam-primary);
    font-size: 14px;
}

.exam-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 8px;
    margin-top: 12px;
}

.exam-modal-actions .exam-primary-button,
.exam-modal-actions .exam-secondary-button {
    min-height: 44px;
}

.exam-pin-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    margin-bottom: 13px;
    border-radius: 10px;
    background: #f7f9fc;
}

.exam-pin-summary span {
    color: var(--exam-muted);
    font-size: 9px;
}

.exam-pin-summary strong {
    max-width: 68%;
    color: var(--exam-primary);
    text-align: right;
    font-size: 9px;
    overflow-wrap: anywhere;
}

.exam-pin-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--exam-text);
    font-size: 9px;
    font-weight: 700;
}

.exam-pin-field input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--exam-border);
    border-radius: 11px;
    outline: none;
    padding: 0 12px;
    color: var(--exam-text);
    background: #fff;
    font: inherit;
    font-size: 14px;
    letter-spacing: .24em;
    text-align: center;
}

.exam-pin-field input:focus {
    border-color: #7f9bdd;
    box-shadow: 0 0 0 3px rgba(2,42,123,.07);
}

.exam-pin-error {
    min-height: 17px;
    margin: 6px 0 0;
    color: var(--exam-danger);
    text-align: center;
    font-size: 9px;
    line-height: 1.35;
}

.exam-pin-submit {
    margin-top: 4px;
}

.exam-result-modal {
    text-align: center;
}

.exam-result-icon {
    width: 55px;
    height: 55px;
    display: grid;
    place-items: center;
    margin: 2px auto 12px;
    border-radius: 50%;
    font-size: 22px;
}

.exam-result-icon.success { background: #e7f8e9; color: #198a20; }
.exam-result-icon.pending { background: #fff4e5; color: var(--exam-warning); }
.exam-result-icon.error { background: #feeceb; color: var(--exam-danger); }

.exam-result-modal p {
    margin: 7px auto 14px;
    max-width: 350px;
    color: var(--exam-muted);
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

body.exam-modal-open {
    overflow: hidden;
}

@keyframes examSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .exam-page {
        padding: 14px 10px 24px;
    }

    .exam-header {
        gap: 8px;
    }

    .exam-header-main {
        gap: 8px;
    }

    .exam-header-icon {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        border-radius: 10px;
        font-size: 14px;
    }

    .exam-header h1 {
        font-size: 18px;
    }

    .exam-header-copy p {
        font-size: 8px;
    }

    .exam-balance {
        min-width: 92px;
        padding: 6px 8px;
        border-radius: 10px;
    }

    .exam-balance span {
        font-size: 7px;
    }

    .exam-balance strong {
        font-size: 10px;
    }

    .exam-card {
        border-radius: 14px;
    }

    .exam-section {
        padding: 14px;
    }

    .section-heading {
        margin-bottom: 9px;
    }

    .section-heading h2 {
        font-size: 12px;
    }

    .section-heading p {
        font-size: 8px;
    }

    .section-step {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
        font-size: 9px;
    }

    .exam-type-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .exam-type-card {
        min-height: 60px;
        padding: 8px;
        border-radius: 11px;
        gap: 7px;
    }

    .exam-type-icon {
        width: 31px;
        height: 31px;
        flex-basis: 31px;
        border-radius: 9px;
        font-size: 11px;
    }

    .exam-type-copy strong {
        font-size: 10px;
    }

    .exam-type-copy small {
        font-size: 7px;
    }

    .exam-type-check {
        top: 5px;
        right: 5px;
        width: 15px;
        height: 15px;
        font-size: 6px;
    }

    .quantity-control {
        min-height: 52px;
        grid-template-columns: 44px 1fr 44px;
    }

    .quantity-button {
        width: 44px;
        height: 52px;
    }

    .quantity-value-wrap strong {
        font-size: 15px;
    }

    .exam-buy-button,
    .exam-primary-button,
    .exam-secondary-button {
        min-height: 44px;
        font-size: 10px;
    }

    .exam-modal-backdrop {
        padding: 10px;
    }

    .exam-modal {
        width: 100%;
        max-height: calc(100svh - 20px);
        padding: 16px;
        border-radius: 16px;
    }

    .exam-modal-actions {
        grid-template-columns: 1fr 1.25fr;
    }
}

@media (max-width: 360px) {
    .exam-header-copy p {
        display: none;
    }

    .exam-balance {
        min-width: 82px;
    }

    .exam-type-copy small {
        display: none;
    }

    .exam-modal-actions {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   TRANSACTION RESPONSE MODAL
========================================================= */

.transaction-response-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}

.transaction-response-modal.is-visible {
    display: flex;
}

.transaction-response-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 17, 38, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.transaction-response-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 420px);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 28px 24px 24px;
    border: 1px solid #e5eaf3;
    border-radius: 22px;
    background: #ffffff;
    color: #101828;
    text-align: center;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
    animation: transactionResponseEnter 0.22s ease-out;
}

.transaction-response-modal__icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #fff4e5;
    color: #b54708;
    font-size: 32px;
    font-weight: 800;
    box-shadow: 0 0 0 7px #fffaf2;
}

.transaction-response-modal__dialog h2 {
    margin: 0 0 10px;
    color: #022A7B;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.35;
}

.transaction-response-modal__dialog p {
    margin: 0;
    color: #667085;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.transaction-response-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.transaction-response-modal__button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.transaction-response-modal__button:hover {
    transform: translateY(-1px);
}

.transaction-response-modal__button--primary {
    background: #022A7B;
    color: #ffffff;
}

.transaction-response-modal__button--primary:hover {
    background: #011f5d;
}

.transaction-response-modal__button--secondary {
    border-color: #d0d5dd;
    background: #ffffff;
    color: #344054;
}

.transaction-response-modal__button--secondary:hover {
    background: #f8fafc;
}

.transaction-response-modal__button--close {
    border-color: #e4e7ec;
    background: #f2f4f7;
    color: #344054;
}

.transaction-response-modal__button--close:hover {
    background: #e4e7ec;
}

.transaction-response-modal__button[hidden] {
    display: none !important;
}

body.transaction-response-modal-open {
    overflow: hidden;
}

@keyframes transactionResponseEnter {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .transaction-response-modal {
        padding: 14px;
    }

    .transaction-response-modal__dialog {
        padding: 24px 18px 20px;
        border-radius: 18px;
        max-height: calc(100vh - 28px);
    }

    .transaction-response-modal__dialog h2 {
        font-size: 1.12rem;
    }

    .transaction-response-modal__dialog p {
        font-size: 0.84rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .transaction-response-modal__dialog {
        animation: none;
    }

    .transaction-response-modal__button {
        transition: none;
    }
}

