/* Shared Site-Chrome — Header + Footer + Consent-Akzente (Single Source).
   Markup: /static/partials/site-chrome.html via /static/js/site-chrome.js.
   Verwendet auf crm-landing.html UND oauth2-proxy sign_in/error.
   Header-Optik = melleprise.com (lp4-Markup).

   Themes: site-chrome.js setzt data-chrome-theme="crm|mail|meet|phone|scraper"
   auf <html> per Hostname (oder manuell im Markup vorgeben). Property-Farben
   nur unten in den Theme-Bloecken pflegen — nie diese Datei pro Subdomain kopieren. */

:root {
    --lp4-header-h: 45px;
    --lp4-gold-a: #ffac3b;
    --lp4-gold-b: #f98e1d;
    --lp4-chrome-foot-bg: transparent;
    --lp4-chrome-fg: #fff;
    --lp4-chrome-border: rgba(255, 255, 255, 0.08);
    --lp4-chrome-stripe: rgba(255, 255, 255, 0.07);
    --lp4-chrome-hover: var(--lp4-gold-a);
    --lp4-chrome-burger: #fff;
}

/* crm = Default (slate/cyan) — auch ki-kurs und unbekannte Hosts */
:root,
:root[data-chrome-theme="crm"] {
    --lp4-chrome-top-bg: #0f172a;
    --lp4-chrome-nav-bg: #0f172a;
    --sc-cyan: #22d3ee;
    --sc-cyan-soft: #67e8f9;
    --sc-blue: #3b82f6;
    --sc-dim: #94a3b8;
    /* consent.css braucht diese lp4-Vars (definiert sonst nur in webinar-pitch-lp4.css) */
    --lp4-card: #1e293b;
    --lp4-line: rgba(148, 163, 184, 0.16);
    --lp4-text: #f8fafc;
    --lp4-text-soft: #cbd5e1;
    --sc-btn-fg: #0f172a;
}

:root[data-chrome-theme="mail"] {
    --lp4-chrome-top-bg: #130f22;
    --lp4-chrome-nav-bg: #130f22;
    --sc-cyan: #a78bfa;
    --sc-cyan-soft: #c4b5fd;
    --sc-blue: #8b5cf6;
    --sc-dim: #9d94c2;
    --lp4-card: #251d40;
    --lp4-line: rgba(168, 158, 204, 0.16);
    --lp4-text: #f7f5ff;
    --lp4-text-soft: #d5cfee;
    --sc-btn-fg: #130f22;
}

:root[data-chrome-theme="meet"] {
    --lp4-chrome-top-bg: #0c1310;
    --lp4-chrome-nav-bg: #0c1310;
    --sc-cyan: #34d399;
    --sc-cyan-soft: #6ee7b7;
    --sc-blue: #10b981;
    --sc-dim: #8fae9f;
    --lp4-card: #14201b;
    --lp4-line: rgba(148, 204, 181, 0.16);
    --lp4-text: #f2fbf6;
    --lp4-text-soft: #cfe6da;
    --sc-btn-fg: #0c1310;
}

:root[data-chrome-theme="phone"] {
    --lp4-chrome-top-bg: #07120d;
    --lp4-chrome-nav-bg: #07120d;
    --sc-cyan: #a3e635;
    --sc-cyan-soft: #bef264;
    --sc-blue: #34d399;
    --sc-dim: #7ba590;
    --lp4-card: #0e251b;
    --lp4-line: rgba(134, 239, 172, 0.16);
    --lp4-text: #eafff4;
    --lp4-text-soft: #a3c4b3;
    --sc-btn-fg: #052e1b;
}

/* scraper = Rose/Crimson („Spider Red") — frei von cyan/violett/gruen/gold */
:root[data-chrome-theme="scraper"] {
    --lp4-chrome-top-bg: #150a0e;
    --lp4-chrome-nav-bg: #150a0e;
    --sc-cyan: #fb7185;
    --sc-cyan-soft: #fda4af;
    --sc-blue: #f43f5e;
    --sc-dim: #a67f89;
    --lp4-card: #28131b;
    --lp4-line: rgba(253, 164, 175, 0.16);
    --lp4-text: #fdf1f3;
    --lp4-text-soft: #e7ccd2;
    --sc-btn-fg: #150a0e;
}

body {
    padding-top: var(--lp4-header-h);
}

/* ---------- Header ---------- */

