/* ==========================================================================
   Login page — premium split layout
   ========================================================================== */

:root {
    --brand-900: #120a3a;
    --brand-800: #1c0f52;
    --brand-700: #29166f;
    --brand-600: #3a2590;
    --brand-500: #5b45b8;
    --brand-100: #ece8fb;
    --brand-50: #f6f4fe;
    --accent: #f6b93b;

    --ink-900: #0f0d1d;
    --ink-700: #33304a;
    --ink-500: #6b6884;
    --ink-400: #8c89a3;
    --line: #e3e1ec;
    --surface: #ffffff;
    --canvas: #f7f6fb;

    --danger-700: #b42318;
    --danger-50: #fef3f2;
    --danger-200: #fecdca;

    --radius-sm: 0.625rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.5rem;

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    color: var(--ink-900);
    background: var(--canvas);
    font-family: "Plus Jakarta Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

html,
body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

/* Layout ------------------------------------------------------------------ */

.login-page {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* Brand panel ------------------------------------------------------------- */

.brand-panel {
    position: relative;
    overflow: hidden;
    color: #fff;
    background-color: var(--brand-800);
    background-image: linear-gradient(160deg, var(--brand-700) 0%, var(--brand-800) 45%, var(--brand-900) 100%);
}

/* soft glow accents */
.brand-panel::before,
.brand-panel::after {
    position: absolute;
    border-radius: 50%;
    content: "";
    filter: blur(70px);
    pointer-events: none;
}

.brand-panel::before {
    top: -12%;
    right: -10%;
    width: 26rem;
    height: 26rem;
    background: rgba(91, 69, 184, 0.55);
}

.brand-panel::after {
    bottom: -18%;
    left: -12%;
    width: 22rem;
    height: 22rem;
    background: rgba(246, 185, 59, 0.18);
}

.brand-panel__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    height: 100%;
    min-height: 100vh;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4.5rem);
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 10px 30px rgba(8, 4, 30, 0.35);
}

.brand-logo img {
    display: block;
    width: auto;
    height: 44px;
    max-width: 180px;
    object-fit: contain;
}

.brand-panel__body {
    max-width: 34rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.375rem 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.eyebrow::before {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(246, 185, 59, 0.2);
    content: "";
}

.brand-title {
    margin: 1.5rem 0 0;
    font-size: clamp(2rem, 3.4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.brand-lead {
    max-width: 30rem;
    margin: 1.25rem 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.0625rem;
    line-height: 1.65;
}

.brand-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin: 2.25rem 0 0;
    padding: 0;
    list-style: none;
}

.brand-features li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.brand-features svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.brand-panel__foot {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
}

/* Form panel -------------------------------------------------------------- */

.form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 5vw, 4rem);
    background:
        radial-gradient(60rem 30rem at 100% 0%, rgba(91, 69, 184, 0.07), transparent 60%),
        var(--canvas);
}

.login-card {
    width: 100%;
    max-width: 26.5rem;
    animation: card-in 520ms var(--ease) both;
}

.login-card__header h1 {
    margin: 0;
    color: var(--ink-900);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.login-card__subtitle {
    margin: 0.625rem 0 0;
    color: var(--ink-500);
    font-size: 0.9375rem;
    line-height: 1.55;
}

/* Form -------------------------------------------------------------------- */

.login-form {
    display: grid;
    gap: 1.25rem;
    margin-top: 2.25rem;
}

.form-field {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
}

.form-field label {
    color: var(--ink-700);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
}

.input-wrap {
    position: relative;
    display: block;
    min-width: 0;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--ink-400);
    pointer-events: none;
    transform: translateY(-50%);
    transition: color 180ms var(--ease);
}

.form-field input {
    width: 100%;
    height: 3.375rem;
    padding: 0 1rem 0 2.875rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    outline: none;
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 13, 29, 0.04);
    color: var(--ink-900);
    font-size: 0.9375rem;
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.form-field input::placeholder {
    color: var(--ink-400);
}

.form-field input:hover {
    border-color: #cfcbe0;
}

.form-field input:focus {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 4px rgba(58, 37, 144, 0.14);
}

.input-wrap:focus-within .input-icon {
    color: var(--brand-600);
}

