/* ========================================
   Story Builder
   ======================================== */

/* Overlay */
.aca-sb-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.aca-sb-container {
    background: #fff;
    max-width: 960px;
    width: 100%;
    max-height: 92vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.aca-sb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 30px;
    border-bottom: 2px solid #88b441;
    flex-shrink: 0;
}
.aca-sb-header h2 { margin: 0; color: #1a243b; font-size: 22px; }
.aca-sb-close {
    background: none; border: none; font-size: 30px;
    cursor: pointer; color: #666; line-height: 1;
}
.aca-sb-close:hover { color: #000; }

/* Steps indicator */
.aca-sb-steps {
    display: flex;
    padding: 0 30px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.aca-sb-step {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 13px;
    color: #999;
    border-bottom: 3px solid transparent;
    font-weight: 500;
}
.aca-sb-step.active { color: #1a243b; border-bottom-color: #88b441; font-weight: 600; }
.aca-sb-step.done { color: #88b441; }

/* Progress bar */
.aca-sb-progress {
    padding: 12px 30px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #555;
    flex-shrink: 0;
}
.aca-sb-progress strong { color: #1a243b; }
.aca-sb-progress .aca-sb-ok { color: #88b441; }
.aca-sb-progress .aca-sb-low { color: #b1632f; }

/* Body */
.aca-sb-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 30px;
}

/* Footer / Navigation */
.aca-sb-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 30px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.aca-sb-btn {
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.aca-sb-btn-primary { background: #88b441; color: #fff; }
.aca-sb-btn-primary:hover { background: #75a036; }
.aca-sb-btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.aca-sb-btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #999; }
.aca-sb-btn-secondary:hover { background: #1a243b; color: #fff; border-color: #1a243b; }
.aca-sb-btn-danger { background: #d32f2f; color: #fff; }
.aca-sb-btn-danger:hover { background: #b71c1c; }
.aca-sb-btn-danger:disabled { background: #ccc; cursor: not-allowed; }

/* ── WIZARD STEP 1: BRAINSTORMING ── */
.aca-sb-intro {
    margin-bottom: 24px;
    line-height: 1.6;
    color: #444;
}

.aca-sb-category {
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 18px;
}
.aca-sb-category h4 {
    margin: 0 0 4px 0;
    color: #1a243b;
    font-size: 15px;
}
.aca-sb-category .aca-sb-cat-question {
    color: #555;
    margin: 0 0 4px 0;
    font-size: 14px;
}
.aca-sb-category .aca-sb-cat-example {
    color: #999;
    font-size: 12px;
    margin: 0 0 12px 0;
    font-style: italic;
}
.aca-sb-entry-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
}
.aca-sb-entry-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f4f9ed;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 14px;
}
.aca-sb-entry-list li .aca-sb-remove {
    background: none; border: none;
    color: #d32f2f; cursor: pointer;
    font-size: 16px; padding: 0 4px;
}
.aca-sb-add-row {
    display: flex;
    gap: 8px;
}
.aca-sb-add-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.aca-sb-add-row button {
    padding: 8px 14px;
    background: #88b441;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

/* ── WIZARD STEP 2: FILTER ── */
.aca-sb-filter-intro {
    margin-bottom: 16px;
    padding: 14px;
    background: #fff8e1;
    border-radius: 6px;
    border-left: 4px solid #f9a825;
    font-size: 14px;
    line-height: 1.6;
}
.aca-sb-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.aca-sb-filter-list li {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.aca-sb-filter-list li:hover { background: #f9f9f9; }
.aca-sb-filter-list li.removed {
    text-decoration: line-through;
    color: #d32f2f;
    background: #fce4ec;
}
.aca-sb-filter-list li .aca-sb-filter-icon {
    margin-right: 10px;
    font-size: 16px;
    width: 22px;
    text-align: center;
}
.aca-sb-filter-stats {
    margin-top: 16px;
    font-size: 14px;
    color: #555;
}

/* ── WIZARD STEP 3: ZUORDNEN ── */
.aca-sb-assign-layout {
    display: flex;
    gap: 20px;
}
.aca-sb-assign-examples {
    flex: 1;
    min-width: 0;
}
.aca-sb-assign-stichworte {
    flex: 1;
    min-width: 0;
}
.aca-sb-assign-item {
    padding: 8px 12px;
    background: #f4f9ed;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.aca-sb-assign-item select {
    flex: 1;
    padding: 4px 6px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 3px;
}
.aca-sb-assign-item .aca-sb-assign-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aca-sb-stichwort-group {
    margin-bottom: 16px;
}
.aca-sb-stichwort-group h5 {
    margin: 0 0 6px 0;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.aca-sb-custom-stichwort {
    margin-top: 12px;
    display: flex;
    gap: 6px;
}
.aca-sb-custom-stichwort input {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ── WIZARD STEP 4: STORIES ── */
.aca-sb-story-list { list-style: none; padding: 0; margin: 0; }
.aca-sb-story-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.aca-sb-story-list li .aca-sb-story-status {
    margin-right: 10px;
    font-size: 16px;
}
.aca-sb-story-list li .aca-sb-story-info { flex: 1; }
.aca-sb-story-list li .aca-sb-story-kw { color: #888; font-size: 12px; }

/* STAR Editor Modal */
.aca-sb-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.aca-sb-modal-content {
    background: #fff;
    max-width: 650px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 28px;
    position: relative;
}
.aca-sb-modal-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none; border: none;
    font-size: 28px; cursor: pointer; color: #666;
}
.aca-sb-modal h3 { margin: 0 30px 20px 0; color: #1a243b; font-size: 18px; }

.aca-sb-modal-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 18px;
}
.aca-sb-modal-tab {
    padding: 8px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none; border-left: none; border-right: none;
}
.aca-sb-modal-tab.active { color: #1a243b; border-bottom-color: #88b441; }

.aca-sb-star-field { margin-bottom: 14px; }
.aca-sb-star-field label {
    display: block;
    font-weight: 600;
    color: #1a243b;
    margin-bottom: 4px;
    font-size: 14px;
}
.aca-sb-star-field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}
.aca-sb-volltext-area {
    width: 100%;
    min-height: 180px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.aca-sb-char-count { text-align: right; font-size: 12px; color: #999; margin-top: 4px; }

.aca-sb-kompetenzen-field { margin-bottom: 14px; }
.aca-sb-kompetenzen-field label { display: block; font-weight: 600; color: #1a243b; margin-bottom: 4px; font-size: 14px; }
.aca-sb-kompetenzen-field input { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }

.aca-sb-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

/* ── MAIN VIEW TABS ── */
.aca-sb-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    padding: 0 30px;
    flex-shrink: 0;
}
.aca-sb-tab {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none; border-left: none; border-right: none;
}
.aca-sb-tab.active { color: #1a243b; border-bottom-color: #88b441; }

/* ── TAB: ÜBERSICHT ── */
.aca-sb-overview-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.aca-sb-overview-controls select,
.aca-sb-overview-controls input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.aca-sb-overview-controls input { flex: 1; min-width: 150px; }

.aca-sb-stats {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
}

.aca-sb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.aca-sb-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f4f4f4;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    color: #1a243b;
    font-size: 13px;
}
.aca-sb-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}
.aca-sb-table tr:hover { background: #f9f9f9; }
.aca-sb-table .aca-sb-kompetenzen-cell {
    font-size: 12px;
    color: #666;
}
.aca-sb-table .aca-sb-actions { white-space: nowrap; }
.aca-sb-table .aca-sb-actions button {
    padding: 4px 10px;
    font-size: 12px;
    margin: 2px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #999;
    background: #fff;
    color: #333;
    font-weight: 500;
}
.aca-sb-table .aca-sb-actions button:hover { background: #1a243b; color: #fff; border-color: #1a243b; }
.aca-sb-table .aca-sb-actions .aca-sb-story-btn {
    background: #88b441;
    color: #fff;
    border-color: #88b441;
}
.aca-sb-table .aca-sb-actions .aca-sb-story-btn:hover { background: #75a036; border-color: #75a036; }

/* Coverage analysis */
.aca-sb-coverage { margin-top: 24px; }
.aca-sb-coverage h4 { color: #1a243b; margin-bottom: 10px; }
.aca-sb-coverage-list { list-style: none; padding: 0; margin: 0; }
.aca-sb-coverage-list li {
    padding: 4px 0;
    font-size: 13px;
}
.aca-sb-coverage-ok { color: #388e3c; }
.aca-sb-coverage-warn { color: #f57c00; }
.aca-sb-coverage-tip {
    margin-top: 10px;
    font-size: 13px;
    color: #888;
    font-style: italic;
}

/* ── TAB: LERNEN ── */
.aca-sb-learn-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.aca-sb-learn-nav button {
    padding: 8px 16px;
    border: none;
    background: #88b441;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.aca-sb-learn-nav button:hover { background: #75a036; }
.aca-sb-learn-nav button:disabled { background: #ccc; color: #fff; opacity: 0.6; cursor: not-allowed; }
.aca-sb-learn-counter { font-size: 14px; color: #666; font-weight: 600; }

.aca-sb-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 28px;
    background: #fafafa;
}
.aca-sb-card-stichwort {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #88b441;
    font-weight: 600;
    margin-bottom: 6px;
}
.aca-sb-card h3 { margin: 0 0 20px 0; color: #1a243b; font-size: 20px; }

.aca-sb-card-section { margin-bottom: 16px; }
.aca-sb-card-section h4 {
    margin: 0 0 6px 0;
    color: #1a243b;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.aca-sb-card-section p {
    margin: 0;
    color: #444;
    font-size: 14px;
    line-height: 1.6;
}

.aca-sb-card-kompetenzen {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e0e0e0;
}
.aca-sb-card-kompetenzen span {
    display: inline-block;
    background: #e8f4e0;
    color: #4a7c22;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
}

.aca-sb-card-story-toggle {
    margin-top: 14px;
    padding: 10px 0;
    cursor: pointer;
    color: #88b441;
    font-weight: 600;
    font-size: 14px;
    background: none;
    border: none;
    text-align: left;
}
.aca-sb-card-volltext {
    margin-top: 10px;
    padding: 16px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

/* ── TAB: DRUCKEN ── */
.aca-sb-print-options {
    padding: 24px;
    background: #f9f9f9;
    border-radius: 8px;
}
.aca-sb-print-options label {
    display: block;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
}
.aca-sb-print-options input[type="checkbox"],
.aca-sb-print-options input[type="radio"] { margin-right: 8px; }
.aca-sb-print-options h4 { margin: 16px 0 8px 0; color: #1a243b; }

/* ── STORY OVERLAY ── */
.aca-sb-story-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.aca-sb-story-overlay-content {
    background: #fff;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 28px;
    position: relative;
}
.aca-sb-story-overlay-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none; border: none;
    font-size: 28px; cursor: pointer; color: #666;
}
.aca-sb-story-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}
.aca-sb-story-section:last-child { border-bottom: none; }
.aca-sb-story-section h4 { color: #1a243b; margin: 0 0 8px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; }
.aca-sb-story-section p { margin: 0; line-height: 1.6; color: #333; font-size: 14px; }

.aca-sb-story-highlight {
    background: #f4f9ed;
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid #88b441;
}

/* ── RESET ── */
.aca-sb-reset-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}
.aca-sb-reset-btn {
    font-size: 12px;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 8px 16px;
}
.aca-sb-reset-btn:hover { color: #fff; background: #d32f2f; text-decoration: none; border-radius: 4px; }

.aca-sb-reset-modal-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #d32f2f;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    margin: 10px 0;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
    .aca-sb-container { max-height: 95vh; }
    .aca-sb-header { padding: 14px 18px; }
    .aca-sb-body { padding: 16px 18px; }
    .aca-sb-footer { padding: 12px 18px; }
    .aca-sb-tabs { padding: 0 18px; }
    .aca-sb-assign-layout { flex-direction: column; }
    .aca-sb-steps { font-size: 11px; }
    .aca-sb-overview-controls { flex-direction: column; }
    .aca-sb-modal-content { padding: 18px; }
}

/* ── PRINT ── */
@media print {
    .aca-sb-overlay { position: static; background: none; padding: 0; }
    .aca-sb-container { max-height: none; max-width: none; border-radius: 0; }
    .aca-sb-header, .aca-sb-steps, .aca-sb-tabs, .aca-sb-footer,
    .aca-sb-overview-controls, .aca-sb-actions, .aca-sb-reset-section,
    .aca-sb-close, button { display: none !important; }
    .aca-sb-body { overflow: visible; }
    .aca-sb-table { font-size: 11pt; }
    .aca-sb-card { page-break-inside: avoid; }
}
