/* =============================================================
   Notizblock — Liniert wie ein echter Block
   ============================================================= */

.bsm-nb-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    height: calc(100vh - 140px);
}

.bsm-nb-sidebar {
    background: #fff;
    border: 1px solid #E5E9F0;
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
}

.bsm-nb-sidebar h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1B2B47;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bsm-nb-new-btn {
    width: 100%;
    padding: 10px 14px;
    background: #1B2B47;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 12px;
}
.bsm-nb-new-btn:hover { background: #2A3F66; }

.bsm-nb-list { display: flex; flex-direction: column; gap: 6px; }

.bsm-nb-list-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    background: #fafbfd;
}
.bsm-nb-list-item:hover { background: #F1F5FB; }
.bsm-nb-list-item.is-active { background: #E7F1FB; border-color: #B6D2EE; }

.bsm-nb-thumb {
    width: 56px; height: 78px;
    background: #FEFCF7;
    border: 1px solid #E5E9F0;
    border-radius: 4px;
    flex: 0 0 auto;
    object-fit: cover;
}

.bsm-nb-list-meta {
    flex: 1;
    min-width: 0;
}
.bsm-nb-list-title {
    font-weight: 600;
    font-size: 13px;
    color: #1B2B47;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bsm-nb-list-sub {
    font-size: 11px;
    color: #6B7B92;
    margin-top: 2px;
}
.bsm-nb-list-kunde {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    background: #E7F0FA;
    color: #1E6FB8;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}
.bsm-nb-list-noKunde {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    background: #FCF1E5;
    color: #C2691E;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}

/* =============================================================
   Editor-Bereich
   ============================================================= */
.bsm-nb-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.bsm-nb-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #E5E9F0;
    border-radius: 12px;
    align-items: center;
}

.bsm-nb-toolbar input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #D5DCE8;
    border-radius: 8px;
    font-size: 15px;
    color: #1B2B47;
}

.bsm-nb-toolbar select {
    padding: 8px 12px;
    border: 1px solid #D5DCE8;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    min-width: 160px;
}

.bsm-nb-tool-btn {
    padding: 8px 14px;
    background: #fff;
    color: #1B2B47;
    border: 1px solid #D5DCE8;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.bsm-nb-tool-btn:hover { background: #F1F5FB; }
.bsm-nb-tool-btn.is-primary { background: #1B2B47; color: #fff; border-color: #1B2B47; }
.bsm-nb-tool-btn.is-primary:hover { background: #2A3F66; }
.bsm-nb-tool-btn.is-danger { background: #D9425A; color: #fff; border-color: #D9425A; }
.bsm-nb-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bsm-nb-color-swatch {
    width: 32px; height: 32px;
    border: 2px solid #D5DCE8;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}
.bsm-nb-color-swatch.is-active {
    border-color: #1B2B47;
    transform: scale(1.15);
}

/* =============================================================
   Der eigentliche Notizblock — liniert mit rotem Margin
   ============================================================= */
.bsm-nb-paper-wrap {
    flex: 1;
    overflow-y: auto;
    background: #E5E9F0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.bsm-nb-paper {
    position: relative;
    width: 800px;
    max-width: 100%;
    height: 1131px;       /* A4 Verhaeltnis bei 800px Breite */
    background: #FEFCF7;  /* warmes Papierweiss */
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.06);

    /* Horizontale Linien wie Notizblock */
    background-image:
        repeating-linear-gradient(to bottom,
            transparent 0, transparent 27px,
            #D9E4F0 27px, #D9E4F0 28px);

    /* Roter linker Margin */
    border-left: none;
}

.bsm-nb-paper::before {
    content: '';
    position: absolute;
    left: 60px;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: #E8A4A4;
    pointer-events: none;
    z-index: 1;
}

.bsm-nb-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: crosshair;
}

/* Tool-Switcher zeigt aktives Tool an */
.bsm-nb-tool-btn.is-active {
    background: #1B2B47;
    color: #fff;
    border-color: #1B2B47;
}

/* =============================================================
   Papier-Header (Datum + Teilnehmer am oberen Rand)
   ============================================================= */
.bsm-nb-paper-header {
    position: absolute;
    top: 0;
    left: 76px;        /* hinter dem roten Margin */
    right: 16px;
    z-index: 3;        /* ueber Canvas + Items */
    padding: 14px 0 12px 0;
    border-bottom: 1px solid #C6D2E2;
    background: linear-gradient(to bottom, rgba(254,252,247,0.95), rgba(254,252,247,0.7));
    pointer-events: none;
}
.bsm-nb-paper-header > * { pointer-events: auto; }

.bsm-nb-header-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 4px;
}
.bsm-nb-header-row.is-large {
    font-size: 16px;
    font-weight: 600;
    color: #1B2B47;
}
.bsm-nb-header-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #6B7B92;
    letter-spacing: 0.05em;
    margin-right: 6px;
}
.bsm-nb-header-input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    border-bottom: 1px dashed #B6CFE6;
    padding: 2px 4px;
    font-size: 14px;
    color: #1B2B47;
    font-family: inherit;
    outline: none;
}
.bsm-nb-header-input:focus { border-bottom-color: #1B2B47; }

/* =============================================================
   Items-Overlay (Text-Boxen + Bilder im freien Bereich)
   ============================================================= */
.bsm-nb-items {
    position: absolute;
    inset: 0;
    z-index: 4;        /* ueber Canvas */
    pointer-events: none;
}
.bsm-nb-items > * { pointer-events: auto; }

.bsm-nb-item {
    position: absolute;
    box-sizing: border-box;
    user-select: none;
}
.bsm-nb-item.is-text {
    background: rgba(255, 247, 200, 0.85);
    border: 1px solid #E8C84F;
    border-radius: 4px;
    padding: 8px 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    min-width: 100px;
    min-height: 48px;
    display: flex;
}
.bsm-nb-item.is-text textarea {
    flex: 1;
    width: 100%;
    min-height: 32px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    overflow: hidden;        /* kein Inner-Scrollbar — wir auto-resizen */
    font-family: 'Patrick Hand', 'Segoe Print', Comic Sans MS, cursive;
    font-size: 16px;
    color: #1B2B47;
    line-height: 1.4;
}
.bsm-nb-item.is-image {
    border: 1px solid #C6D2E2;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    overflow: hidden;
}
.bsm-nb-item.is-image img {
    width: 100%; height: 100%;
    display: block;
    object-fit: contain;
}

.bsm-nb-item-handle {
    position: absolute;
    top: -10px; left: -10px;
    width: 20px; height: 20px;
    background: #1B2B47;
    color: #fff;
    border-radius: 50%;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.1s;
}
.bsm-nb-item:hover .bsm-nb-item-handle { opacity: 1; }

.bsm-nb-item-del {
    position: absolute;
    top: -10px; right: -10px;
    width: 20px; height: 20px;
    background: #D9425A;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.1s;
}
.bsm-nb-item:hover .bsm-nb-item-del { opacity: 1; }

.bsm-nb-item-resize {
    position: absolute;
    bottom: -10px; right: -10px;
    width: 20px; height: 20px;
    background: #6B7B92;
    color: #fff;
    border-radius: 4px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.1s;
}
.bsm-nb-item:hover .bsm-nb-item-resize { opacity: 1; }

/* =============================================================
   Kunden-Suche (Autocomplete)
   ============================================================= */
.bsm-nb-kundensuche {
    position: relative;
    min-width: 240px;
}
.bsm-nb-kundensuche input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #D5DCE8;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
.bsm-nb-kundensuche-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #D5DCE8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
}
.bsm-nb-kundensuche-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #F1F5FB;
}
.bsm-nb-kundensuche-item:last-child { border-bottom: none; }
.bsm-nb-kundensuche-item:hover { background: #F1F5FB; }
.bsm-nb-kundensuche-item-name { font-weight: 600; color: #1B2B47; }
.bsm-nb-kundensuche-item-nr   { font-size: 11px; color: #6B7B92; }
.bsm-nb-kundensuche-chosen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #E7F0FA;
    color: #1E6FB8;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.bsm-nb-kundensuche-chosen button {
    background: none;
    border: none;
    color: #1E6FB8;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

/* =============================================================
   Leerer Zustand
   ============================================================= */
.bsm-nb-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6B7B92;
    text-align: center;
    padding: 40px;
}
.bsm-nb-empty-icon { font-size: 64px; margin-bottom: 12px; }
.bsm-nb-empty-title { font-size: 18px; font-weight: 600; color: #1B2B47; margin-bottom: 6px; }

/* Schmal: Sidebar verstecken, nur Editor */
@media (max-width: 900px) {
    .bsm-nb-page { grid-template-columns: 1fr; }
    .bsm-nb-sidebar { display: none; }
}
