/* ==========================================================================
   Auth pages (login, 2FA, password reset) — shared stylesheet
   Theme: green primary palette, Sen display font with system fallback
   ========================================================================== */

@import url('/css/fonts.css');
:root {
    --color-primary: #0f9d58;
    --color-primary-dark: #0b7a44;
    --color-primary-light: #e6f4ea;
    --color-text: #1a1f1c;
    --color-text-muted: #5f6b64;
    --color-border: #d7e3db;
    --color-danger: #c0392b;
    --color-danger-bg: #fdecea;
    --color-surface: #ffffff;
    --color-background: #f4f8f6;
    --font-sans: 'Sen', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(15, 157, 88, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background);
    font-family: var(--font-sans);
    color: var(--color-text);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
    padding: 40px 36px;
    margin: 24px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.auth-brand-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text);
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 28px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-sans);
    font-size: 14px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s ease;
}

input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.15);
}

input.field-error {
    border-color: var(--color-danger);
}

.field-error-message {
    color: var(--color-danger);
    font-size: 12.5px;
    margin-top: 5px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}

.checkbox-row input {
    width: auto;
}

.checkbox-row label {
    margin: 0;
    font-weight: 400;
    font-size: 13.5px;
    color: var(--color-text-muted);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.35);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--color-text-muted, #555);
    border: 1.5px solid #d7dde0;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #f5f7f6;
    border-color: #c3cbcf;
}

/* Guarantor consent page (src/portal/guarantor_consent.php) */
.gc-details {
    background: #f7f9f7;
    border: 1px solid #e3e9e4;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 18px 0;
}
.gc-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.gc-row span { color: var(--color-text-muted, #666); }
.gc-decline-details { margin-top: 16px; }
.gc-decline-details summary { cursor: pointer; font-size: 13.5px; color: var(--color-text-muted, #666); text-align: center; }
.gc-decline-details summary:hover { color: var(--color-text, #333); }

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid rgba(192, 57, 43, 0.2);
}

.alert-info {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    border: 1px solid rgba(15, 157, 88, 0.2);
}

.auth-footer-link {
    text-align: center;
    margin-top: 22px;
    font-size: 13.5px;
}

.auth-footer-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer-link a:hover {
    text-decoration: underline;
}

.totp-input {
    letter-spacing: 6px;
    font-size: 20px;
    text-align: center;
    font-weight: 600;
}


/* --------------------------------------------------------------------------
   Backup / recovery codes (src/auth/backup_codes.php)
   Codes render as a two-column grid of monospace chips, matched to the
   green auth theme. The .backup-code-input reuses the auth input styling
   but widens tracking so a typed code is easy to read back.
   -------------------------------------------------------------------------- */

.backup-code-list {
    list-style: none;
    margin: 8px 0 20px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.backup-code {
    font-family: 'Courier New', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    padding: 11px 8px;
    color: var(--color-text);
    background: var(--color-primary-light);
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    user-select: all;
}


/* Optional: give the "Backup code" entry field on the login recovery page
   the same readable, spaced-out treatment as the TOTP input. Add
   class="backup-code-input" to the input in verify_2fa_backup_code.php if
   you want it; it's not required. */

.backup-code-input {
    letter-spacing: 3px;
    font-size: 17px;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
}


/* Password visibility toggle — append to auth.css */

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
}

.password-toggle:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, .05);
}

.password-toggle:focus-visible {
    outline: 2px solid #43a047;
    outline-offset: 1px;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle .icon-hide {
    display: none;
}

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

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


/* Caps Lock warning + remember-me subtext */

.field-hint {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: #64748b;
}

#caps-lock-warning {
    color: #b45309;
    /* muted amber — worth noting, not alarming */
    font-weight: 600;
}