/* Cloud 9 Health — Auth Pages (login, logout, forgot)
 * Shared styles for all authentication pages at cloud9app.ai
 */

/* Brand Palette */
:root {
    --c9-primary: #0f4682;
    --c9-gradient-top: #0f4680;
    --c9-gradient-bottom: #092b50;
    --c9-secondary: #0faaff;
    --c9-action: #f17d09;
    --c9-action-hover: #d86e08;
    --c9-action-active: #c06207;
    --c9-gray: #434a59;
    --c9-black: #1a1a1a;
    --c9-white: #f0f0f0;
    --c9-pure-white: #ffffff;
    --c9-error-accent: #f60e34;
    --c9-success: #00a732;
    --c9-error-tint: rgba(246, 14, 52, 0.03);
    --c9-success-tint: rgba(0, 167, 50, 0.05);
    --c9-radius-card: 15px;
    --c9-radius-input: 10px;
    --c9-input-height: 55px;
    --c9-btn-height: 75px;
    --c9-action-glow: rgba(241, 125, 9, 0.15);
    --c9-primary-hover: #0c3868;

    /* Auth card vertical rhythm - single source of truth for pre-login spacing.
       Standardize gaps here; never hardcode a px gap on a page. */
    --c9-card-max-width: 450px;
    --c9-card-pad-top: 55px;
    --c9-card-pad-bottom: 43px;
    --c9-card-pad-x: 40px;
    --c9-gap-logo: 15px; /* logo to teaser */
    --c9-gap-teaser: 21px; /* teaser to first field (was 17px, +4px) */
    --c9-gap-field: 30px; /* between fields / field to pw-rules */
    --c9-gap-pw-rules: 38px; /* pw-requirements to button */
    --c9-gap-link: 45px; /* form/info to bottom link */
    --c9-card-pad-top-sm: 35px; /* mobile max-width 480px */
    --c9-card-pad-bottom-sm: 24px;
    --c9-card-pad-x-sm: 24px;
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.c9-hidden {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

/* Kill all transitions on page load to prevent label flicker */
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
    transition: none !important;
}

/* Page — hidden until fonts load, revealed by auth.js window.onload */
body {
    visibility: hidden;
    font-family: "Comfortaa", sans-serif;
    background: linear-gradient(
        to bottom,
        var(--c9-gradient-top),
        var(--c9-gradient-bottom)
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
}

/* Card Container — flex column with fixed-height slots for pixel-perfect alignment */
.auth-container {
    width: 100%;
    max-width: var(--c9-card-max-width);
    padding-top: var(--c9-card-pad-top);
    padding-right: var(--c9-card-pad-x);
    padding-bottom: var(--c9-card-pad-bottom);
    padding-left: var(--c9-card-pad-x);
    background-color: var(--c9-white);
    border: none;
    text-align: center;
    border-radius: var(--c9-radius-card);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.auth-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: var(--c9-secondary);
}

/* Compartments — auto-height, content determines card size */
.auth-slot-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.auth-slot-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--c9-gap-link);
}
/* When info section is followed directly by link/button (no form), remove extra margin */
.auth-slot-info:has(+ .auth-slot-link) .auth-message-info {
    margin-bottom: 0;
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: var(--c9-gap-logo);
}

.auth-logo img {
    width: 300px;
    height: auto;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* Password requirements checklist — change password page */
.auth-pw-rules-title {
    font-family: "Montserrat", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--c9-success);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.auth-pw-rules {
    list-style: none;
    padding: 10px 14px;
    margin: 0 auto var(--c9-gap-pw-rules);
    font-size: 14px;
    font-family: "Montserrat", sans-serif;
    font-weight: 500;
    text-align: left;
    display: inline-block;
    background: var(--c9-success-tint);
    border: 1px solid var(--c9-success);
    border-radius: 5px;
}
.auth-slot-form:has(.auth-pw-rules) {
    text-align: center;
}
.auth-pw-rules li {
    padding: 4px 0;
    color: var(--c9-gray);
    transition: color 0.2s;
}
.auth-pw-rules li i {
    color: var(--c9-gray);
    transition: color 0.2s;
}
.auth-pw-rules li.pw-met i {
    color: var(--c9-success);
    opacity: 1;
}

/* Secure sign-in label — below logo on login page */
.auth-secure-label {
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--c9-gray);
    text-align: center;
    margin-bottom: var(--c9-gap-teaser);
    letter-spacing: 2px;
}

/* Form Group (floating label) */
.form-group {
    position: relative;
    margin-bottom: var(--c9-gap-field);
}

