/* =========================================================
   CPB Public Pages — Seiten außerhalb des Perfex-Logins
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --cpb-primary: #1a3a5c;
    --cpb-primary-rgb: 26,58,92;
    --cpb-bg: #f4f6f9;
    --cpb-text: #333;
    --cpb-header-height: 64px;
}

html, body { margin: 0; padding: 0; }

body.cpb-public-page {
    font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--cpb-text);
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────── */
.cpb-public-header {
    background: var(--cpb-primary);
    height: var(--cpb-header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.cpb-public-header-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cpb-public-logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

.cpb-site-name {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

/* ── Navigation ─────────────────────────────────────────── */
.cpb-public-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cpb-btn-nav {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,.85);
    border: 2px solid rgba(255,255,255,.35);
    transition: all .15s ease;
}

.cpb-btn-nav:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.6);
}

.cpb-btn-nav-primary {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.7);
    color: #fff;
}

.cpb-btn-nav-primary:hover {
    background: #fff;
    color: var(--cpb-primary);
    border-color: #fff;
}

/* Alias für Template-Nutzung */
.cpb-public-nav a {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: rgba(255,255,255,.85);
    border: 2px solid rgba(255,255,255,.35);
    transition: all .15s ease;
}
.cpb-public-nav a:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.6);
}
.cpb-public-nav a.cpb-btn-primary,
.cpb-btn-primary {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.7);
    color: #fff;
}
.cpb-public-nav a.cpb-btn-primary:hover,
.cpb-btn-primary:hover {
    background: #fff;
    color: var(--cpb-primary);
    border-color: #fff;
}


/* ── Main Content ────────────────────────────────────────── */
.cpb-public-main {
    flex: 1;
    padding: 0;
}

/* Footer/Header Blöcke: volle Breite aus dem main-Padding herausbrechen */
.cpb-public-main:has(> #cpb-footer),
.cpb-public-main:has(#cpb-footer) {
    padding-bottom: 0 !important;
}
.cpb-public-main:has(#cpb-header) {
    padding-top: 0 !important;
}
.cpb-public-main #cpb-footer {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
}
.cpb-public-main #cpb-header {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    width: 100%;
}
/* Kein Default-Footer wenn GrapeJS-Footer vorhanden */
body.cpb-grapes-has-footer .cpb-public-footer { display: none; }

/* Wenn GrapeJS Footer-Block in der Seite: kein Bottom-Padding am main */
.cpb-public-main:has(#cpb-footer) {
    padding-bottom: 0;
}
/* Und kein Top-Padding wenn Header-Block vorhanden */
.cpb-public-main:has(#cpb-header) {
    padding-top: 0;
}

/* Footer-Block in public main: volle Breite, kein Margin */
.cpb-public-main #cpb-footer {
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
}
.cpb-public-main #cpb-header {
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    width: 100%;
}

.cpb-public-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* ── Typography ─────────────────────────────────────────── */
.cpb-public-content h1,
.cpb-public-content h2,
.cpb-public-content h3,
.cpb-public-content h4,
.cpb-public-content h5 {
    margin-top: 1.3em;
    margin-bottom: .5em;
    font-weight: 700;
    color: #1a1a2e;
}

.cpb-public-content h1 { font-size: 2em; margin-top: 0; }
.cpb-public-content h2 { font-size: 1.55em; }
.cpb-public-content h3 { font-size: 1.25em; }

.cpb-public-content p  { margin-bottom: .9em; }
.cpb-public-content ul,
.cpb-public-content ol { padding-left: 1.6em; margin-bottom: .9em; }
.cpb-public-content li { margin-bottom: .3em; }

.cpb-public-content blockquote {
    border-left: 4px solid var(--cpb-primary);
    margin: 1em 0;
    padding: .6em 1.2em;
    background: #f7f9fb;
    color: #555;
    border-radius: 0 6px 6px 0;
}

.cpb-public-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 14px;
}

.cpb-public-content th,
.cpb-public-content td {
    border: 1px solid #dde2e8;
    padding: 9px 14px;
}

.cpb-public-content th {
    background: #f0f3f7;
    font-weight: 700;
}

.cpb-public-content img {
    max-width: 100%;
    border-radius: 6px;
    margin: .5em 0;
}

