/* Rudofin Auth — premium login (dark-mode-ready tokens; dark not implemented) */

:root {
    --rf-primary: #BF1914;
    --rf-secondary: #8A0E0A;
    --rf-text: #111111;
    --rf-bg: #FFFFFF;
    --rf-surface: #F9FAFB;
    --rf-border: rgba(17, 17, 17, 0.045);
    --rf-muted: #6B7280;
    --rf-muted-2: #9CA3AF;
    --rf-danger: #B91C1C;
    --rf-danger-bg: #FEF2F2;
    --rf-danger-border: #FECACA;
    --rf-warn: #92400E;
    --rf-warn-bg: #FFFBEB;
    --rf-warn-border: #FDE68A;
    --rf-info: #1E3A5F;
    --rf-info-bg: #F0F7FF;
    --rf-info-border: #BFDBFE;
    --rf-success: #166534;
    --rf-radius: 0.75rem;
    --rf-radius-sm: 0.5rem;
    --rf-shadow: 0 1px 2px rgba(17, 17, 17, 0.05), 0 12px 32px rgba(17, 17, 17, 0.06);
    --rf-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --rf-focus: 0 0 0 3px rgba(191, 25, 20, 0.18);
    --rf-transition: 160ms ease;
}

/* Future dark mode hook — do not enable yet
[data-theme="dark"] {
    --rf-text: #F3F4F6;
    --rf-bg: #0B0B0C;
    --rf-surface: #161618;
    --rf-border: #2A2A2E;
    --rf-muted: #9CA3AF;
}
*/

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

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
}

body.rf-auth {
    font-family: var(--rf-font);
    color: var(--rf-text);
    background: var(--rf-bg);
    line-height: 1.5;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

a {
    color: var(--rf-primary);
    text-decoration: none;
}
a:hover { color: var(--rf-secondary); }

.rf-auth-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--rf-primary);
    color: #fff;
    border-radius: var(--rf-radius-sm);
}
.rf-auth-skip:focus {
    left: 0.75rem;
    top: 0.75rem;
}

/* ── Split shell ─────────────────────────────────────────── */

.rf-auth-shell {
    display: grid;
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

@media (min-width: 992px) {
    .rf-auth-shell {
        grid-template-columns: 40% 60%;
    }
}

/* ── Left brand panel ────────────────────────────────────── */

.rf-auth-brand {
    position: relative;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 0;
    padding: 2.25rem 2.5rem;
    background: var(--rf-surface);
    border-right: 1px solid var(--rf-border);
    overflow: hidden;
    animation: rf-auth-fade-in 420ms ease both;
}

@media (min-width: 992px) {
    .rf-auth-brand { display: flex; }
}

.rf-auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--rf-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--rf-border) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.rf-auth-brand-inner {
    position: relative;
    z-index: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

.rf-auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--rf-text);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.75rem;
    flex-shrink: 0;
}
.rf-auth-logo:hover { color: var(--rf-text); }
.rf-auth-logo span { color: var(--rf-primary); }

.rf-auth-logo-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.45rem;
    background: var(--rf-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
}

.rf-auth-headline {
    margin: 0 0 0.75rem;
    font-size: clamp(1.55rem, 2.1vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    max-width: 18ch;
    flex-shrink: 0;
}

.rf-auth-lead {
    margin: 0 0 1.5rem;
    color: var(--rf-muted);
    font-size: 0.92rem;
    max-width: 36ch;
    flex-shrink: 0;
}

.rf-auth-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    flex-shrink: 0;
}

.rf-auth-feature {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    background: var(--rf-bg);
    border: 1px solid var(--rf-border);
    border-radius: var(--rf-radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rf-text);
    transition: border-color var(--rf-transition), transform var(--rf-transition);
}
.rf-auth-feature:hover {
    border-color: #D1D5DB;
    transform: translateY(-1px);
}

.rf-auth-feature-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--rf-primary);
    flex-shrink: 0;
}

.rf-auth-preview {
    position: relative;
    z-index: 1;
    background: var(--rf-bg);
    border: 1px solid var(--rf-border);
    border-radius: var(--rf-radius);
    overflow: hidden;
    box-shadow: var(--rf-shadow);
    flex: 1 1 auto;
    min-height: 8.5rem;
    max-height: 14rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.rf-auth-preview-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--rf-border);
    background: var(--rf-bg);
    flex-shrink: 0;
}
.rf-auth-preview-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #D1D5DB;
}
.rf-auth-preview-title {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    color: var(--rf-muted);
}

