/* =============================================================
   Mutesa I Royal University — Student & Staff Portal
   Modern Login Page Stylesheet
   Design tokens match MyApplications_Modern.aspx exactly.

   Color palette:
     --navy:        #05275C  (primary dark — header, brand panel)
     --navy-deep:   #041d45  (hover, deeper accents)
     --blue:        #174DA4  (links, focus rings)
     --blue-hover:  #0f3a7d  (hover on blue elements)
     --white:       #FFFFFF
     --surface:     #f5f7fa  (page background)
     --border:      #e0e5ed  (card borders, dividers)
     --text:        #1a1a2e  (primary text)
     --text-muted:  #666666  (secondary text)
     --danger:      #dc3545  (errors)
     --danger-bg:   #fef5f5  (error backgrounds)
     --danger-bdr:  #f5c6cb  (error borders)

   Typography: system font stack, 13px base (matches core.css)
   Borders: 0 radius on inputs/buttons/cards (design system)
   ============================================================= */

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

html {
    height: 100%;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #1a1a2e;
    background-color: #f5f7fa;
}

/* Collapse the auto-generated ASP.NET hidden-fields wrapper div.
   ASP.NET renders __VIEWSTATE/__EVENTVALIDATION in a bare <div> with no id
   at the top of the form. Hide it so it takes zero space. */
form#form1 > div:not([id]) {
    display: none !important;
}

/* Make form1 and its rp_login container fill the viewport */
form#form1,
#rp_login,
.dxPanelControl { min-height: 100vh; }