.lp4-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    overflow: visible;
    color: var(--lp4-chrome-fg);
    font-family: Montserrat, Arial, sans-serif;
    border-bottom: 1px solid var(--lp4-chrome-border);
    background: var(--lp4-chrome-top-bg);
    backdrop-filter: blur(6px);
    transform: translateY(0);
    transition: transform 0.28s ease;
}

.lp4-top.is-hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

.lp4-top.is-open,
.lp4-top.is-open.is-hidden {
    z-index: 40;
    transform: translateY(0);
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .lp4-top {
        transition: none;
    }
}

.lp4-top-inner {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    font-weight: 700;
    letter-spacing: 0.02em;
}

.lp4-top-inner img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.lp4-top-right {
    margin-left: auto;
    min-width: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.82rem;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lp4-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.lp4-top-inner > .lp4-top-right + .lp4-nav-toggle {
    margin-left: 0;
}

.lp4-burger,
.lp4-burger::before,
.lp4-burger::after {
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: var(--lp4-chrome-burger);
    border-radius: 1px;
    transition: transform 0.4s ease, opacity 0.4s ease, top 0.4s ease;
}

.lp4-burger {
    top: 21px;
    left: auto;
    right: 0.45rem;
}

.lp4-burger::before,
.lp4-burger::after {
    content: "";
    left: 0;
}

.lp4-burger::before {
    top: -7px;
}

.lp4-burger::after {
    top: 7px;
}

.lp4-top.is-open .lp4-burger {
    background: transparent;
}

.lp4-top.is-open .lp4-burger::before {
    top: 0;
    transform: rotate(45deg);
}

.lp4-top.is-open .lp4-burger::after {
    top: 0;
    transform: rotate(-45deg);
}

.lp4-nav {
    position: absolute;
    top: 100%;
    left: auto;
    right: 0;
    width: min(20rem, 100%);
    max-width: 20rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--lp4-chrome-nav-bg);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 14px rgba(255, 255, 255, 0.12);
    max-height: 0;
    padding: 0 0.5rem;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.4s ease, opacity 0.4s ease, padding 0.4s ease;
}

.lp4-top.is-open .lp4-nav {
    max-height: 100dvh;
    padding: 0.5rem;
    opacity: 1;
    pointer-events: auto;
}

/* Drill-Down-Submenue: Klick auf „Agenten, MCPs & Tools" schiebt den Inhalt nach links */
.lp4-nav-pages {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.lp4-nav-page {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    transition: transform 0.35s ease, visibility 0.35s ease;
}

.lp4-nav-page-sub {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    background: var(--lp4-chrome-nav-bg);
    transform: translateX(100%);
    visibility: hidden;
}

.lp4-nav.is-sub .lp4-nav-page-main {
    transform: translateX(-100%);
    visibility: hidden;
}

.lp4-nav.is-sub .lp4-nav-page-sub {
    transform: translateX(0);
    visibility: visible;
}

.lp4-nav-sub-arrow { margin-left: 0.5rem; }

/* Sub-Page-Kopf: Titel („Agenten, MCPs & Tools") links, Zurück rechts */
.lp4-nav-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.lp4-nav-subtitle {
    padding: 0.9rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--lp4-chrome-fg);
    min-width: 0;
    overflow-wrap: break-word;
}

.lp4-nav-subhead .lp4-nav-back {
    width: auto;
    flex: 0 0 auto;
}

/* Back-Button: Pfeil auf Zeilenhöhe des Textes zentrieren */
.lp4-nav-back {
    display: inline-flex;
    align-items: center;
}

.lp4-nav-back-arrow {
    margin-right: 0.4rem;
}

/* Pfeile als SVG — sitzen per Flex (align-items: center am Link) exakt auf Textmitte */
.lp4-nav-sub-arrow,
.lp4-nav-back-arrow {
    flex: 0 0 auto;
    width: 1.15em;
    height: 1.15em;
    color: var(--lp4-chrome-hover);
}

.lp4-nav-page > :nth-child(even) {
    background: var(--lp4-chrome-stripe);
}

.lp4-nav-link,
.lp4-drop-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--lp4-chrome-fg);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    text-align: right;
    text-decoration: none;
    box-sizing: border-box;
    padding: 0.9rem;
    min-height: 3.2rem;
    cursor: pointer;
}

/* Icon links am Zeilenrand, Label bleibt rechts */
.lp4-nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}

.lp4-nav-icon {
    flex: 0 0 auto;
    width: 1.2em;
    height: 1.2em;
    margin-right: auto;
    opacity: 0.75;
}

.lp4-nav-link:hover,
.lp4-drop-toggle:hover {
    color: var(--lp4-chrome-hover);
}

