/* ============================================================
   HRMS Employee Self-Registration  (Register.aspx)
   Shares the same CSS variable tokens and font scale as login.css
   so both pages feel like one product.
   ============================================================ */

/* ---------- Root tokens (same as Login.aspx) ---------- */
:root {
    --reg-bg:          #f0f4ff;
    --reg-surface:     #ffffff;
    --reg-border:      #dde3f0;
    --reg-ink:         #1a2236;
    --reg-muted:       #6b7a99;
    --reg-primary:     #4361ee;
    --reg-primary-dk:  #2d47cc;
    --reg-success:     #16a34a;
    --reg-error:       #e11d48;
    --reg-radius:      16px;
    --reg-shadow:      0 8px 32px rgba(67,97,238,.10);
    --reg-transition:  .2s ease;
}

[data-theme="dark"] {
    --reg-bg:       #0d1117;
    --reg-surface:  #161b27;
    --reg-border:   #2a3147;
    --reg-ink:      #e8eaf6;
    --reg-muted:    #8892b0;
}

/* ---------- Page shell ---------- */
html, body { min-height: 100%; margin: 0; padding: 0; }

body.hrms-register-page {
    min-height: 100%;
    background: var(--reg-bg);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    transition: background var(--reg-transition);
}

/* ---------- Theme toggle (top-right, same as login) ---------- */
.hrms-theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 999;
    background: var(--reg-surface);
    border: 1px solid var(--reg-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--reg-transition);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.hrms-theme-toggle:hover { transform: scale(1.1); }
.hrms-theme-toggle svg { width: 18px; height: 18px; stroke: var(--reg-muted); }
[data-theme="dark"] .hrms-icon-sun { display: block; }
[data-theme="dark"] .hrms-icon-moon { display: none; }
[data-theme="light"] .hrms-icon-sun,
:root .hrms-icon-sun { display: none; }
[data-theme="light"] .hrms-icon-moon,
:root .hrms-icon-moon { display: block; }

/* ---------- Card ---------- */
.hrms-reg-card {
    background: var(--reg-surface);
    border: 1px solid var(--reg-border);
    border-radius: var(--reg-radius);
    box-shadow: var(--reg-shadow);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    transition: background var(--reg-transition), border-color var(--reg-transition);
}

/* ---------- Card header (brand bar) ---------- */
.hrms-reg-header {
    background: linear-gradient(135deg, var(--reg-primary), var(--reg-primary-dk));
    padding: 28px 32px 24px;
    text-align: center;
    color: #fff;
}
.hrms-reg-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.3px;
    margin-bottom: 8px;
}
.hrms-reg-logo-mark {
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
}
.hrms-reg-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
}
.hrms-reg-header p {
    margin: 0;
    font-size: 13px;
    opacity: .82;
}

/* ---------- Progress stepper ---------- */
.hrms-reg-steps {
    display: flex;
    align-items: center;
    padding: 20px 32px 0;
    gap: 0;
}
.hrms-reg-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
}
.hrms-reg-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 16px;
    left: calc(50% + 16px);
    right: calc(-50% + 16px);
    height: 2px;
    background: var(--reg-border);
    z-index: 0;
    transition: background var(--reg-transition);
}
.hrms-reg-step.done:not(:last-child)::after {
    background: var(--reg-primary);
}
.hrms-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--reg-border);
    background: var(--reg-surface);
    color: var(--reg-muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: all var(--reg-transition);
}
.hrms-reg-step.active .hrms-step-dot {
    border-color: var(--reg-primary);
    background: var(--reg-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(67,97,238,.15);
}
.hrms-reg-step.done .hrms-step-dot {
    border-color: var(--reg-primary);
    background: var(--reg-primary);
    color: #fff;
}
.hrms-step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--reg-muted);
    text-align: center;
    white-space: nowrap;
}
.hrms-reg-step.active .hrms-step-label,
.hrms-reg-step.done .hrms-step-label {
    color: var(--reg-primary);
}

/* ---------- Card body ---------- */
.hrms-reg-body {
    padding: 24px 32px 28px;
}

/* ---------- Alert ---------- */
.hrms-reg-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
}
.hrms-reg-alert.success {
    background: rgba(22,163,74,.10);
    color: var(--reg-success);
    border: 1px solid rgba(22,163,74,.25);
}
.hrms-reg-alert.danger {
    background: rgba(225,29,72,.09);
    color: var(--reg-error);
    border: 1px solid rgba(225,29,72,.22);
}

