/* Kreativ-Portal — Editor (Vollbild-Overlay) */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('/bundles/cdutheme/fonts/inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: block;
    src: url('/bundles/cdutheme/fonts/inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: block;
    src: url('/bundles/cdutheme/fonts/inter-700.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: block;
    src: url('/bundles/cdutheme/fonts/inter-800.woff2') format('woff2');
}
@font-face {
    font-family: 'IBM Plex Serif';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('/bundles/cdutheme/fonts/ibmplexserif-400.woff2') format('woff2');
}

:root {
    --cdu-dark: #2d3c4b;
    --cdu-teal: #52b7c1;
    --cdu-orange: #ffa600;
    --cdu-light: #e9ebec;
    --cdu-text: #1b191d;
}

* { box-sizing: border-box; }

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

.kreativ-editor-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--cdu-text);
    background: #f5f6f7;
    overflow: hidden;
}

.ke {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ---------------- Werkzeugleiste ---------------- */

.ke-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--cdu-dark);
    color: #fff;
    padding: 0.5rem 1rem;
    flex: 0 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.ke-toolbar__group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ke-brand {
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-right: 0.75rem;
}

.ke-doc-name {
    font-size: 0.875rem;
    opacity: 0.75;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ke-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.2;
}

.ke-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.ke-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ke-btn.is-active { background: var(--cdu-teal); border-color: var(--cdu-teal); }

.ke-btn--icon {
    padding: 0.4rem 0.55rem;
    min-width: 34px;
    justify-content: center;
}

.ke-btn--primary {
    background: var(--cdu-teal);
    border-color: var(--cdu-teal);
}

.ke-btn--primary:hover { background: #45a5af; }

.ke-btn--outline {
    background: transparent;
    border-color: var(--cdu-teal);
    color: var(--cdu-teal);
}

.ke-sep {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.35rem;
}

.ke-zoom {
    font-size: 0.8125rem;
    min-width: 56px;
    text-align: center;
    opacity: 0.9;
}

.ke-dropdown { position: relative; }

.ke-dropdown__menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    z-index: 40;
}

.ke-dropdown__menu.is-open { display: block; }

.ke-dropdown__menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 0.7rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--cdu-text);
    cursor: pointer;
}

.ke-dropdown__menu button:hover { background: var(--cdu-light); }

/* ---------------- Layout ---------------- */

.ke-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.ke-panel {
    flex: 0 0 320px;
    background: #fff;
    border-right: 1px solid var(--cdu-light);
    overflow-y: auto;
    padding: 1rem;
}

.ke-panel__section {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--cdu-light);
}

.ke-panel__section:last-child { border-bottom: 0; }

.ke-panel__title {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--cdu-dark);
    margin: 0 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ke-counter {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.ke-counter__err { color: #dc2626; }
.ke-counter__warn { color: #b45309; }

.ke-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--cdu-dark);
}

.mt-3 { margin-top: 1rem; }

.ke-select,
.ke-input {
    width: 100%;
    font-family: inherit;
    font-size: 0.875rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--cdu-light);
    border-radius: 4px;
    background: #fff;
    color: var(--cdu-text);
}

.ke-select:focus,
.ke-input:focus {
    outline: none;
    border-color: var(--cdu-teal);
    box-shadow: 0 0 0 3px rgba(82, 183, 193, 0.2);
}

.ke-select--sm,
.ke-input--sm {
    width: auto;
    padding: 0.3rem 0.45rem;
    font-size: 0.8125rem;
}

.ke-input--sm { width: 64px; }

.ke-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0.5rem 0 0;
    line-height: 1.4;
}

/* ---------------- Dropzone ---------------- */

.ke-dropzone {
    border: 2px dashed var(--cdu-light);
    border-radius: 6px;
    padding: 1.25rem;
    text-align: center;
    background: #fafbfb;
}

.ke-dropzone.is-hover {
    border-color: var(--cdu-teal);
    background: rgba(82, 183, 193, 0.08);
}

.ke-dropzone p {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.ke-dropzone span { font-size: 0.75rem; }

/* ---------------- Meldungen ---------------- */

.ke-messages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ke-messages li {
    font-size: 0.8125rem;
    line-height: 1.35;
    padding: 0.5rem 0.6rem;
    border-radius: 4px;
    border-left: 3px solid transparent;
}

.ke-messages__ok {
    background: #f1f5f4;
    color: #4b5563;
    border-left-color: #9ca3af;
}

.ke-messages__error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #dc2626;
}

.ke-messages__warning {
    background: #fffbeb;
    color: #92400e;
    border-left-color: var(--cdu-orange);
}

/* ---------------- Buehne / Seiten ---------------- */

.ke-stage {
    flex: 1 1 auto;
    overflow: auto;
    padding: 2rem 1rem 6rem;
    background: #f5f6f7;
}

.ke-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.ke-page {
    background: #fff;
    box-shadow: 0 4px 20px rgba(45, 60, 75, 0.16);
    position: relative;
}

.ke-page__label {
    position: absolute;
    top: -22px;
    left: 0;
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
}

.ke-page .canvas-container { display: block; }

/* ---------------- Inline-Toolbar ---------------- */

.ke-inline-toolbar {
    position: fixed;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--cdu-light);
    border-radius: 6px;
    box-shadow: 0 6px 22px rgba(45, 60, 75, 0.2);
    padding: 0.4rem;
}

.ke-inline-toolbar__row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ke-inline-toolbar .ke-btn {
    background: var(--cdu-light);
    border-color: var(--cdu-light);
    color: var(--cdu-dark);
}

.ke-inline-toolbar .ke-btn:hover { background: #dbdfe1; }

.ke-color {
    width: 34px;
    height: 30px;
    padding: 2px;
    border: 1px solid var(--cdu-light);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.ke-ruler {
    position: relative;
    height: 14px;
    margin-top: 0.4rem;
    background: repeating-linear-gradient(
        to right,
        var(--cdu-light) 0 1px,
        transparent 1px 10px
    );
    border-top: 1px solid var(--cdu-light);
    border-radius: 2px;
}

.ke-ruler__handle {
    position: absolute;
    top: -3px;
    left: 0;
    width: 10px;
    height: 18px;
    background: var(--cdu-teal);
    border-radius: 2px;
    cursor: ew-resize;
}

/* ---------------- Toast ---------------- */

.ke-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--cdu-dark);
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 50;
}

.ke-toast--error { background: #dc2626; }

/* ---------------- Seitenliste (variabler Umfang) ---------------- */

.ke-pagelist {
    list-style: none;
    margin: 0.75rem 0;
    padding: 0;
    border: 1px solid var(--cdu-light);
    border-radius: 4px;
    max-height: 220px;
    overflow-y: auto;
}

.ke-pagelist__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--cdu-light);
}

.ke-pagelist__item:last-child { border-bottom: 0; }

.ke-pagelist__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.ke-pagelist__actions button {
    border: 1px solid var(--cdu-light);
    background: #fff;
    border-radius: 3px;
    width: 22px;
    height: 22px;
    line-height: 1;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--cdu-dark);
}

.ke-pagelist__actions button:hover {
    background: var(--cdu-light);
}

.ke-pagelist__actions em {
    font-size: 0.6875rem;
    color: #9ca3af;
    font-style: normal;
}
