/**
 * CASEC C3 - Login Page Styles
 * Based on Figma design (CASEC prototyp, node 724:61436)
 */

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

:root {
    /*
     * Server-rendered auth pages run on the authorization connector and cannot load the Vaadin
     * theme. These tokens mirror the canonical CASEC scale in the FE theme; the typography
     * contract test fails if either side diverges.
     */
    --cs-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --cs-font-size-caption: 12px;
    --cs-font-size-compact: 13px;
    --cs-font-size-body: 14px;
    --cs-font-size-body-prominent: 16px;
    --cs-font-size-title: 24px;
    --cs-font-size-page-title: 30px;
    --cs-font-weight-regular: 400;
    --cs-font-weight-medium: 500;
    --cs-font-weight-semibold: 600;
    --cs-font-weight-bold: 700;
    --casec-brand-primary: #12374f;
    --casec-brand-primary-hover: #0f3450;
    --casec-brand-primary-active: #0a2639;
    --casec-brand-link: #144566;
    --casec-brand-link-hover: #0f3450;
    --casec-brand-link-focus: rgba(20, 69, 102, 0.18);
}

body {
    font-family: var(--cs-font-family-sans);
    background: white;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.login-container {
    background: white;
    width: 100%;
    max-width: 398px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo {
    width: 185px;
    height: auto;
    margin-bottom: 40px;
}

.login-header h1 {
    color: #101828;
    font-size: var(--cs-font-size-page-title);
    font-weight: var(--cs-font-weight-bold);
    margin-bottom: 12px;
    line-height: 38px;
}

.login-header p {
    color: #475467;
    font-size: var(--cs-font-size-body-prominent);
    font-weight: var(--cs-font-weight-regular);
    line-height: 24px;
}

/* Alert Styles */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: var(--cs-font-size-body);
    line-height: 1.5;
}

.alert-error {
    background-color: #fff3f3;
    border: 1px solid #ffdddd;
    color: #d32f2f;
}

.alert-success {
    background-color: #f0f9ff;
    border: 1px solid #bfdbfe;
    color: #1976d2;
}

.alert strong {
    display: block;
    margin-bottom: 4px;
    font-weight: var(--cs-font-weight-semibold);
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: rgba(27, 43, 65, 0.69);
    font-weight: var(--cs-font-weight-medium);
    font-size: var(--cs-font-size-body);
    line-height: 17px;
}

.form-group input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: none;
    border-radius: 4px;
    font-size: var(--cs-font-size-body-prominent);
    font-weight: var(--cs-font-weight-medium);
    line-height: 22px;
    color: rgba(25, 39, 57, 0.94);
    transition: background-color 0.2s;
    background: rgba(26, 56, 96, 0.1);
    font-family: inherit;
}

.form-group input::placeholder {
    color: rgba(27, 43, 65, 0.69);
    font-weight: var(--cs-font-weight-medium);
}

.form-group input:focus {
    outline: none;
    background: rgba(26, 56, 96, 0.16);
}

.form-group input:hover:not(:focus) {
    background: rgba(26, 56, 96, 0.13);
}

/* Password visibility toggle */
.password-wrapper {
    position: relative;
    display: block;
}

/* Room for the eye so the value never runs under it. */
.password-wrapper input {
    padding-right: 40px;
}

.password-toggle {
    font-family: inherit;
    font-size: var(--cs-font-size-body);
    font-weight: var(--cs-font-weight-regular);
    position: absolute;
    top: 0;
    right: 0;
    height: 36px;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: rgba(27, 43, 65, 0.69);
    cursor: pointer;
    border-radius: 4px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.password-toggle:hover {
    color: var(--casec-brand-primary);
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--casec-brand-link-focus);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
    pointer-events: none;
}

.password-toggle svg[hidden] {
    display: none;
}

.password-hint {
    display: block;
    margin-top: 8px;
    color: #6b7280;
    font-size: var(--cs-font-size-caption);
    line-height: 1.5;
}

.password-hint ul {
    margin: 4px 0 0 18px;
    padding: 0;
}

.auth-link,
.forgot-password {
    display: inline-block;
    margin-top: 8px;
    color: var(--casec-brand-link);
    font-size: var(--cs-font-size-body);
    line-height: 20px;
    text-decoration: none;
    font-weight: var(--cs-font-weight-semibold);
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
}

.auth-link:hover,
.forgot-password:hover {
    color: var(--casec-brand-link-hover);
    text-decoration: underline;
}

.auth-link:focus-visible,
.forgot-password:focus-visible {
    outline: none;
    background: var(--casec-brand-link-focus);
    box-shadow: 0 0 0 3px var(--casec-brand-link-focus);
}

/* Button Styles */
/* The SSO buttons sit outside the form (CAS-919) but continue its column of buttons, so they keep the
   same 12px rhythm: the gap between them and the margin that separates them from the form's last one. */
.button-group,
.federation-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.federation-section {
    margin-top: 12px;
}

.submit-btn,
.secondary-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: var(--cs-font-size-body);
    font-weight: var(--cs-font-weight-semibold);
    line-height: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    display: block;
}

.submit-btn {
    background: var(--casec-brand-primary);
    color: white;
    border: none;
    box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05),
        inset 0 0 0 1px rgba(16, 24, 40, 0.18),
        inset 0 -2px 0 0 rgba(16, 24, 40, 0.05);
}

.submit-btn:hover {
    background: var(--casec-brand-primary-hover);
}

.submit-btn:active {
    background: var(--casec-brand-primary-active);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: white;
    color: #344054;
    border: 1px solid #d0d5dd;
    box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
}

.secondary-btn:hover {
    background: #f9fafb;
}

.secondary-btn:active {
    background: #f2f4f7;
}

/* Footer Styles */
.login-footer {
    margin-top: 40px;
    text-align: center;
    font-size: var(--cs-font-size-compact);
    color: #999;
}

/* Responsive Design */
@media (max-width: 480px) {
    body {
        padding: 40px 24px;
    }

    .login-header h1 {
        font-size: var(--cs-font-size-title);
        line-height: 32px;
    }

    .login-header .logo {
        width: 150px;
        margin-bottom: 32px;
    }
}

/* CAS-1570: auth pages share the application's high-contrast keyboard frame. */
:focus-visible {
    outline: 2px solid #17628c !important;
    outline-offset: -2px !important;
    box-shadow: inset 0 0 0 4px white !important;
}