.rf-auth-preview-body {
    display: grid;
    grid-template-columns: 3.25rem 1fr;
    flex: 1;
    min-height: 0;
}

.rf-auth-preview-nav {
    background: #111111;
    padding: 0.7rem 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}
.rf-auth-preview-nav span {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.12);
}
.rf-auth-preview-nav span.is-active {
    background: var(--rf-primary);
}

.rf-auth-preview-main {
    padding: 0.8rem;
    background: var(--rf-surface);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    align-content: start;
}

.rf-auth-preview-stat {
    background: var(--rf-bg);
    border: 1px solid var(--rf-border);
    border-radius: 0.4rem;
    padding: 0.6rem 0.5rem;
}
.rf-auth-preview-stat strong {
    display: block;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
}
.rf-auth-preview-stat small {
    color: var(--rf-muted);
    font-size: 0.65rem;
}

.rf-auth-brand-foot {
    position: relative;
    z-index: 1;
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: var(--rf-muted);
    flex-shrink: 0;
}

/* Only shrink secondary content on short laptops */
@media (max-height: 680px) {
    .rf-auth-preview { display: none; }
    .rf-auth-lead { margin-bottom: 1rem; }
    .rf-auth-features { margin-bottom: 0; }
    .rf-auth-logo { margin-bottom: 1.25rem; }
}

/* ── Right panel ─────────────────────────────────────────── */

.rf-auth-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background:
        linear-gradient(var(--rf-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--rf-border) 1px, transparent 1px);
    background-size: 32px 32px;
    background-color: var(--rf-bg);
    animation: rf-auth-slide-in 380ms ease both;
}

.rf-auth-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.5rem;
    flex-shrink: 0;
}

.rf-auth-panel-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--rf-text);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}
.rf-auth-panel-logo:hover { color: var(--rf-text); }
.rf-auth-panel-logo span { color: var(--rf-primary); }

@media (min-width: 992px) {
    .rf-auth-panel-logo { visibility: hidden; }
}

.rf-auth-lang {
    position: relative;
}

.rf-auth-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--rf-border);
    border-radius: 999px;
    background: var(--rf-bg);
    color: var(--rf-text);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color var(--rf-transition), box-shadow var(--rf-transition);
}
.rf-auth-lang-btn:hover { border-color: #D1D5DB; }
.rf-auth-lang-btn:focus-visible {
    outline: none;
    box-shadow: var(--rf-focus);
}

.rf-auth-lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 11rem;
    padding: 0.35rem;
    background: var(--rf-bg);
    border: 1px solid var(--rf-border);
    border-radius: var(--rf-radius-sm);
    box-shadow: var(--rf-shadow);
    display: none;
    z-index: 20;
}
.rf-auth-lang-menu.is-open { display: block; }

.rf-auth-lang-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: var(--rf-text);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    text-align: left;
}
.rf-auth-lang-item:hover,
.rf-auth-lang-item[aria-current="true"] {
    background: var(--rf-surface);
}

.rf-auth-panel-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    padding: 0.75rem 1.5rem;
}

.rf-auth-card {
    width: 100%;
    max-width: 26rem;
    max-height: 100%;
    background: var(--rf-bg);
    border: 1px solid var(--rf-border);
    border-radius: 1rem;
    box-shadow: var(--rf-shadow);
    padding: 1.75rem 1.75rem 1.5rem;
    overflow: hidden;
}

@media (min-width: 480px) {
    .rf-auth-card { padding: 2rem 2rem 1.65rem; }
}

.rf-auth-card-header {
    margin-bottom: 1.35rem;
}

