/* ==========================================================================
   Portal sign-in popup - shown over the public /student-portal landing page.
   Direction-agnostic: uses logical properties so it works in both RTL and LTR.
   ========================================================================== */

.portal-login-overlay {
    --plm-primary: #1b6ef3;
    --plm-primary-dark: #1450b8;
    --plm-surface: #ffffff;
    --plm-text: #12213c;
    --plm-muted: #64748b;
    --plm-line: #dbe3ef;
    --plm-danger: #c8253c;
    --plm-danger-soft: #fdecef;

    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 20px;
    background: rgb(6 17 36 / 62%);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.22s ease;
    overflow-y: auto;
}

.portal-login-overlay[hidden] {
    display: none !important;
}

.portal-login-overlay.is-open {
    opacity: 1;
}

.portal-login-modal {
    position: relative;
    width: min(430px, 100%);
    padding: 34px 30px 28px;
    border-radius: 22px;
    background: var(--plm-surface);
    box-shadow: 0 30px 70px rgb(6 17 36 / 34%);
    color: var(--plm-text);
    font-family: "Cairo", "Manrope", system-ui, sans-serif;
    transform: translateY(18px) scale(0.97);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.portal-login-overlay.is-open .portal-login-modal {
    transform: translateY(0) scale(1);
}

.portal-login-modal *,
.portal-login-modal *::before,
.portal-login-modal *::after {
    box-sizing: border-box;
}

.portal-login-modal__close {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: 12px;
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: #f1f5fb;
    color: var(--plm-muted);
    cursor: pointer;
    font-size: 1.35rem;
    transition: background 0.16s ease, color 0.16s ease;
}

.portal-login-modal__close:hover {
    background: var(--plm-danger-soft);
    color: var(--plm-danger);
}

.portal-login-modal__head {
    display: flex;
    /* The close button is absolutely positioned at the inline end, so the row keeps clear of it
       rather than letting a long title run underneath. */
    padding-inline-end: 44px;
    margin-block-end: 22px;
    align-items: center;
    gap: 12px;
}

.portal-login-modal__head img {
    flex: 0 0 auto;
    border-radius: 14px;
}

.portal-login-modal__head h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.35;
}

.portal-login-modal__head p {
    margin: 0;
    color: var(--plm-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.portal-login-form {
    display: grid;
    gap: 16px;
}

.portal-login-form__error {
    margin: 0;
    padding: 11px 14px;
    border: 1px solid rgb(200 37 60 / 24%);
    border-radius: 12px;
    background: var(--plm-danger-soft);
    color: var(--plm-danger);
    font-size: 0.85rem;
    font-weight: 600;
}

.portal-login-form__error[hidden] {
    display: none;
}

.portal-login-field {
    display: grid;
    gap: 7px;
}

.portal-login-field > span:first-child {
    font-size: 0.83rem;
    font-weight: 700;
}

.portal-login-field__control {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--plm-line);
    border-radius: 13px;
    background: #f8fafd;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.portal-login-field__control:focus-within {
    border-color: var(--plm-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgb(27 110 243 / 12%);
}

.portal-login-field__control > i {
    padding-inline: 14px 0;
    color: var(--plm-muted);
    font-size: 1.2rem;
}

.portal-login-field input {
    width: 100%;
    min-height: 50px;
    padding-inline: 12px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
    outline: none;
}

.portal-login-field__toggle {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    margin-inline-end: 4px;
    background: transparent;
    color: var(--plm-muted);
    cursor: pointer;
    font-size: 1.15rem;
}

.portal-login-field__toggle:hover {
    color: var(--plm-primary);
}

.portal-login-remember {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--plm-muted);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
}

.portal-login-remember input {
    width: 17px;
    height: 17px;
    accent-color: var(--plm-primary);
    cursor: pointer;
}

.portal-login-submit {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--plm-primary), var(--plm-primary-dark));
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.portal-login-submit:hover:not(:disabled) {
    box-shadow: 0 12px 26px rgb(27 110 243 / 34%);
    transform: translateY(-1px);
}

.portal-login-submit:disabled {
    cursor: progress;
    opacity: 0.72;
}

.portal-login-submit i {
    font-size: 1.25rem;
}

.portal-login-help {
    margin: 0;
    color: var(--plm-muted);
    font-size: 0.78rem;
    text-align: center;
}

/* The landing-page CTAs became <button> elements so they can open this popup;
   give them the same box model the original anchors had. */
button.btn-lms-login,
button.btn-portal-entry {
    border: 0;
    font: inherit;
    cursor: pointer;
}

button.btn-portal-entry {
    width: 100%;
}

@media (max-width: 420px) {
    .portal-login-modal {
        padding: 30px 20px 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-login-overlay,
    .portal-login-modal,
    .portal-login-submit {
        transition: none;
    }
}
