@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=DM+Serif+Display&display=swap");

:root {
    --portal-primary: #0b5da8;
    --portal-primary-dark: #073d73;
    --portal-accent: #ffbb2f;
    --portal-success: #1f9a6b;
    --portal-bg-1: #ebf5ff;
    --portal-bg-2: #f6fbff;
    --portal-ink: #132238;
    --portal-muted: #5f6f88;
    --portal-card: rgba(255, 255, 255, 0.92);
}

* {
    box-sizing: border-box;
}

/* Fallback utility to ensure hide/show works even if Bootstrap CSS fails to load. */
.d-none {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--portal-ink);
    font-family: "Nunito", sans-serif;
    background:
        radial-gradient(55rem 40rem at -10% -20%, rgba(11, 93, 168, 0.22), transparent 60%),
        radial-gradient(30rem 30rem at 110% -10%, rgba(255, 187, 47, 0.2), transparent 68%),
        linear-gradient(160deg, var(--portal-bg-1), var(--portal-bg-2));
}

h1,
h2,
h3,
.brand-text strong {
    font-family: "DM Serif Display", serif;
}

.portal-header {
    border-bottom: 1px solid rgba(7, 61, 115, 0.1);
    backdrop-filter: blur(8px);
    background: rgba(7, 61, 115, 0.8);
}

.portal-nav {
    background: transparent;
}

.portal-lang-switch .btn {
    white-space: nowrap;
}

.portal-lang-switch .btn.active {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    box-shadow: 0 8px 28px rgba(8, 48, 90, 0.3);
}

.brand-text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
    color: #f8fbff;
}

.brand-text small {
    font-family: "Nunito", sans-serif;
    font-size: 0.72rem;
    color: #c4d8f2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.portal-main {
    max-width: 1120px;
}

.portal-app-shell {
    animation: shellFadeIn 0.45s ease;
}

.portal-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(7, 61, 115, 0.95), rgba(11, 93, 168, 0.9));
    color: #f5fbff;
    transition: transform 0.3s ease;
}

.portal-hero:hover {
    transform: translateY(-2px);
}

.portal-hero.hero-compact {
    opacity: 0.96;
}

.portal-hero .lead {
    color: #d4e8ff;
}

.open-applications-panel {
    position: relative;
    max-width: 33rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

.open-applications-kicker {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
}

.open-applications-meta {
    margin-top: 0.15rem;
    font-size: 0.86rem;
    color: #cfe6ff;
}

.open-applications-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.8rem;
}

.open-application-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 0.8rem;
    padding: 0.7rem 0.85rem;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--portal-ink);
}

.open-application-grade {
    font-weight: 800;
}

.open-application-deadline {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--portal-primary-dark);
}

.open-applications-empty {
    padding: 0.85rem 0.95rem;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--portal-ink);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.45;
}

.portal-hero-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(4px);
    opacity: 0.58;
}

.glow-1 {
    width: 280px;
    height: 280px;
    top: -100px;
    right: -70px;
    background: radial-gradient(circle, rgba(255, 187, 47, 0.66), rgba(255, 187, 47, 0));
    animation: floatGlow 6s ease-in-out infinite;
}

.glow-2 {
    width: 240px;
    height: 240px;
    bottom: -110px;
    left: -70px;
    background: radial-gradient(circle, rgba(120, 206, 255, 0.55), rgba(120, 206, 255, 0));
    animation: floatGlow 8s ease-in-out infinite reverse;
}

.access-card {
    background: rgba(255, 255, 255, 0.95);
    color: var(--portal-ink);
    border-radius: 16px;
}

.access-card .form-control,
.access-card .form-select,
.modal .form-control,
.modal .form-select {
    border-radius: 11px;
}

.modal .form-control.locked-field {
    background-color: #e9ecef !important;
    color: #495057;
    cursor: not-allowed;
}

.modal .form-select.locked-field {
    background-color: #e9ecef !important;
    color: #495057;
    cursor: not-allowed;
}

.portal-card,
.step-card,
.modal-content {
    border-radius: 16px;
    background: var(--portal-card);
    border: 1px solid rgba(11, 93, 168, 0.09);
}

.step-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.step-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(8, 61, 112, 0.12);
    border-color: rgba(11, 93, 168, 0.35);
}

.step-complete {
    border-color: rgba(31, 154, 107, 0.55);
    box-shadow: 0 10px 26px rgba(31, 154, 107, 0.12);
}

.progress {
    height: 13px;
    border-radius: 999px;
    background: rgba(11, 93, 168, 0.14);
}

.progress-bar {
    font-size: 0.75rem;
    font-weight: 700;
    background: linear-gradient(90deg, #0b5da8, #1f9a6b);
}

.slot-card {
    border: 1px solid rgba(11, 93, 168, 0.18);
    border-radius: 14px;
    padding: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.slot-card:hover {
    transform: translateY(-1px);
    border-color: rgba(11, 93, 168, 0.45);
}

.slot-card.selected {
    border-color: rgba(31, 154, 107, 0.9);
    background: rgba(31, 154, 107, 0.08);
}

.slot-card.readonly-locked {
    cursor: not-allowed;
    opacity: 0.68;
}

.slot-card.readonly-locked:hover {
    transform: none;
    border-color: rgba(11, 93, 168, 0.18);
}

.portal-form-readonly .activity-doc-dropzone,
.portal-form-readonly .academic-report-dropzone,
.portal-form-readonly .headshot-dropzone {
    pointer-events: none;
    opacity: 0.58;
    background: #edf1f6 !important;
}

.headshot-uploader {
    max-width: 420px;
    margin: 0 auto;
}

.headshot-dropzone {
    border: 2px dashed rgba(11, 93, 168, 0.35);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(11, 93, 168, 0.05), rgba(11, 93, 168, 0.02));
    padding: 0.9rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.headshot-dropzone:hover,
.headshot-dropzone:focus-visible,
.headshot-dropzone.drag-over {
    border-color: rgba(11, 93, 168, 0.8);
    background: linear-gradient(160deg, rgba(11, 93, 168, 0.11), rgba(11, 93, 168, 0.04));
    transform: translateY(-1px);
    outline: none;
}

.headshot-dropzone.is-invalid {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.06);
}

.headshot-frame {
    width: 170px;
    height: 210px;
    margin: 0 auto;
    border-radius: 14px;
    border: 2px solid rgba(11, 93, 168, 0.2);
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(11, 93, 168, 0.04);
}

.headshot-preview {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.headshot-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(11, 93, 168, 0.05), rgba(11, 93, 168, 0.12));
    color: var(--portal-primary-dark);
}