.rf-auth-card-header h1 {
    margin: 0 0 0.35rem;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.rf-auth-card-header p {
    margin: 0;
    color: var(--rf-muted);
    font-size: 0.9rem;
}

/* Alerts / states */
.rf-auth-alert {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border-radius: var(--rf-radius-sm);
    border: 1px solid;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}
.rf-auth-alert svg {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
}
.rf-auth-alert--danger {
    background: var(--rf-danger-bg);
    border-color: var(--rf-danger-border);
    color: var(--rf-danger);
}
.rf-auth-alert--warn {
    background: var(--rf-warn-bg);
    border-color: var(--rf-warn-border);
    color: var(--rf-warn);
}
.rf-auth-alert--info {
    background: var(--rf-info-bg);
    border-color: var(--rf-info-border);
    color: var(--rf-info);
}

/* Form */
.rf-auth-field {
    margin-bottom: 1.15rem;
}

.rf-auth-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--rf-text);
    letter-spacing: -0.01em;
}

.rf-auth-required {
    color: var(--rf-primary);
    margin-left: 0.15rem;
    font-weight: 700;
}

.rf-auth-input-wrap {
    position: relative;
}

.rf-auth-input-icon {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.15rem;
    height: 1.15rem;
    color: #6B7280;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.rf-auth-input-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.rf-auth-input {
    width: 100%;
    height: 3.1rem;
    padding: 0 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 0.375rem;
    background: #fff;
    color: var(--rf-text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 120ms ease, border-width 120ms ease;
}
.rf-auth-input--icon {
    padding-left: 2.75rem;
}
.rf-auth-input::placeholder { color: var(--rf-muted-2); }
.rf-auth-input:hover:not(:focus) { border-color: #D1D5DB; }
/* Material outlined focus: only border width + colour */
.rf-auth-input:focus {
    outline: none;
    border-width: 2px;
    border-color: var(--rf-primary);
    box-shadow: none;
}
.rf-auth-input.is-invalid {
    border-color: var(--rf-primary);
    box-shadow: none;
}
.rf-auth-input.is-invalid:focus {
    border-width: 2px;
    border-color: var(--rf-primary);
}

.rf-auth-input--password {
    padding-right: 3rem;
}

.rf-auth-toggle-pw {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.35rem;
    height: 2.35rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: #9CA3AF;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.rf-auth-toggle-pw:hover { color: var(--rf-text); background: var(--rf-surface); }
.rf-auth-toggle-pw:focus-visible {
    outline: none;
    box-shadow: var(--rf-focus);
}
.rf-auth-toggle-pw svg {
    width: 1.2rem;
    height: 1.2rem;
}
.rf-auth-toggle-pw .icon-hide { display: none; }
.rf-auth-toggle-pw[aria-pressed="true"] .icon-show { display: none; }
.rf-auth-toggle-pw[aria-pressed="true"] .icon-hide { display: block; }

.rf-auth-hint {
    margin: 0.4rem 0 0;
    font-size: 0.75rem;
    color: var(--rf-danger);
}
.rf-auth-caps {
    display: none;
    margin: 0.4rem 0 0;
    font-size: 0.75rem;
    color: var(--rf-warn);
}
.rf-auth-caps.is-visible { display: block; }

.rf-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
}

.rf-auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--rf-text);
    cursor: pointer;
    user-select: none;
}
.rf-auth-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--rf-primary);
    cursor: pointer;
}

.rf-auth-forgot {
    font-size: 0.85rem;
    font-weight: 500;
}

.rf-auth-submit {
    width: 100%;
    height: 2.85rem;
    border: 0;
    border-radius: var(--rf-radius-sm);
    background: var(--rf-primary);
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    transition: background var(--rf-transition), transform var(--rf-transition), box-shadow var(--rf-transition);
}
.rf-auth-submit:hover:not(:disabled) {
    background: var(--rf-secondary);
}
.rf-auth-submit:focus-visible {
    outline: none;
    box-shadow: var(--rf-focus);
}
.rf-auth-submit:active:not(:disabled) {
    transform: translateY(1px);
}
.rf-auth-submit:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.rf-auth-spinner {
    width: 1.05rem;
    height: 1.05rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rf-auth-spin 0.7s linear infinite;
    display: none;
}
.rf-auth-submit.is-loading .rf-auth-spinner { display: block; }
.rf-auth-submit.is-loading .rf-auth-submit-label { opacity: 0.85; }

.rf-auth-trust {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
    margin: 1.15rem 0 0;
    padding: 0;
    list-style: none;
}
.rf-auth-trust li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--rf-muted);
}
.rf-auth-trust svg {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--rf-primary);
    flex-shrink: 0;
}

