/* ==========================================================================
   AkademIQ - instance branding surfaces (v0.28.0-rc1, INSTITUTION-BRANDING-001, ADR 0031)
   Layout of the institution's identity (logo, name, footer, "Powered by AkademIQ") and of the personalization page.
   Colours are NEVER set here from branding data - they come only from the design-system tokens, which the instance branding overrides with validated values.
   ========================================================================== */

/* ---- top bar: institution logo + name -------------------------------------- */
.app-topbar__title {
    min-width: 0;
}

.app-topbar__title--with-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.app-topbar__logo {
    max-height: 2.5rem;
    max-width: 9rem;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.app-topbar__title h1 {
    overflow-wrap: anywhere;
}

.app-topbar__title-text {
    min-width: 0;
}

/* ---- sidebar brand ---------------------------------------------------------- */
/* The scoped NavMenu rule (.nav-brand__mark[b-...]) sizes the standard square mark; the institution's own (usually wide) logo needs a more specific rule to keep its proportions. */
.nav-brand img.nav-brand__mark--custom {
    width: auto;
    max-width: 9rem;
    height: 2.4rem;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

.nav-brand .nav-brand__name--clip {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- footer ---------------------------------------------------------------- */
.app-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-xs) var(--space-lg);
    padding: var(--space-md) 2rem;
    border-top: var(--border-width) solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-caption-size);
    line-height: 1.5;
}

.app-footer__text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-footer__text a {
    margin-left: var(--space-sm);
}

.app-footer__powered {
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* ---- login card ------------------------------------------------------------ */
/* app.css loads after this file and sizes the standard mark; a more specific selector keeps the institution's own logo proportional. */
.login-card__brand img.login-card__mark--custom {
    width: auto;
    max-width: 9rem;
    height: 3rem;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

.login-card__brand h1 {
    overflow-wrap: anywhere;
}

.login-card__powered {
    margin: var(--space-xs) 0 0;
    text-align: center;
    font-size: var(--text-caption-size);
    color: var(--color-text-muted);
}

.login-card__institution-footer {
    margin: var(--space-sm) 0 0;
    text-align: center;
    font-size: var(--text-caption-size);
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

/* ---- personalization page --------------------------------------------------- */
.branding-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-lg);
    align-items: start;
}

@media (max-width: 960px) {
    .branding-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.branding-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
    margin-bottom: var(--space-md);
}

.branding-color {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.branding-color input[type="color"] {
    width: 3rem;
    height: var(--control-h-md);
    padding: 0.15rem;
    cursor: pointer;
}

.branding-color input[type="text"] {
    width: 8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.branding-asset {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.branding-asset__image {
    max-width: 12rem;
    max-height: 4rem;
    object-fit: contain;
    border: var(--border-width) dashed var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: var(--space-2xs);
    background: var(--color-surface);
}

/* v0.28.0-rc3 (INSTITUTION-BRANDING-LIVE-PREVIEW-BASE-COLOR-001): the preview is a self-contained scope. The calculated tokens arrive as an inline style on this element, but the ALIASES that
   components read (--color-primary, -hover, -active, --color-info-*, --brand-*) are declared on :root as var(...) and a custom property that uses var() is computed where it is declared - so
   an element inside the preview would inherit the aliases already resolved against the ACTIVE branding and ignore the draft (the .btn showed the saved colour until Save).
   Re-declaring them here resolves them against the tokens of THIS element. The defaults of the calculated tokens are repeated too, so a colour left empty previews the standard theme (what
   Save would produce) instead of the active branding. Nothing here may differ from tokens.css :root - BrandingPreviewScopeTests keeps both in step. The page itself is never touched. */
.branding-preview {
    --color-primary-50: #eef1fe;
    --color-primary-100: #e3e9ff;
    --color-primary-400: #5b6de0;
    --color-primary-500: #3b4fd6;
    --color-primary-600: #2f3fb5;
    --color-primary-700: #28349c;
    --color-on-primary: #ffffff;
    --color-text-on-primary: #ffffff;
    --color-primary-text: var(--color-primary-500);
    --color-hero-start: var(--color-surface-inverse);
    --color-hero-end: var(--color-primary-700);
    --focus-ring-color: var(--color-primary);
    --color-surface-inverse: #14213d;
    --color-surface-inverse-deep: #101a33;
    --color-text-on-inverse: #dbe1f4;
    --color-text-on-inverse-muted: #8b96b8;
    --color-border-on-inverse: rgba(255, 255, 255, 0.08);
    --color-inverse-hover: rgba(255, 255, 255, 0.08);
    --focus-ring-color-on-inverse: #8ab4ff;
    --color-on-inverse-strong: #ffffff;
    --color-surface-inverse-darkest: #0b1428;
    --color-accent-500: #0d9488;
    --color-accent-600: #0b7c72;
    --color-accent-subtle: #e3f6f3;
    --color-accent-text: var(--color-accent-600);
    --color-on-accent: #ffffff;

    --color-primary: var(--color-primary-500);
    --color-primary-hover: var(--color-primary-600);
    --color-primary-active: var(--color-primary-700);
    --color-primary-subtle: var(--color-primary-50);
    --color-primary-subtle-strong: var(--color-primary-100);
    --color-info-bg: var(--color-primary-50);
    --color-info-text: var(--color-primary-text);
    --color-info-solid: var(--color-primary-500);
    --brand-primary: var(--color-primary);
    --brand-primary-hover: var(--color-primary-hover);
    --brand-primary-contrast: var(--color-on-primary);
    --brand-secondary: var(--color-surface-inverse);
    --brand-secondary-contrast: var(--color-text-on-inverse);
    --brand-accent: var(--color-accent-500);
    --brand-accent-contrast: var(--color-on-accent);
    --brand-header-bg: var(--color-surface-inverse);
    --brand-header-text: var(--color-on-inverse-strong);
    --brand-link: var(--color-primary-text);
    --brand-focus: var(--focus-ring-color);

    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface);
}

.branding-preview__bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-inverse);
    color: var(--color-on-inverse-strong);
    font-weight: 700;
}

.branding-preview__bar img {
    max-height: 2rem;
    max-width: 7rem;
    object-fit: contain;
}

.branding-preview__bar span {
    overflow-wrap: anywhere;
}

.branding-preview__body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    background: var(--color-canvas);
}