.headshot-placeholder-icon {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
}

.headshot-uploader input.is-invalid ~ .invalid-feedback {
    display: block;
}

.academic-term-card {
    border: 1px solid rgba(11, 93, 168, 0.18);
    border-radius: 14px;
    background: rgba(11, 93, 168, 0.03);
    padding: 0.9rem;
}

.academic-term-title {
    font-weight: 800;
    color: var(--portal-primary-dark);
    font-size: 0.98rem;
}

.academic-report-dropzone {
    border: 2px dashed rgba(11, 93, 168, 0.35);
    border-radius: 12px;
    background: #fff;
    min-height: 98px;
    padding: 0.75rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.academic-report-dropzone:hover,
.academic-report-dropzone:focus-visible,
.academic-report-dropzone.drag-over {
    border-color: rgba(11, 93, 168, 0.75);
    background: rgba(11, 93, 168, 0.05);
    outline: none;
}

.academic-report-dropzone.is-invalid {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.academic-report-dropzone-text {
    font-weight: 700;
    color: var(--portal-primary-dark);
}

.activity-doc-dropzone {
    border: 2px dashed rgba(11, 93, 168, 0.35);
    border-radius: 12px;
    background: #fff;
    min-height: 82px;
    padding: 0.7rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.activity-doc-dropzone:hover,
.activity-doc-dropzone:focus-visible,
.activity-doc-dropzone.drag-over {
    border-color: rgba(11, 93, 168, 0.75);
    background: rgba(11, 93, 168, 0.05);
    outline: none;
}

.activity-doc-dropzone.is-invalid {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.activity-doc-dropzone-text {
    font-weight: 700;
    color: var(--portal-primary-dark);
}

.privacy-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.privacy-consent-check .form-check-input {
    position: static;
    margin: 0.15rem 0 0;
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.privacy-consent-body {
    min-width: 0;
    flex: 1 1 auto;
}

.privacy-consent-check .form-check-label {
    margin: 0;
    line-height: 1.45;
}

.privacy-consent-check .invalid-feedback {
    margin-top: 0.4rem;
}

.payment-success-check {
    width: 108px;
    height: 108px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    line-height: 1;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(145deg, #10b981, #059669);
    box-shadow: 0 16px 30px rgba(16, 185, 129, 0.35);
}

#paymentMethodChoices {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.payment-method-option {
    width: 100%;
    min-height: 52px;
    border-radius: 12px;
    border: 1px solid rgba(11, 93, 168, 0.45);
    background: #ffffff;
    color: #0b5da8;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.48rem 0.66rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

.payment-method-option:hover:not(:disabled):not(.is-active) {
    border-color: #0b5da8;
    background: #f3f9ff;
}

.payment-method-option.is-active {
    border-color: #0b5da8;
    background: #0b5da8;
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(11, 93, 168, 0.2);
}

.payment-method-option.is-active:hover:not(:disabled) {
    border-color: #0a4f8d;
    background: #0a4f8d;
    color: #ffffff;
}

.payment-method-option:disabled {
    cursor: not-allowed;
    opacity: 0.86;
}

.payment-method-text {
    text-align: left;
    line-height: 1.2;
}

.payment-method-icon-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.payment-method-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.payment-method-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.payment-method-icon-group-card .payment-method-icon {
    width: 30px;
    height: 22px;
    border-radius: 5px;
}

.payment-method-icon-group-card .payment-method-icon img {
    width: 18px;
    height: 18px;
}

.payment-method-icon-fps {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #ffffff;
    border: 0;
}

.payment-method-icon-fps img {
    width: 18px;
    height: 18px;
}

.portal-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 26, 52, 0.48);
}

.portal-loading-overlay.show {
    display: flex;
}

/* Prevent mobile scroll from leaking to the page behind open modals. */
body.modal-scroll-lock {
    position: fixed;
    width: 100%;
    overflow: hidden;
    touch-action: none;
}

.modal {
    overscroll-behavior: contain;
}

.modal .modal-body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal-backdrop.show {
    touch-action: none;
}

.text-muted,
.form-text {
    color: var(--portal-muted) !important;
}

.toast {
    border-radius: 12px;
}

#paymentEmbeddedCheckout {
    min-height: 420px;
}

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

@keyframes floatGlow {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(12px) scale(1.04);
    }
}

@media (max-width: 768px) {
    .portal-main {
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }

    .portal-hero,
    .portal-card,
    .step-card,
    .modal-content {
        border-radius: 14px;
    }

    .headshot-uploader {
        max-width: 100%;
    }

    .headshot-frame {
        width: 150px;
        height: 186px;
    }
}

@media (max-width: 576px) {
    #paymentMethodChoices {
        grid-template-columns: 1fr;
    }
}