.rf-auth-support {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rf-border);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--rf-muted);
}
.rf-auth-support a { font-weight: 500; }

.rf-auth-panel-foot {
    padding: 0.85rem 1.5rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.15rem;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    color: var(--rf-muted);
    flex-shrink: 0;
}
.rf-auth-panel-foot strong {
    color: var(--rf-text);
    font-weight: 600;
}

.rf-auth-secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.rf-auth-secure-badge svg {
    width: 0.85rem;
    height: 0.85rem;
    color: var(--rf-primary);
}

/* Animations */
@keyframes rf-auth-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes rf-auth-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@keyframes rf-auth-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .rf-auth-brand,
    .rf-auth-panel,
    .rf-auth-spinner,
    .rf-auth-feature {
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile: single column, centered — still no page scroll */
@media (max-width: 991.98px) {
    .rf-auth-panel {
        background-size: 40px 40px;
    }
    .rf-auth-trust {
        grid-template-columns: 1fr 1fr;
    }
    .rf-auth-panel-main {
        padding: 0.5rem 1.15rem;
    }
    .rf-auth-card {
        padding: 1.5rem 1.35rem 1.25rem;
    }
}

/* Short viewports: trim gently without looking cramped */
@media (max-height: 700px) {
    .rf-auth-card-header { margin-bottom: 1rem; }
    .rf-auth-card-header h1 { font-size: 1.3rem; }
    .rf-auth-field { margin-bottom: 0.8rem; }
    .rf-auth-input,
    .rf-auth-submit { height: 2.65rem; }
    .rf-auth-trust { margin-top: 0.9rem; }
    .rf-auth-support { margin-top: 0.9rem; padding-top: 0.8rem; }
}

/* FinTech portal switch (replaces School language menu slot) */
.rf-auth-portal-switch {
    font-size: 0.8125rem;
    color: var(--rf-muted);
}
.rf-auth-portal-switch a {
    font-weight: 600;
}

.rf-auth-demo {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border-radius: var(--rf-radius-sm);
    border: 1px solid var(--rf-warn-border);
    background: var(--rf-warn-bg);
    color: var(--rf-warn);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    line-height: 1.45;
}
.rf-auth-demo code {
    font-size: 0.78rem;
    background: rgba(255,255,255,0.55);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
}

#loginAlerts .mynotify,
#loginAlerts .myalert {
    font-size: 0.85rem;
}

/* Minimal modal styles (Bootstrap-compatible classes used by existing JS) */
.modal{position:fixed;inset:0;z-index:1050;display:none;overflow:auto;background:rgba(17,17,17,.45)}
.modal.show,.modal.in{display:block}
.modal-dialog{max-width:28rem;margin:10vh auto;padding:1rem}
.modal-content{background:#fff;border:1px solid #E5E7EB;border-radius:.75rem;box-shadow:0 12px 32px rgba(17,17,17,.12);overflow:hidden}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.25rem;background:#111;color:#fff}
.modal-title{margin:0;font-size:1rem;font-weight:700}
.modal-body{padding:1.25rem}
.btn-close{border:0;background:transparent;color:#fff;font-size:1.25rem;cursor:pointer;line-height:1}
.btn-close::before{content:"×"}
.form-label{display:block;margin-bottom:.4rem;font-weight:600;font-size:.875rem}
.form-control{width:100%;padding:.65rem .75rem;border:1px solid #E5E7EB;border-radius:.5rem;font:inherit}
.form-control:focus{outline:0;border-color:#BF1914}
.d-flex{display:flex}.gap-2{gap:.5rem}.flex-fill{flex:1}
.btn{display:inline-flex;align-items:center;justify-content:center;padding:.65rem 1rem;border-radius:.5rem;border:1px solid transparent;font:inherit;font-weight:600;cursor:pointer}
.btn-light{background:#F3F4F6;color:#111}
.btn-primary{background:#BF1914;color:#fff}
.alert{border-radius:.5rem}.alert-success{background:#ECFDF5;color:#065F46}.border-0{border:0!important}
.py-2{padding-top:.5rem;padding-bottom:.5rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1.5rem}
.small{font-size:.875rem}.text-muted{color:#6B7280}.text-white{color:#fff}