#password {
    padding-right: 3.25rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.375rem;
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-500);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color 180ms var(--ease), color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.password-toggle:hover {
    background: var(--brand-50);
    color: var(--brand-700);
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(58, 37, 144, 0.3);
}

.eye-icon {
    width: 19px;
    height: 19px;
}

.eye-icon--hide,
.password-toggle.is-visible .eye-icon--show {
    display: none;
}

.password-toggle.is-visible .eye-icon--hide {
    display: block;
}

.field-error {
    margin: 0;
    color: var(--danger-700);
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--danger-200);
    border-radius: var(--radius-md);
    background: var(--danger-50);
    color: var(--danger-700);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35rem;
    animation: alert-in 360ms var(--ease) both;
}

.login-alert svg {
    width: 18px;
    height: 18px;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* Submit button ----------------------------------------------------------- */

.submit-button {
    position: relative;
    display: inline-flex;
    width: 100%;
    height: 3.375rem;
    margin-top: 0.375rem;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0 1.25rem;
    border: 0;
    border-radius: var(--radius-md);
    outline: none;
    background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 55%, var(--brand-800) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 12px 28px -10px rgba(41, 22, 111, 0.6);
    color: #fff;
    font-size: 0.9875rem;
    font-weight: 700;
    letter-spacing: 0.005em;
    cursor: pointer;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), filter 180ms var(--ease), opacity 180ms var(--ease);
}

.submit-button:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 16px 34px -10px rgba(41, 22, 111, 0.7);
    transform: translateY(-1px);
}

.submit-button:active:not(:disabled) {
    transform: translateY(0);
}

.submit-button:focus-visible {
    box-shadow: 0 0 0 4px rgba(58, 37, 144, 0.28), 0 12px 28px -10px rgba(41, 22, 111, 0.6);
}

.submit-button:disabled {
    cursor: wait;
    opacity: 0.85;
}

.submit-button__arrow {
    width: 18px;
    height: 18px;
    transition: transform 180ms var(--ease);
}

.submit-button:hover:not(:disabled) .submit-button__arrow {
    transform: translateX(3px);
}

.spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.submit-button.is-loading .spinner {
    display: block;
}

.submit-button.is-loading .submit-button__arrow {
    display: none;
}

/* Admissions -------------------------------------------------------------- */

.divider {
    height: 1px;
    margin: 2rem 0 1.25rem;
    background: var(--line);
}

.admission-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.admission-links a {
    display: flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 13, 29, 0.04);
    color: var(--brand-700);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: border-color 180ms var(--ease), background-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.admission-links a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.admission-links a:hover {
    border-color: #c9c1ec;
    background: var(--brand-50);
    transform: translateY(-1px);
}

.admission-links a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(58, 37, 144, 0.18);
}

.login-card__foot {
    margin: 2.5rem 0 0;
    color: var(--ink-400);
    font-size: 0.75rem;
    text-align: center;
}

/* Animations -------------------------------------------------------------- */

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alert-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1100px) {
    .brand-features li:nth-child(n + 3) {
        display: none;
    }
}

@media (max-width: 900px) {
    .login-page {
        display: block;
    }

    .brand-panel__inner {
        min-height: 0;
        gap: 1.25rem;
        padding: 1.5rem 1.25rem 4.5rem;
    }

    .brand-logo {
        padding: 0.5rem 0.75rem;
    }

    .brand-logo img {
        height: 36px;
    }

    .brand-panel__body .brand-lead,
    .brand-features,
    .brand-panel__foot {
        display: none;
    }

    .eyebrow {
        font-size: 0.6875rem;
    }

    .brand-title {
        margin-top: 0.875rem;
        font-size: 1.5rem;
    }

    .form-panel {
        align-items: flex-start;
        margin-top: -3rem;
        padding: 0 1rem 2rem;
        background: transparent;
    }

    .login-card {
        position: relative;
        max-width: 30rem;
        padding: 1.75rem 1.5rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        background: var(--surface);
        box-shadow: 0 24px 60px -24px rgba(18, 10, 58, 0.35);
    }

    .login-card__header h1 {
        font-size: 1.625rem;
    }

    .login-form {
        margin-top: 1.5rem;
    }
}

@media (max-width: 340px) {
    .admission-links {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .spinner {
        animation: spin 1.5s linear infinite !important;
    }
}