/* Aktiver Menüpunkt (aktuelle Seite) — Akzentfarbe + fett */
.lp4-nav-link.is-active,
.lp4-nav-link[aria-current="page"] {
    color: var(--lp4-chrome-hover);
    font-weight: 700;
}

/* Tagline rechts im Header ist ein Link, sieht aber wie Text aus */
a.lp4-top-right {
    color: inherit;
    text-decoration: none;
}

a.lp4-top-right:hover {
    color: var(--lp4-chrome-hover);
}

.lp4-drop {
    position: relative;
}

.lp4-drop-list {
    position: static;
    min-width: 0;
    margin: 0 0 0.4rem;
    padding: 0;
    background: var(--lp4-chrome-nav-bg);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.4s ease, visibility 0.4s ease;
}

.lp4-drop.is-open .lp4-drop-list {
    visibility: visible;
    max-height: 16rem;
    pointer-events: auto;
}

.lp4-drop-link {
    display: block;
    padding: 0.55rem 0.75rem 0.55rem 0.2rem;
    color: var(--lp4-chrome-fg);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.lp4-drop-link.last {
    border-bottom: 0;
}

.lp4-drop-link:hover {
    color: var(--lp4-chrome-hover);
    background: rgba(255, 172, 59, 0.12);
}

.lp4-nav-langs {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    gap: 0.15rem;
    box-sizing: border-box;
    padding: 0.9rem;
    min-height: 3.2rem;
}

body.lp4-nav-lock {
    overflow: hidden;
}

/* Seitenwechsel-Loader: Overlay dimmt, Logo pulsiert (siehe site-chrome.js) */
.mp-nav-loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 8, 16, 0.68);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.mp-nav-loader.is-on {
    opacity: 1;
    pointer-events: auto;
}

/* Instant-Modus auf der Zielseite: kein Einblenden — die Seite war nie sichtbar */
.mp-nav-loader.no-anim {
    transition: none;
}

/* Pre-Paint-Cover: Inline-Script im <head> setzt .mp-nav-pre synchron,
   bevor das Chrome-JS läuft — die Zielseite ist ab dem ersten Frame
   verdeckt (kein Flackern/Lücke). Optik identisch zum .mp-nav-loader. */
html.mp-nav-pre::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: rgba(4, 8, 16, 0.68) url("/static/img/melleprise-ai-logo.png") center / 96px 96px no-repeat;
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.mp-nav-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.mp-nav-loader-logo {
    width: 96px;
    height: 96px;
    object-fit: contain;
    animation: mp-nav-pulse 1.15s ease-in-out infinite;
}

@keyframes mp-nav-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
    50% {
        transform: scale(1.09);
        filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.55));
    }
}

@media (prefers-reduced-motion: reduce) {
    .mp-nav-loader-logo {
        animation: none;
    }
}

.lp4-nav-lang {
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.15rem;
    cursor: pointer;
    display: none;
    align-items: center;
    text-decoration: none;
}

.lp4-nav-lang[aria-pressed="false"] {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.lp4-nav-lang > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.lp4-nav-close {
    display: none;
    color: var(--lp4-chrome-fg);
}

.lp4-nav-close-x::before,
.lp4-nav-close-x::after {
    background: var(--lp4-chrome-burger);
}

/* Ergaenzungen zum lp4-Markup (Brand-Link, Mobile-Toolbar, User-Zeile) */

.lp4-brand-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: inherit;
}

.lp4-brand-short { display: none; }

.lp4-nav-toolbar { display: none; }

.lp4-nav-user {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    flex: 0 1 auto;
    min-width: 0;
    margin-right: auto;
    color: inherit;
    text-decoration: none;
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
}

.lp4-nav-user span {
    color: var(--lp4-chrome-fg);
}

.lp4-nav-user:hover span { color: var(--lp4-chrome-hover); }

@media (prefers-reduced-motion: reduce) {
    .lp4-burger,
    .lp4-burger::before,
    .lp4-burger::after,
    .lp4-drop-list,
    .lp4-nav,
    .lp4-nav-page {
        transition: none;
    }
}

