/* ---------- Sign-in page: brand panel on the left, form on the right ---------- */
:root {
    --primary: #1e3a8a;
    --primary-dark: #172554;
    --accent: #059669;
    --accent-light: #10b981;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --danger: #dc2626;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
    min-height: 100vh;
    background: #f8fafc;
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth {
    display: grid;
    grid-template-columns: minmax(380px, 46%) 1fr;
    min-height: 100vh;
}

/* ---------- Brand panel ---------- */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    padding: 3rem 3.5rem;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 10%, rgba(16, 185, 129, 0.28), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(59, 91, 219, 0.45), transparent 50%),
        linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 70%, #0b1437 100%);
}

/* Fine grid, fading out towards the bottom */
.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    pointer-events: none;
}

.auth-brand > * {
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.02em;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand-name {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

.brand-tagline {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}

.auth-brand-body h1 {
    max-width: 18ch;
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-top: 2.25rem;
    max-width: 30rem;
}

.features li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #6ee7b7;
}

.feature-icon svg {
    width: 19px;
    height: 19px;
}

.auth-brand-foot {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- Form side ---------- */
.auth-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem 3rem;
}

.lang-switch {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    display: flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.lang-option {
    padding: 0.3rem 0.7rem;
    border-radius: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.lang-option:hover {
    color: var(--primary);
}

.lang-option.active {
    background: var(--primary);
    color: #fff;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    animation: rise 0.45s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* Logo shown above the form only when the brand panel is hidden */
.brand-compact {
    display: none;
    margin-bottom: 2rem;
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-intro {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

.field label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.control {
    position: relative;
    display: flex;
    align-items: center;
}

.control-icon {
    position: absolute;
    left: 0.9rem;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.15s;
}

.control input {
    width: 100%;
    height: 48px;
    padding: 0 2.9rem 0 2.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.control input::placeholder {
    color: #a3b0c2;
}

.control input:hover {
    border-color: #94a3b8;
}

.control input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.12);
}

.control:focus-within .control-icon {
    color: var(--primary);
}

.control.has-error input {
    border-color: #fca5a5;
}

.toggle-password {
    position: absolute;
    right: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.toggle-password:hover {
    color: var(--primary);
    background: #f1f5f9;
}

.toggle-password:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.toggle-password svg {
    width: 19px;
    height: 19px;
}

.toggle-password .eye-closed,
.toggle-password.is-visible .eye-open {
    display: none;
}

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

.caps-warning {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #b45309;
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 50px;
    margin-top: 0.5rem;
    border: none;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), #2743a8);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.25);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(30, 58, 138, 0.32);
    filter: brightness(1.05);
}

.btn-submit:active {
    transform: none;
}

.btn-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.25);
}

.btn-arrow {
    width: 18px;
    height: 18px;
    transition: transform 0.15s;
}

.btn-submit:hover .btn-arrow {
    transform: translateX(3px);
}

/* While the credentials are checked */
.btn-submit.is-loading {
    cursor: progress;
    filter: saturate(0.8);
}

.btn-submit.is-loading .btn-arrow {
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    stroke: none;
    animation: spin 0.7s linear infinite;
}

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

.auth-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
}

.auth-secure svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ---------- Smaller screens: form only, logo above it ---------- */
@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .brand-compact {
        display: flex;
    }

    .brand-compact .brand-name {
        color: var(--ink);
    }

    .auth-main {
        padding: 5rem 1.25rem 2.5rem;
    }

    .lang-switch {
        right: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Institution logo: an image replaces the initials badge */
.brand-logo.has-image {
    background: #ffffff;
    padding: 5px;
}

.brand-logo.has-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
