/* ═══════════════════════════════════════════════════════════
   NOBiZ KLF Viewer — Frontend Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Shared ── */
.nobiz-viewer-loading { padding: 40px; text-align: center; color: #999; font-style: italic; }
.nobiz-error { color: #c00; padding: 12px; background: #fee; border-radius: 4px; margin: 12px 0; }

/* ═══════════════════════════════════════════════════════════
   MAIN VIEWER  (#nobiz-main-viewer)
   ═══════════════════════════════════════════════════════════ */
#nobiz-main-viewer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 860px;
    margin: 0 auto;
}

/* ── Top bar: dropdown + view toggle ── */
.nobiz-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.nobiz-dropdown-wrap {
    flex: 1;
    min-width: 220px;
}
.nobiz-dropdown-wrap select {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1a2e4a;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.nobiz-dropdown-wrap select:focus {
    outline: none;
    border-color: #1a2e4a;
    box-shadow: 0 0 0 3px rgba(26,46,74,.1);
}
.nobiz-view-toggle {
    display: flex;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.nobiz-view-toggle button {
    padding: 9px 16px;
    border: none;
    background: #fff;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    color: #555;
    font-weight: 500;
    transition: all 140ms;
    white-space: nowrap;
}
.nobiz-view-toggle button + button {
    border-left: 1px solid #d0d5dd;
}
.nobiz-view-toggle button.active {
    background: #1a2e4a;
    color: #fff;
}
.nobiz-view-toggle button:not(.active):hover {
    background: #f5f5f5;
}

/* ── Content area ── */
.nobiz-viewer-content { position: relative; }
.nobiz-view-panel { display: none; }
.nobiz-view-panel.active { display: block; }

/* ── PDF / iframe panel ── */
.nobiz-pdf-wrap {
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    width: 100%;
    box-sizing: border-box;
}
/* iframe-wrap: JS controls width/height/overflow entirely */
.nobiz-pdf-iframe-wrap {
    font-size: 0;
    line-height: 0;
}
.nobiz-pdf-iframe-wrap iframe {
    border: none;
}
.nobiz-pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1a2e4a;
    color: #fff;
    font-size: 12px;
    gap: 10px;
    border-radius: 6px 6px 0 0;
}
.nobiz-pdf-toolbar span { color: rgba(255,255,255,.6); }
.nobiz-pdf-print-btn {
    background: #2d9e6b;
    color: #fff;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 140ms;
    white-space: nowrap;
}
.nobiz-pdf-print-btn:hover { background: #227e55; }

/* ═══════════════════════════════════════════════════════════
   MOBILE VIEWER  (.nobiz-klf-view)
   ═══════════════════════════════════════════════════════════ */
.nobiz-klf-view {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* Header */
.nobiz-view-header {
    background: #1a2e4a;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.nobiz-view-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.nobiz-view-meta  { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 3px; }
.nobiz-view-abcde { display: flex; gap: 4px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.nobiz-abcde-chip { font-size: 10px; font-weight: 700; width: 18px; height: 18px; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
.nobiz-abcde-chip.active   { background: #fff; color: #1a2e4a; }
.nobiz-abcde-chip.inactive { background: rgba(255,255,255,.12); color: rgba(255,255,255,.3); }

/* Ampel bar */
.nobiz-view-ampel { display: flex; align-items: center; gap: 8px; padding: 7px 16px; font-size: 12px; font-weight: 600; color: #fff; }
.nobiz-view-ampel.rot   { background: #c53030; }
.nobiz-view-ampel.gelb  { background: #d49a0c; }
.nobiz-view-ampel.gruen { background: #2f7d4b; }
.nobiz-view-ampel-dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.95); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }

/* Info box */
.nobiz-view-info { background: #fff; padding: 10px 16px; font-size: 12px; border-bottom: 1px solid #eee; line-height: 1.55; }
.nobiz-view-info-lbl { font-weight: 600; color: #1a2e4a; margin-right: 4px; }
.nobiz-view-achtung { background: #fff3e0; border-left: 3px solid #e8891a; padding: 6px 10px; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: #78350f; border-radius: 0 4px 4px 0; }

/* Accordion blocks */
.nobiz-view-block { border-bottom: 1px solid #eee; }
.nobiz-view-block:last-child { border-bottom: none; }
.nobiz-view-block-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px; cursor: pointer; background: #f9f9f9;
    user-select: none; -webkit-tap-highlight-color: transparent; gap: 8px;
}
.nobiz-view-block-head:active { background: #f0f0f0; }
.nobiz-view-block-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #1a2e4a; flex: 1; }
.nobiz-view-block-chevron { font-size: 14px; color: #999; transition: transform 200ms; flex-shrink: 0; }
.nobiz-view-block.open .nobiz-view-block-chevron { transform: rotate(180deg); }
.nobiz-view-block-body { display: none; padding: 10px 16px 12px; background: #fff; }
.nobiz-view-block.open .nobiz-view-block-body { display: block; }

/* Block head colour variants */
.nobiz-view-block-head.sofort { border-left: 4px solid #d93025; }
.nobiz-view-block-head.esk1   { border-left: 4px solid #d4a417; background: #fffbee; }
.nobiz-view-block-head.esk2   { border-left: 4px solid #e07a13; background: #fff7f0; }
.nobiz-view-block-head.esk3   { border-left: 4px solid #c53030; background: #fff3f3; }
.nobiz-view-block-head.na     { border-left: 4px solid #1976d2; background: #f0f7fd; }
.nobiz-view-block-head.subtle { border-left: 3px solid #c8bfa8; }

/* Measures */
.nobiz-med-row { display: flex; align-items: baseline; gap: 8px; padding: 5px 10px; border-radius: 3px; margin-bottom: 3px; font-size: 13px; flex-wrap: wrap; border-left: 4px solid transparent; }
.nobiz-med-row.lebensrettend  { background: #fef5f5; border-left-color: #d93025; }
.nobiz-med-row.unterstuetzend { background: #fef8f0; border-left-color: #e8891a; }
.nobiz-med-row.ergaenzend     { background: #fdfce8; border-left-color: #d4b400; }
.nobiz-med-row.alternativ     { background: #f7f8f9; border-left-style: dashed; border-left-color: #9ca3af; }
.nobiz-med-row.na_therapie    { background: #f0f7fd; border-left-color: #1976d2; }
.nobiz-med-name  { font-weight: 700; color: #1a2e4a; }
.nobiz-med-dosis { font-weight: 700; color: #374151; font-size: 12px; }
.nobiz-med-appl  { color: #6b7280; font-size: 11px; font-style: italic; }
.nobiz-med-hint  { font-size: 11px; color: #6b7280; font-style: italic; width: 100%; padding-left: 4px; }

/* Sofortmaßnahmen */
.nobiz-sofort-item { background: #fff; border: 2px solid #d93025; border-radius: 4px; padding: 6px 12px; font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.nobiz-sofort-item.saa { border-style: dashed; border-color: #a0a09a; font-weight: 400; }

/* CRM */
.nobiz-crm-item { font-size: 12.5px; color: #3a2a08; padding: 2px 0; display: flex; gap: 6px; }
.nobiz-crm-item::before { content: '→'; color: #a16207; font-weight: 700; flex-shrink: 0; }

/* ── Print ── */
@media print {
    .nobiz-topbar,
    .nobiz-view-toggle,
    .nobiz-pdf-toolbar { display: none !important; }
    .nobiz-view-block-body { display: block !important; }
    .nobiz-view-block-chevron { display: none; }
    .nobiz-pdf-iframe-wrap iframe { transform: none !important; width: 100% !important; }
}

/* ── Mobile ── */
@media (max-width: 540px) {
    .nobiz-topbar { flex-direction: column; align-items: stretch; }
    .nobiz-view-toggle { width: 100%; }
    .nobiz-view-toggle button { flex: 1; }
    .nobiz-view-title { font-size: 14px; }
}