@media (max-width: 720px) {
    :root {
        --lp4-header-h: 4rem;
    }

    .sc-wrap {
        padding: 0 0.6rem;
    }

    .lp4-top-inner {
        height: var(--lp4-header-h);
        min-height: var(--lp4-header-h);
    }

    .lp4-top-inner > .lp4-brand-link .lp4-brand { display: none; }
    .lp4-top-inner > .lp4-brand-link .lp4-brand-short { display: inline; }
    .lp4-top-right { font-size: 0.72rem; }

    .lp4-nav-toolbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        width: 100%;
        height: var(--lp4-header-h);
        padding: 0 0.85rem;
        box-sizing: border-box;
        background: rgba(255, 255, 255, 0.05);
        border-bottom: 1px solid var(--lp4-chrome-border);
    }

    .lp4-nav-toolbar .lp4-brand { display: inline; }
    .lp4-nav-toolbar .lp4-brand-short { display: none; }

    .lp4-nav-toolbar .lp4-nav-close {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }

    .lp4-nav {
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        padding: 0;
        z-index: 6;
    }

    .lp4-top.is-open .lp4-nav {
        height: 100dvh;
        min-height: 100dvh;
        max-height: 100dvh;
        padding: 0;
        overflow-y: auto;
    }

    .lp4-nav-close {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 0 0 auto;
        width: 100%;
        height: 4.5rem;
        margin: 0;
        padding: 0 0.85rem;
        border: 0;
        background: transparent;
        color: var(--lp4-chrome-fg);
        cursor: pointer;
    }

    .lp4-nav-close-x {
        position: relative;
        width: 2rem;
        height: 2rem;
        flex-shrink: 0;
    }

    .lp4-nav-close-x::before,
    .lp4-nav-close-x::after {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 2rem;
        height: 3px;
        background: var(--lp4-chrome-burger);
        border-radius: 1px;
    }

    .lp4-nav-close-x::before {
        transform: rotate(45deg);
    }

    .lp4-nav-close-x::after {
        transform: rotate(-45deg);
    }

    .lp4-nav-link,
    .lp4-drop-toggle {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 1 1 0;
        min-height: 0;
        padding: 0 1.2rem;
        box-sizing: border-box;
        font-size: min(5.8vw, 1.7rem);
        white-space: nowrap;
    }

    .lp4-nav-lang {
        font-size: 2.5rem;
    }

    .lp4-nav-langs {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex: 1 1 0;
        min-height: 0;
        padding: 0 1.2rem;
        box-sizing: border-box;
        gap: 0.4rem;
        font-size: min(5.8vw, 1.7rem);
        white-space: nowrap;
    }

    .lp4-nav-user {
        padding: 0;
    }
}

/* ---------- Footer ---------- */

.sc-foot {
    color: var(--lp4-chrome-fg);
    font-family: Montserrat, Arial, sans-serif;
    background: var(--lp4-chrome-foot-bg, transparent);
    border-top: 1px solid var(--lp4-chrome-border);
    padding: 1.3rem 0 1.8rem;
    margin-top: auto;
    flex-shrink: 0;
    width: 100%;
}

.sc-wrap {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.sc-foot-inner {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.sc-foot a {
    color: var(--sc-dim);
    text-decoration: none;
}

.sc-foot-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.9rem;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, var(--lp4-chrome-fg, #e2e8f0) 45%, transparent);
}

.sc-foot-legal img {
    display: block;
    opacity: 0.6;
    border-radius: 4px;
}

@media (max-width: 720px) {
    .sc-foot-inner {
        gap: 0.4rem 1.2rem;
    }

    .sc-foot-inner a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-size: 0.85rem;
    }
}

/* ---------- Buttons im Chrome-Kontext (Consent) ---------- */

.lp4-btn {
    border: 0;
    border-radius: 0;
    font: inherit;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    color: #1a1004;
    background: linear-gradient(180deg, var(--lp4-gold-a), var(--lp4-gold-b));
    box-shadow: 0 10px 26px rgba(249, 142, 29, 0.35);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 48px;
    padding: 0 1.2rem;
}

.lp4-btn:hover {
    filter: brightness(1.05);
}

/* Consent-Modal an Chrome-Farben angepasst (cyan) */

.mp-consent-card a,
.mp-consent-link {
    color: var(--sc-cyan);
}

.mp-consent-reject:hover,
.mp-consent-link:hover {
    color: var(--sc-cyan-soft);
}

.mp-consent-actions .lp4-btn {
    background: linear-gradient(90deg, var(--sc-blue), var(--sc-cyan));
    color: var(--sc-btn-fg);
    box-shadow: none;
}

.mp-consent-card:focus-visible,
.mp-consent-card a:focus-visible,
.mp-consent-reject:focus-visible,
.mp-consent-link:focus-visible,
.mp-consent-actions .lp4-btn:focus-visible,
.mp-consent-row input:focus-visible {
    outline-color: var(--sc-cyan);
}

/* hidden-Attribut gewinnt immer über display-Regeln */
[hidden]{display:none!important}