/* Password field reveal — ghost placeholder until username typed */
.auth-pw-reveal {
    position: relative;
    pointer-events: none;
}
.auth-pw-reveal:not(.auth-pw-visible) input,
.auth-pw-reveal:not(.auth-pw-visible) label,
.auth-pw-reveal:not(.auth-pw-visible) .auth-field-icon,
.auth-pw-reveal:not(.auth-pw-visible) .auth-pw-toggle {
    opacity: 0 !important;
    pointer-events: none;
    transition: none;
}
.auth-pw-reveal.auth-pw-visible input {
    opacity: 1;
    transition: opacity 0.3s ease;
}
.auth-pw-reveal.auth-pw-visible label {
    opacity: 1;
    transition: all 0.2s ease;
}
.auth-pw-reveal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--c9-input-height);
    background: rgba(67, 74, 89, 0.07);
    border: 1px solid rgba(67, 74, 89, 0.2);
    border-radius: var(--c9-radius-input);
    transition: opacity 0.3s ease;
}
.auth-pw-reveal.auth-pw-visible {
    pointer-events: auto;
}
.auth-pw-reveal.auth-pw-visible::before {
    opacity: 0;
    pointer-events: none;
}

/* Input field icons (user, password) — hidden until focused */
.auth-input-icon input {
    transition: padding-left 0.2s;
}
.auth-input-icon:has(input:focus) input,
.auth-input-icon:has(input:not(:placeholder-shown)) input {
    padding-left: 44px;
}
.auth-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--c9-gray);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s;
}
.auth-input-icon:has(input:focus) .auth-field-icon,
.auth-input-icon:has(input:not(:placeholder-shown)) .auth-field-icon {
    opacity: 1;
}

.form-group input {
    width: 100%;
    height: var(--c9-input-height);
    padding: 0 14px;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 16px;
    border: 1px solid rgba(67, 74, 89, 0.5);
    border-radius: var(--c9-radius-input);
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
    color: var(--c9-gray);
    background: transparent;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Password show/hide toggle */
.auth-pw-field {
    position: relative;
}
.auth-pw-field input {
    padding-right: 48px;
}

/* Hide eye toggle until field has content, show when typing */
.auth-pw-field:has(input:placeholder-shown) .auth-pw-toggle {
    opacity: 0;
    pointer-events: none;
}
.auth-pw-field:has(input:not(:placeholder-shown)) .auth-pw-toggle {
    opacity: 0.5;
    pointer-events: auto;
}
.auth-pw-field:has(input:not(:placeholder-shown)) .auth-pw-toggle.pw-showing {
    opacity: 1;
}

.auth-pw-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--c9-gray);
    font-size: 18px;
    transition: opacity 0.2s;
}
.auth-pw-toggle.pw-showing {
    opacity: 0.5;
}
.auth-pw-toggle:focus-visible {
    outline: 1px solid var(--c9-gray);
    outline-offset: 4px;
    border-radius: 3px;
}
.auth-pw-toggle:hover {
    opacity: 0.8;
}

.form-group input[type="password"] {
    font-size: 22px;
    letter-spacing: 4px;
}

.form-group input[type="password"]::placeholder {
    font-size: 15px;
    letter-spacing: normal;
}

.form-group label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    font-weight: 400;
    color: rgba(67, 74, 89, 0.5);
    pointer-events: none;
    transition: all 0.2s ease;
    background-color: var(--c9-white);
    padding: 0 4px;
}

.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--c9-secondary);
}

.form-group input:focus {
    border-color: var(--c9-secondary);
    box-shadow: 0 0 0 3px rgba(15, 170, 255, 0.15);
}

/* Buttons */
.btn-auth {
    display: block;
    width: 100%;
    height: var(--c9-btn-height);
    padding: 0;
    font-family: "Montserrat", sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--c9-white);
    background: var(--c9-primary);
    border: none;
    border-radius: var(--c9-radius-input);
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    text-decoration: none;
    line-height: var(--c9-btn-height);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn-auth:focus-visible {
    outline: 1px solid var(--c9-gray);
    outline-offset: 4px;
    border-radius: var(--c9-radius-input);
}

.btn-auth:hover {
    background: var(--c9-primary-hover);
    color: var(--c9-white);
}

.btn-auth:active {
    background: var(--c9-primary-hover);
}