.branding-preview__nav-item {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-600) 100%);
    color: var(--color-on-primary);
    font-weight: 700;
    border-left: 3px solid var(--color-accent-500);
    width: fit-content;
}

.branding-preview__focus {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
    background: var(--color-surface);
    width: fit-content;
}

.branding-preview__card {
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.branding-preview__card h4 {
    margin: 0 0 var(--space-3xs);
    color: var(--color-accent-text);
}

.branding-report {
    margin: 0;
    padding-left: var(--space-md);
    font-size: var(--text-compact-size);
}

/* ---- professional profile --------------------------------------------------- */
.professional-profile__source {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    background: var(--color-neutral-bg);
    color: var(--color-text-secondary);
    font-size: var(--text-caption-size);
    font-weight: 600;
}

.professional-profile__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.professional-profile__item {
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface);
    overflow-wrap: anywhere;
}

.professional-profile__item h4 {
    margin: 0;
}

.professional-profile__meta {
    margin: var(--space-3xs) 0;
    color: var(--color-text-secondary);
    font-size: var(--text-compact-size);
}

.professional-profile__actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
    flex-wrap: wrap;
}

.professional-profile__competencies {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    list-style: none;
    margin: 0;
    padding: 0;
}

.professional-profile__chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-full);
    background: var(--color-primary-subtle);
    color: var(--color-text-primary);
    font-size: var(--text-compact-size);
    overflow-wrap: anywhere;
}

.professional-profile__form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: var(--space-sm) var(--space-md);
    margin-top: var(--space-sm);
}

.professional-profile__form .wide {
    grid-column: 1 / -1;
}

.professional-profile__form label {
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
    font-size: var(--text-label-size);
    font-weight: var(--text-label-weight);
}

.cv-professional h3,
.cv-professional h4 {
    margin-bottom: var(--space-2xs);
}
