/*
 * credentry-portal-overrides.css — Credentry-host supplement to the shared SDK stylesheet.
 *
 * Load order: AFTER _content/Credentry.Sdk.Ui/css/credentry-ui.css (the design system) and
 * BEFORE CE.Portal.Admin.styles.css (the scoped bundle), mirroring the old app.css cascade.
 *
 * WHY THIS FILE EXISTS: the SDK scopes its base reset/typography under `.ce-app` so it never
 * bleeds into a host's non-shell markup. Four Credentry pages render OUTSIDE the `.ce-app`
 * shell (Login / SsoCallback / InviteAccept via LoginLayout, and EmbedViewer via EmbedLayout),
 * so this file carries the UNSCOPED base block — verbatim from the retired app.css — to keep
 * those pages pixel-identical (DM Sans, teal links, gray page background, print colors).
 *
 * Everything else that used to live in app.css exists identically in the SDK stylesheet
 * (verified rule-by-rule, 2026-07-02). Do NOT add `.ce-*` component rules here — shared
 * component styling belongs in the SDK (see docs/integration/14-PORTAL-SDK-ASSESSMENT-AND-
 * HARDENING-PLAN.md, "SDK-first" governance).
 *
 * SOLE EXCEPTION — the `.ce-login-*` auth shell below. Those rules used to live in a page-local
 * `<style>` block inside Login.razor, which means they only exist in the DOM while THAT page is
 * rendered. SsoCallback and InviteAccept mark up the same shell classes, so they rendered with no
 * card, no page padding and viewport-wide buttons. The auth shell is host-owned markup (these
 * three Credentry pages), so it lives here rather than in the SDK; the SDK already carries the
 * dark-mode variants (`[data-theme="dark"] .ce-login-card`) and `.ce-login-logo-img`, so the two
 * halves must stay in agreement.
 */

/* --- Base Reset & Typography (unscoped — pages outside .ce-app) --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* Scroll margin for anchor targets (accounts for sticky header) */
[id] {
    scroll-margin-top: calc(var(--header-height) + var(--ce-space-6));
}

body {
    font-family: var(--ce-tenant-font, var(--ce-font-sans));
    font-size: var(--ce-font-size, 0.9375rem);
    font-weight: var(--ce-font-weight, 400);
    line-height: 1.6;
    color: var(--ce-text-secondary);
    background-color: var(--ce-bg-secondary);
    margin: 0;
    padding: 0;
    transition: background-color var(--ce-transition-slow), color var(--ce-transition-slow);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ce-font-heading, inherit);
    font-weight: 600;
    color: var(--ce-text-primary);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 1.875rem; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--ce-teal);
    text-decoration: none;
    transition: color var(--ce-transition-fast);
}

a:hover {
    color: var(--ce-link-hover, var(--ce-teal-dark));
}

code {
    font-family: var(--ce-font-mono);
    font-size: 0.85em;
    padding: 0.125rem 0.375rem;
    background: var(--ce-gray-100);
    border-radius: var(--ce-radius-sm);
    color: var(--ce-teal-dark);
}

h1:focus { outline: none; }

/* --- Auth Shell (Login / SsoCallback / InviteAccept — all render outside .ce-app) --- */
.ce-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2744 0%, #0f172a 100%);
    padding: var(--ce-space-4);
}

.ce-login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: var(--ce-radius-xl);
    padding: var(--ce-space-8);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.ce-login-header {
    text-align: center;
    margin-bottom: var(--ce-space-8);
}

.ce-login-logo {
    margin-bottom: var(--ce-space-4);
}

.ce-login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ce-text-primary);
    margin: 0 0 var(--ce-space-2);
}

.ce-login-subtitle {
    font-size: 0.875rem;
    color: var(--ce-text-muted);
    margin: 0;
}

.ce-alert {
    display: flex;
    align-items: center;
    gap: var(--ce-space-2);
    padding: var(--ce-space-3) var(--ce-space-4);
    border-radius: var(--ce-radius-md);
    margin-bottom: var(--ce-space-4);
    font-size: 0.875rem;
}

.ce-alert-error {
    background: var(--ce-danger-light);
    color: var(--ce-badge-danger-text, #991b1b);
    border: 1px solid var(--ce-danger);
}

.ce-alert-success {
    background: var(--ce-success-light);
    color: var(--ce-badge-success-text, #065f46);
    border: 1px solid var(--ce-success);
}

/* SSO Section */
.ce-sso-section {
    display: flex;
    flex-direction: column;
    gap: var(--ce-space-2);
    margin-bottom: var(--ce-space-4);
}

.ce-btn-sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--ce-space-2);
    width: 100%;
    padding: var(--ce-space-3) var(--ce-space-4);
    border: 1px solid var(--ce-border-primary);
    border-radius: var(--ce-radius-md);
    background: var(--ce-bg-primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ce-text-secondary);
    font-family: var(--ce-font-sans);
    transition: all var(--ce-transition-fast);
}

.ce-btn-sso:hover:not(:disabled) {
    background: var(--ce-bg-secondary);
    border-color: var(--ce-border-secondary);
}

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

.ce-btn-sso svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Divider */
.ce-login-divider {
    display: flex;
    align-items: center;
    margin-bottom: var(--ce-space-4);
    color: var(--ce-text-muted);
    font-size: 0.75rem;
}

.ce-login-divider::before,
.ce-login-divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--ce-border-primary);
}

.ce-login-divider span {
    padding: 0 var(--ce-space-3);
    white-space: nowrap;
}

/* Print rules for content OUTSIDE .ce-app (the SDK scopes its versions to .ce-app). */
@media print {
    canvas {
        max-width: 100% !important;
    }

    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