/* ---------- Form field ---------- */
.hrms-reg-field {
    margin-bottom: 16px;
}
.hrms-reg-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--reg-ink);
    margin-bottom: 6px;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.hrms-reg-field .hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--reg-muted);
    text-transform: none;
    margin-left: 4px;
}
.hrms-reg-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--reg-border);
    border-radius: 10px;
    background: var(--reg-bg);
    color: var(--reg-ink);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--reg-transition), box-shadow var(--reg-transition);
    font-family: inherit;
}
.hrms-reg-input:focus {
    border-color: var(--reg-primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.hrms-reg-input::placeholder { color: var(--reg-muted); }
select.hrms-reg-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}
select.hrms-reg-select:disabled {
    opacity: .7;
    cursor: not-allowed;
    background-color: var(--reg-surface);
}

/* OTP inputs row */
.hrms-otp-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.hrms-otp-note {
    font-size: 12px;
    color: var(--reg-muted);
    margin-bottom: 18px;
    background: rgba(67,97,238,.06);
    border: 1px solid rgba(67,97,238,.14);
    border-radius: 8px;
    padding: 10px 12px;
    line-height: 1.5;
}
.hrms-otp-note strong { color: var(--reg-primary); }

/* ---------- Primary button ---------- */
.hrms-reg-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--reg-primary), var(--reg-primary-dk));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .3px;
    transition: opacity var(--reg-transition), transform var(--reg-transition);
    margin-top: 6px;
    font-family: inherit;
}
.hrms-reg-btn:hover { opacity: .9; transform: translateY(-1px); }
.hrms-reg-btn:active { transform: translateY(0); }

/* ---------- Footer links ---------- */
.hrms-reg-foot {
    text-align: center;
    font-size: 13px;
    color: var(--reg-muted);
    margin-top: 18px;
}
.hrms-reg-foot a {
    color: var(--reg-primary);
    font-weight: 600;
    text-decoration: none;
}
.hrms-reg-foot a:hover { text-decoration: underline; }

/* ---------- Success state ---------- */
.hrms-reg-success {
    text-align: center;
    padding: 8px 0 12px;
}
.hrms-reg-success svg {
    width: 60px;
    height: 60px;
    stroke: var(--reg-success);
    margin-bottom: 14px;
}
.hrms-reg-success h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--reg-ink);
    font-weight: 800;
}
.hrms-reg-success p {
    margin: 0 0 20px;
    font-size: 13px;
    color: var(--reg-muted);
}

@media (max-width: 540px) {
    /* Taller forms (more fields = taller card) can exceed the viewport
       height on phones. Centering a flex child that is taller than its
       container is a known source of the top of the content becoming
       impossible to scroll back up to on mobile Safari - switching to
       flex-start here keeps the card top-anchored, so the header/logo/
       stepper are always the first thing visible and everything below
       scrolls normally, with no content ever hidden above the fold. */
    body.hrms-register-page { align-items: flex-start; }
    .hrms-reg-card { border-radius: 12px; margin-top: 12px; }
    .hrms-reg-header { padding: 22px 20px 18px; }
    .hrms-reg-steps { padding: 16px 20px 0; }
    .hrms-reg-body { padding: 18px 20px 22px; }
    .hrms-otp-row { grid-template-columns: 1fr; }
}

/* ---------- Desktop: wider card + two-column field grid ----------
   Below this breakpoint (i.e. the @media (max-width: 540px) block
   above, and the default single-column rules the rest of this file
   already defines) mobile keeps its existing full-width, one-field-
   per-row layout completely unchanged - this block only widens things
   once there's actually room for two fields side-by-side.
   Targets #pnlStep1 by ID (Step 1's "Your Details" field list only),
   not a shared class, so Step 2 (OTP) and Step 3 (success) stay their
   current single-column/centered layout - they only inherit the wider
   card, which suits their short content fine. */
@media (min-width: 541px) {
    .hrms-reg-card { max-width: 760px; }

    #pnlStep1 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 20px;
    }
    /* The submit button and the "Already have an account?" footer link
       must span both columns, never get squeezed into just one. */
    #btnStep1,
    #pnlStep1 .hrms-reg-foot {
        grid-column: 1 / -1;
    }
}