.cpb-public-content hr {
    border: none;
    border-top: 2px solid #eef0f4;
    margin: 1.8em 0;
}

/* ── Buttons (from CMS blocks) ───────────────────────────── */
.cpb-public-content .cpb-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    background: var(--cpb-primary);
    color: #fff;
    margin: .4em 0;
    transition: opacity .15s;
}

.cpb-public-content .cpb-btn:hover { opacity: .88; }

.cpb-public-content .cpb-btn-outline {
    background: transparent;
    border: 2px solid var(--cpb-primary);
    color: var(--cpb-primary);
}

/* ── Alerts ─────────────────────────────────────────────── */
.cpb-public-content .cpb-alert {
    padding: 13px 18px;
    border-radius: 5px;
    margin-bottom: 1em;
    border-left: 4px solid;
    font-size: 14px;
}

.cpb-public-content .cpb-alert-info    { background: #e8f4f8; border-color: #5bc0de; color: #2a6496; }
.cpb-public-content .cpb-alert-success { background: #dff0d8; border-color: #5cb85c; color: #3c763d; }
.cpb-public-content .cpb-alert-warning { background: #fcf8e3; border-color: #f0ad4e; color: #8a6d3b; }
.cpb-public-content .cpb-alert-danger  { background: #f2dede; border-color: #d9534f; color: #a94442; }

/* ── Two-column layout ───────────────────────────────────── */
.cpb-public-content .cpb-columns {
    display: flex;
    gap: 24px;
    margin-bottom: 1em;
}

.cpb-public-content .cpb-columns > div { flex: 1; }

/* ── Embedded forms ──────────────────────────────────────── */
.cpb-public-content .cpb-form-embed {
    border: 1px solid #dde2e8;
    border-radius: 8px;
    overflow: hidden;
    margin: 1em 0;
}

.cpb-public-content .cpb-form-embed iframe {
    width: 100%;
    border: none;
    display: block;
}

/* ── Register / Login embed shortcuts ───────────────────── */
.cpb-register-embed,
.cpb-login-embed {
    border: 1px solid #dde2e8;
    border-radius: 8px;
    overflow: hidden;
    margin: 1em 0;
}

.cpb-register-embed iframe,
.cpb-login-embed iframe {
    width: 100%;
    min-height: 500px;
    border: none;
    display: block;
}

/* ── Footer ─────────────────────────────────────────────── */
.cpb-public-footer {
    text-align: center;
    padding: 18px 20px;
    font-size: 13px;
    color: #888;
    border-top: 1px solid #e8eaed;
    background: #fff;
}

/* ── Video Embed ─────────────────────────────────────────── */
.cpb-public-content .cpb-video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin: .5em 0;
}

.cpb-public-content .cpb-video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ── Full-width for all public pages ─────────────────────── */
body.cpb-public-page .cpb-public-main {
    padding: 0 !important;
}

body.cpb-public-page .cpb-public-content {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: transparent;
    margin: 0;
}

/* Body selbst auch volle Breite, kein Grau */
body.cpb-public-page {
    background: #fff;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .cpb-public-content { padding: 0; }
    .cpb-public-content h1 { font-size: 1.5em; }
    .cpb-public-content .cpb-columns { flex-direction: column; }
    .cpb-btn-nav { padding: 6px 12px; font-size: 13px; }
}

/* Login iframe: begrenzte Höhe, kein full-page overflow */
.cpb-login-embed iframe {
    width: 100%;
    height: 520px !important;
    min-height: unset !important;
    max-height: 520px !important;
    border: none;
    display: block;
    overflow: hidden;
}

/* ── Sprachumschalter ────────────────────────────────────── */
.cpb-lang-switcher {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(0,0,0,.04);
    justify-content: flex-end;
    border-bottom: 1px solid rgba(0,0,0,.07);
}

.cpb-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: #555;
    background: #fff;
    border: 1px solid #dde2e8;
    transition: all .15s;
}

.cpb-lang-btn:hover {
    background: #f0f3f7;
    color: #333;
}

.cpb-lang-btn.cpb-lang-active {
    background: var(--cpb-primary, #1a3a5c);
    color: #fff;
    border-color: var(--cpb-primary, #1a3a5c);
}

/* ── GrapeJS Inline-Style Schutz ──────────────────────────────────────────
   Stellt sicher dass display:flex / display:grid aus GrapeJS-Inline-Styles
   nicht durch externe CSS (Bootstrap, Perfex) überschrieben werden.        */
.cpb-public-main div[style*="display:flex"],
.cpb-public-main div[style*="display: flex"] {
    display: flex !important;
}
.cpb-public-main div[style*="display:grid"],
.cpb-public-main div[style*="display: grid"] {
    display: grid !important;
}
.cpb-public-main div[style*="flex-wrap:wrap"],
.cpb-public-main div[style*="flex-wrap: wrap"] {
    flex-wrap: wrap !important;
}
.cpb-public-main div[style*="flex-direction:row"],
.cpb-public-main div[style*="flex-direction: row"] {
    flex-direction: row !important;
}
.cpb-public-main div[style*="flex-direction:column"],
.cpb-public-main div[style*="flex-direction: column"] {
    flex-direction: column !important;
}

/* Editor-only elements — never show on customer portal */
.cpb-trait-badge { display: none !important; }

/* ── Seiten-Container (cpb-page-wrapper) ─────────────────────────────────
   Ermöglicht Breiten- und Zentrierungs-Steuerung innerhalb des GrapeJS-Canvas
   ohne den <body>-Tag direkt editieren zu müssen.
   Der Wrapper kann im Editor per Style Manager frei gestylt werden.
   Auf der Live-Seite greift dieselbe CSS-Klasse. */
body.cpb-public-page .cpb-page-wrapper {
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* ── Perfex Action Button (.cpb-action-btn) ──────────────────────────────
   Gilt im GrapeJS-Canvas (via canvas.styles) UND auf der Live-Seite.
   Alle Varianten nutzen --cpb-primary als Basis-Farbe.           */

.cpb-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, opacity .15s, transform .1s;
    border: 2px solid transparent;
    box-sizing: border-box;
    line-height: 1.3;
    white-space: nowrap;
}
.cpb-action-btn:hover  { opacity: .88; transform: translateY(-1px); }
.cpb-action-btn:active { transform: translateY(0); opacity: 1; }

/* Größen */
.cpb-action-btn--sm { font-size: 12px; padding: 6px 14px; }
.cpb-action-btn--md { font-size: 14px; padding: 10px 22px; }
.cpb-action-btn--lg { font-size: 16px; padding: 13px 30px; }
.cpb-action-btn--xl { font-size: 18px; padding: 16px 38px; border-radius: 8px; }

/* Volle Breite */
.cpb-action-btn--full { display: flex; width: 100%; }

/* Varianten */
.cpb-action-btn--filled {
    background: var(--cpb-primary, #1a3a5c);
    color: #fff;
    border-color: var(--cpb-primary, #1a3a5c);
}
.cpb-action-btn--filled:hover { color: #fff; }

.cpb-action-btn--outline {
    background: transparent;
    color: var(--cpb-primary, #1a3a5c);
    border-color: var(--cpb-primary, #1a3a5c);
}
.cpb-action-btn--outline:hover {
    background: var(--cpb-primary, #1a3a5c);
    color: #fff;
    opacity: 1;
}

.cpb-action-btn--ghost {
    background: transparent;
    color: var(--cpb-primary, #1a3a5c);
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.cpb-action-btn--ghost:hover { text-decoration: none; opacity: .75; transform: none; }

.cpb-action-btn--danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
.cpb-action-btn--danger:hover { color: #fff; background: #b91c1c; border-color: #b91c1c; opacity: 1; }

.cpb-action-btn--success {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.cpb-action-btn--success:hover { color: #fff; background: #15803d; border-color: #15803d; opacity: 1; }

/* ── Footer-Nav (.cpb-footer-nav) ────────────────────────────────────────
   Horizontale Linkleiste im Footer — gleiches Layout wie Header-Nav. */
.cpb-footer-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 16px;
    box-sizing: border-box;
    width: 100%;
}
.cpb-footer-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    border-radius: 5px;
    font-size: 13px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.cpb-footer-nav-link:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}