a { color: #174DA4; text-decoration: none; }
a:hover { color: #0f3a7d; text-decoration: underline; }

/* ── Outer wrapper ──────────────────────────────────────── */
.cdl-wrap {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

/* ── Split layout (brand | form) ────────────────────────── */
.cdl-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ═════════════════════════════════════════════════════════
   LEFT — BRAND PANEL
   ═════════════════════════════════════════════════════════ */
.cdl-brand {
    width: 38%;
    min-width: 280px;
    background-color: #05275C;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Subtle radial highlight in the top-left corner */
    background-image: radial-gradient(ellipse at 10% 10%,
        rgba(255,255,255,0.06) 0%,
        transparent 60%);
}

.cdl-brand__inner {
    flex: 1;
    padding: 48px 36px 32px;
    display: flex;
    flex-direction: column;
}

/* Logo */
.cdl-brand__logo-wrap {
    margin-bottom: 24px;
}

.cdl-brand__logo {
    height: 72px;
    width: auto;
    display: block;
    /* white background so logo is visible on dark panel */
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 0;             /* squared — matches design system */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* "Student & Staff Portal" badge */
.cdl-brand__badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    margin-bottom: 16px;
}

/* University name */
.cdl-brand__name {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    margin: 0 0 12px;
    letter-spacing: -0.3px;
}

/* Tagline */
.cdl-brand__tagline {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    margin: 0 0 28px;
}

/* Horizontal rule between tagline and feature list */
.cdl-brand__rule {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    margin: 0 0 24px;
}

/* ── Feature list ── */
.cdl-features {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cdl-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.cdl-feature__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
}

.cdl-feature__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cdl-feature__text strong {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
}

.cdl-feature__text span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

/* Brand panel footer */
.cdl-brand__foot {
    padding: 20px 36px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.6;
}

.cdl-brand__foot p { margin: 0; }

.cdl-brand__foot strong {
    color: rgba(255, 255, 255, 0.65);
    font-weight: 600;
}

/* ═════════════════════════════════════════════════════════
   RIGHT — FORM PANEL
   ═════════════════════════════════════════════════════════ */
.cdl-panel {
    flex: 1;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e0e5ed;
}

/* Centre the form vertically — dot-grid here, matching MyApplications_Modern.aspx */
.cdl-panel__body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 48px;
    /* The dot-grid background lives HERE, behind the white form card */
    background-color: #f5f7fa;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2305275C' stroke-opacity='0.04' stroke-width='1'%3E%3Cpath d='M0 20h40M20 0v40'/%3E%3Ccircle cx='20' cy='20' r='2' fill='%2305275C' fill-opacity='0.03'/%3E%3Ccircle cx='0' cy='20' r='1' fill='%2305275C' fill-opacity='0.03'/%3E%3Ccircle cx='40' cy='20' r='1' fill='%2305275C' fill-opacity='0.03'/%3E%3Ccircle cx='20' cy='0' r='1' fill='%2305275C' fill-opacity='0.03'/%3E%3Ccircle cx='20' cy='40' r='1' fill='%2305275C' fill-opacity='0.03'/%3E%3C/g%3E%3C/svg%3E");
}

/* Bottom footer strip — two columns: security notice + copyright/support */
.cdl-panel__footer {
    padding: 14px 48px;
    border-top: 1px solid #edf0f5;
    background: #fafbfc;
    font-size: 11.5px;
    color: #aab0bc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* Left: secure connection indicator */
.cdl-pf-secure {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.cdl-pf-secure svg { color: #3daa72; flex-shrink: 0; }

/* Right: copyright + ICT support link */
.cdl-pf-copy {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cdl-pf-copy .cdl-link { font-size: 11.5px; }

/* ── Login Form — white card sitting on the dot-grid ─────── */
.cdl-form {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border: 1px solid #e0e5ed;
    border-top: 3px solid #05275C;    /* bold navy top accent */
    box-shadow: 0 4px 16px rgba(5, 39, 92, 0.10);
    padding: 32px;
}

/* "Sign In" heading block */
.cdl-form__head {
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid #edf0f5;
}

.cdl-form__heading {
    font-size: 22px;
    font-weight: 700;
    color: #05275C;
    margin: 0;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

/* ── Failure / Error message ── */
.cdl-form__failure {
    display: none;              /* hidden by default — JS shows as flex when error exists */
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    background: #fef5f5;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 20px;
}

.cdl-form__failure svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #dc3545;
}

/* ── Form groups ── */
.cdl-form__group {
    margin-bottom: 18px;
}

.cdl-form__group--submit {
    margin-top: 24px;
    margin-bottom: 0;
}

/* Label row — label + any right-side link */
.cdl-form__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 6px;
}

.cdl-form__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

/* ── Inputs — asp:TextBox rendered as <input> ── */
.cdl-form__input {
    display: block;
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: #1a1a2e;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 0;          /* square — matches design system */
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.cdl-form__input::placeholder {
    color: #aab0bc;
    font-size: 12px;
}

.cdl-form__input:hover {
    border-color: #a0aab8;
}

.cdl-form__input:focus {
    border-color: #174DA4;
    box-shadow: 0 0 0 3px rgba(23, 77, 164, 0.12);
}

/* Password field gets right-padding to avoid overlap with eye btn */
.cdl-form__input--pw {
    padding-right: 40px;
}

/* ── Password wrapper (input + eye toggle) ── */
.cdl-form__input-wrap {
    position: relative;
}

.cdl-form__input-wrap .cdl-form__input {
    margin: 0;
}

/* Eye toggle button */
.cdl-form__eye {
    position: absolute;
    right: 0;
    top: 0;
    height: 38px;
    width: 38px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999999;
    padding: 0;
    outline: none;
}

.cdl-form__eye:hover { color: #333333; }

/* ── Validation messages ── */
.cdl-form__val {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #dc3545;
    line-height: 1.4;
}

/* ── Sign In button — asp:Button rendered as <input type="submit"> ── */
.cdl-btn {
    display: inline-block;
    padding: 0 16px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0;          /* square — matches design system */
    -webkit-appearance: none;
    appearance: none;
    letter-spacing: 0.3px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cdl-btn--primary {
    width: 100%;
    height: 44px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background-color: #05275C;
    border-color: #05275C;
    color: #ffffff;
}

.cdl-btn--primary:hover {
    background-color: #041d45;
    border-color: #041d45;
    color: #ffffff;
}

.cdl-btn--primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(5, 39, 92, 0.2);
}

.cdl-btn--primary:active {
    background-color: #03162e;
    border-color: #03162e;
}

/* ── Forgot password / help links ── */
.cdl-form__links {
    margin-top: 16px;
    text-align: center;
}

.cdl-link {
    color: #174DA4;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.cdl-link:hover {
    color: #0f3a7d;
    text-decoration: underline;
}

/* ── Forgot-password popup body ── */
.cdl-popup-body {
    padding: 24px 20px;
    text-align: center;
}

.cdl-popup-msg {
    font-size: 14px;
    line-height: 1.6;
    color: #1a1a2e;
}

/* =============================================================
   RESPONSIVE LAYOUT
   ============================================================= */

/* Tablet: narrow the brand panel */
@media (max-width: 960px) {
    .cdl-brand {
        width: 32%;
        min-width: 240px;
    }

    .cdl-brand__inner { padding: 36px 24px 24px; }
    .cdl-brand__foot  { padding: 16px 24px; }
    .cdl-brand__name  { font-size: 18px; }
    .cdl-panel__body  { padding: 32px 32px; }
    .cdl-panel__footer { padding-left: 32px; padding-right: 32px; }
}

/* ─────────────────────────────────────────────────────────
   MOBILE  ≤ 680px
   Brand panel sits at the TOP as a compact banner,
   form panel fills the rest below — both centred.
   ───────────────────────────────────────────────────────── */
@media (max-width: 680px) {

    /* Stack brand on top, form below (natural HTML order) */
    .cdl-split {
        flex-direction: column;
        min-height: 100vh;
    }

    /* ── Brand panel: compact horizontal banner ── */
    .cdl-brand {
        width: 100%;
        min-width: 0;
        flex-direction: row;        /* logo + text side by side */
        align-items: center;
    }

    .cdl-brand__inner {
        flex: 1;
        flex-direction: row;        /* horizontal layout */
        align-items: center;
        padding: 16px 20px;
        gap: 14px;
    }

    /* Compact logo on mobile */
    .cdl-brand__logo-wrap { margin-bottom: 0; flex-shrink: 0; }
    .cdl-brand__logo      { height: 44px; padding: 5px 10px; }

    /* Text block next to logo */
    .cdl-brand__badge    { display: none; }          /* hide badge */
    .cdl-brand__name     { font-size: 15px; margin: 0; }
    .cdl-brand__tagline  { display: none; }          /* hide tagline */
    .cdl-brand__rule     { display: none; }          /* hide rule */
    .cdl-features        { display: none; }          /* hide features */
    .cdl-brand__foot     { display: none; }          /* hide footer */

    /* ── Form panel: centred, full remaining height ── */
    .cdl-panel {
        flex: 1;
        border-left: none;
        border-top: 1px solid #e0e5ed;
    }

    .cdl-panel__body {
        padding: 24px 20px;
        align-items: center;        /* horizontally centre the form card */
        justify-content: flex-start;
        padding-top: 28px;
    }

    .cdl-panel__footer {
        padding: 14px 20px;
        justify-content: center;
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    .cdl-pf-copy { justify-content: center; }

    /* Form card: full width on mobile, centred */
    .cdl-form {
        max-width: 100%;
        padding: 24px 20px;
    }
}

/* ─────────────────────────────────────────────────────────
   VERY SMALL  ≤ 380px
   ───────────────────────────────────────────────────────── */
@media (max-width: 380px) {
    .cdl-brand__name   { font-size: 14px; }
    .cdl-panel__body   { padding: 20px 14px; }
    .cdl-form          { padding: 20px 16px; }
    .cdl-form__heading { font-size: 18px; }
}