.btn-auth:disabled {
    background: var(--c9-gray);
    color: var(--c9-white);
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-auth:disabled:hover,
.btn-auth:disabled:active {
    background: var(--c9-gray);
    color: var(--c9-white);
    opacity: 0.5;
}

/* Trailing icon in a button (e.g. Create Password →) — gap from the text */
.btn-auth i {
    margin-left: 8px;
}

/* Outline button — navigation links styled as buttons (sign-out, etc.) */
.btn-auth-outline {
    display: block;
    width: 100%;
    height: var(--c9-btn-height);
    padding: 0;
    font-family: "Montserrat", sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--c9-primary);
    background: var(--c9-white);
    border: none;
    box-shadow: inset 0 0 0 1px var(--c9-primary);
    border-radius: var(--c9-radius-input);
    cursor: pointer;
    transition:
        color 0.2s,
        box-shadow 0.2s;
    text-align: center;
    text-decoration: none;
    line-height: var(--c9-btn-height);
}
.btn-auth-outline:hover {
    color: var(--c9-primary-hover);
    box-shadow: inset 0 0 0 1px var(--c9-primary-hover);
}
.btn-auth-outline:active {
    color: var(--c9-primary-hover);
    box-shadow: inset 0 0 0 1px var(--c9-primary-hover);
}
.btn-auth-outline:focus-visible {
    outline: 1px solid var(--c9-gray);
    outline-offset: 4px;
    border-radius: var(--c9-radius-input);
}

/* Submit spinner */
.auth-spinner {
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

/* Status icon — success/error/info full-width icons in auth-slot-info */
.auth-status-icon {
    display: block;
    margin: 20px auto 20px;
    font-size: 3em;
    text-align: center;
}
.auth-status-icon.color-success {
    color: var(--c9-success);
}
.auth-status-icon.color-error {
    color: var(--c9-error-accent);
}
.auth-status-icon.color-info {
    color: var(--c9-secondary);
}

/* Messages */
.auth-message-error {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 10px;
    background: var(--c9-error-tint);
    color: var(--c9-error-accent);
    padding: 10px 14px;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 39px;
    border: 1px solid var(--c9-error-accent);
    text-align: left;
}
.auth-message-error i {
    flex-shrink: 0;
    line-height: 1.5;
    font-size: 2em;
}
#pw-invalid-char {
    margin-top: 5px;
}

.auth-message-info {
    font-size: 16px;
    font-weight: 700;
    color: var(--c9-gray);
    margin: 0 0 var(--c9-gap-teaser);
    line-height: 1.5;
    text-align: left;
    align-self: stretch;
}

/* Teaser/intro text is bold by default via .auth-message-info (font-weight: 700),
   so every pre-login teaser is uniformly bold. .auth-msg-bold is now redundant
   (kept for existing register markup; retire in a later markup pass). Error pages
   opt back to normal weight below. */
.auth-msg-bold {
    font-weight: 700;
}
/* Error boxes (name / password validation) — bold to match the instruction text */
#reg-app .auth-message-error {
    font-weight: 700;
}

/* Links */
.auth-link {
    display: block;
    text-align: center;
    font-size: 15px;
    color: var(--c9-primary);
    text-decoration: none;
    transition: color 0.2s;
}
.auth-link i {
    display: inline-block;
    margin-right: 5px;
}

.auth-link:focus-visible {
    outline: 1px solid var(--c9-gray);
    outline-offset: 4px;
    border-radius: 3px;
}

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

/* Copyright */
.auth-copyright {
    text-align: center;
    color: var(--c9-white);
    font-size: 12px;
    line-height: 1.6;
    margin-top: 44px;
    opacity: 0.8;
}
/* ©/® render in the email's system-font stack (not Comfortaa) so the marks match
   the email footer exactly — Comfortaa renders these glyphs oversized/baseline. */
.c9-mark {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.auth-copyright-link {
    color: var(--c9-white);
    text-decoration: underline;
    transition: opacity 0.2s;
    outline: none;
}
.auth-copyright-link:focus-visible {
    outline: 1px solid var(--c9-white);
    outline-offset: 4px;
    border-radius: 3px;
}
.auth-copyright-link:hover {
    text-decoration: none;
    opacity: 1;
}

/* Error Pages (403/404/500) */
.error-link {
    color: var(--c9-primary);
    text-decoration: none;
}
.error-link:hover {
    color: var(--c9-primary);
    text-decoration: underline;
}

.error-code {
    font-size: 110px;
    font-weight: 700;
    color: var(--c9-error-accent);
    margin: 0 0 10px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.error-page .auth-message-info {
    text-align: left;
    font-size: 18px;
    font-weight: 400;
}

.error-page .auth-message-info strong {
    color: var(--c9-error-accent);
}
.error-page .auth-slot-link {
    margin-top: 35px;
}

.error-icon {
    text-align: center;
    margin: 4px 0 25px;
}

.error-icon svg,
.error-icon img {
    width: 248px;
    height: auto;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* Mobile */
@media (max-width: 480px) {
    .auth-container {
        padding-top: var(--c9-card-pad-top-sm);
        padding-right: var(--c9-card-pad-x-sm);
        padding-bottom: var(--c9-card-pad-bottom-sm);
        padding-left: var(--c9-card-pad-x-sm);
    }

    .auth-logo img {
        width: 205px;
    }
}
