/* =============================================================================
   OTS.blue — Auth stylesheet (login and Shield auth views)
   Self-contained: the auth layout loads this file only (no Bootstrap, no
   app.css). Structure ported from the Talos login design, re-skinned with
   the OTS.blue palette. Token values mirror public/css/app.css by name.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand (from --ots-brand / --ots-brand-dark) */
    --color-primary: #1a73e8;
    --color-primary-light: #4285f4;
    --color-primary-dark: #0d47a1;
    --color-secondary: #1a73e8;
    --color-accent: #4fc3f7;

    /* Hero gradient stops (from --ots-header-*) */
    --auth-hero-start: #1a237e;
    --auth-hero-mid1: #0d47a1;
    --auth-hero-mid2: #1565c0;
    --auth-hero-end: #1976d2;

    /* Surfaces and borders (from --ots-surface-* / --ots-border*) */
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-subtle: rgba(0, 0, 0, 0.05);

    /* Text (from --ots-ink*) */
    --color-text: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;

    /* Semantic (from --ots-success/warning/danger/info) */
    --color-success: #16a34a;
    --color-success-bg: #dcfce7;
    --color-warning: #d97706;
    --color-warning-bg: #fef3c7;
    --color-error: #dc2626;
    --color-error-bg: #fee2e2;
    --color-info: #2563eb;
    --color-info-bg: #dbeafe;

    /* Shape and depth */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-md: 1rem;

    /* Motion */
    --transition-fast: 120ms ease;
}

/* -----------------------------------------------------------------------------
   2. Base / reset
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    overflow: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 12px;
}

input,
select {
    height: 36px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.18);
    outline: none;
}

/* -----------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 0 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.button:disabled {
    opacity: 0.65;
    cursor: default;
}

.button--primary {
    background: var(--color-primary);
    color: #fff;
}

.button--primary:hover:not(:disabled) {
    background: var(--color-primary-light);
}

.button--block {
    width: 100%;
}

.button--microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #fff;
    border-color: var(--color-border);
    color: var(--color-text);
    font-weight: 600;
}

.button--microsoft:hover {
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-sm);
}

.button--microsoft:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

.ms-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
   4. Alerts
   -------------------------------------------------------------------------- */
.alert {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.alert--success {
    border-left: 4px solid var(--color-success);
    background: var(--color-success-bg);
}

.alert--warning {
    border-left: 4px solid var(--color-warning);
    background: var(--color-warning-bg);
}

.alert--error {
    border-left: 4px solid var(--color-error);
    background: var(--color-error-bg);
}

.alert--info {
    border-left: 4px solid var(--color-info);
    background: var(--color-info-bg);
}

.alert__list {
    margin: 0;
    padding-left: 18px;
}

/* -----------------------------------------------------------------------------
   5. Form grid
   -------------------------------------------------------------------------- */
.form-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid--compact {
    gap: 16px;
}

.form-grid__full {
    grid-column: 1 / -1;
}

.form-grid span {
    color: var(--color-text-secondary);
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: 8px;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--color-primary);
}

.checkbox-field span {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* -----------------------------------------------------------------------------
   6. Auth shell (split screen)
   -------------------------------------------------------------------------- */
.auth-body {
    overflow: auto;
}

.auth-shell {
    display: flex;
    min-height: 100vh;
}

.auth-hero {
    flex: 1 1 55%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(ellipse 90% 70% at 15% 10%, rgba(79, 195, 247, 0.20), transparent 60%),
        linear-gradient(160deg, var(--auth-hero-start), var(--auth-hero-mid1) 40%, var(--auth-hero-mid2) 70%, var(--auth-hero-end));
}

.auth-hero__brand {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-hero__eyebrow {
    margin: 0;
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.auth-hero__wordmark {
    margin: 0;
    font-size: clamp(2.25rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.auth-hero__tagline {
    margin: 0;
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.78);
    max-width: 42ch;
}

.auth-hero__art {
    position: absolute;
    right: -40px;
    bottom: -20px;
    width: min(560px, 85%);
    height: auto;
    pointer-events: none;
}

.auth-main {
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: var(--color-bg);
}

.auth-column {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-column .alert {
    margin: 0;
}

/* -----------------------------------------------------------------------------
   7. Auth card
   -------------------------------------------------------------------------- */
.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-subtle);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 16px 40px -12px rgba(13, 71, 161, 0.18);
}

.auth-card__section-label {
    margin: 0 0 10px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-links {
    margin: 16px 0 0;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.auth-links a {
    color: var(--color-primary);
    font-weight: 500;
}

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

.auth-disclaimer {
    margin: 0;
    font-size: var(--font-size-xs);
    line-height: 1.5;
    color: var(--color-text-muted);
    text-align: center;
}

.auth-disclaimer strong {
    display: block;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

/* -----------------------------------------------------------------------------
   8. Compact brand header (mobile)
   -------------------------------------------------------------------------- */
.auth-compact-brand {
    display: none;
}

.auth-compact-brand__mark {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.auth-compact-brand__copy {
    display: flex;
    flex-direction: column;
}

.auth-compact-brand__wordmark {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
}

/* -----------------------------------------------------------------------------
   9. Password show/hide toggle
   -------------------------------------------------------------------------- */
.password-field {
    position: relative;
}

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

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
}

.password-toggle:hover {
    color: var(--color-text-secondary);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: -2px;
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

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

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

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* -----------------------------------------------------------------------------
   10. Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    @keyframes auth-rise {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
    }

    .auth-card {
        animation: auth-rise 0.45s ease-out 0.08s backwards;
    }

    .auth-hero__brand {
        animation: auth-rise 0.55s ease-out backwards;
    }
}

/* -----------------------------------------------------------------------------
   11. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .auth-hero {
        display: none;
    }

    .auth-main {
        display: block;
        padding: 0;
    }

    .auth-compact-brand {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 22px 16px;
        background:
            radial-gradient(ellipse 120% 160% at 10% 0%, rgba(79, 195, 247, 0.20), transparent 60%),
            linear-gradient(160deg, var(--auth-hero-start), var(--auth-hero-mid1) 50%, var(--auth-hero-end));
    }

    .auth-column {
        margin: 28px auto 0;
        padding: 0 16px 48px;
    }
}

@media (max-width: 640px) {
    .auth-card input,
    .auth-card .button {
        min-height: 44px;
    }
}
