/* Form-Info – eigene Ergänzungen zu Bootstrap */

:root {
    --fi-sidebar-width: 244px;
    --fi-topbar-bg: #1f2d3d;
    --fi-topbar-height: 56px;
}

body {
    background-color: var(--bs-tertiary-bg);
}

/* --- Kopfleiste ---------------------------------------------------------- */
.app-topbar {
    background-color: var(--fi-topbar-bg);
    min-height: var(--fi-topbar-height);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.app-topbar .navbar-brand {
    color: #fff;
    font-weight: 600;
    letter-spacing: .2px;
}

.app-topbar .navbar-brand:hover {
    color: #dbe4ee;
}

/* --- Grundraster --------------------------------------------------------- */
.app-shell {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - var(--fi-topbar-height));
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    /* Spalte, damit die Fußzeile immer am unteren Rand steht – auch bei kurzem Inhalt */
    display: flex;
    flex-direction: column;
}

.app-main > .container-fluid {
    flex: 1 1 auto;
}

.app-sidebar {
    width: var(--fi-sidebar-width);
    flex: 0 0 var(--fi-sidebar-width);
    background: #fff;
    border-right: 1px solid var(--bs-border-color);
    min-height: calc(100vh - var(--fi-topbar-height));
    padding: 1rem .75rem;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        min-height: 0;
        border-right: 0;
    }
}

.app-sidebar .nav-link {
    color: var(--bs-body-color);
    border-radius: .4rem;
    padding: .5rem .7rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .94rem;
}

.app-sidebar .nav-link:hover {
    background-color: var(--bs-secondary-bg);
}

.app-sidebar .nav-link.active {
    background-color: var(--bs-primary);
    color: #fff;
}

.app-sidebar .nav-link i {
    width: 1.1rem;
    text-align: center;
    flex: 0 0 auto;
}

.sidebar-heading {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bs-secondary-color);
    padding: .9rem .7rem .35rem;
    font-weight: 600;
}

/* --- Karten und Tabellen ------------------------------------------------- */
.card {
    border-color: var(--bs-border-color-translucent);
}

.card-header {
    background-color: rgba(0, 0, 0, .02);
    font-weight: 600;
}

.table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-body-bg);
}

.table td, .table th {
    vertical-align: middle;
}

/* --- KI-Antwort ---------------------------------------------------------- */
.ai-response {
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: 1.1rem 1.25rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.ai-response > :last-child {
    margin-bottom: 0;
}

.ai-response h1, .ai-response h2, .ai-response h3, .ai-response h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.2rem 0 .5rem;
}

.ai-response > h1:first-child, .ai-response > h2:first-child, .ai-response > h3:first-child {
    margin-top: 0;
}

.ai-response table {
    width: 100%;
    margin: .75rem 0;
    border-collapse: collapse;
    font-size: .92rem;
}

.ai-response th, .ai-response td {
    border: 1px solid var(--bs-border-color);
    padding: .4rem .55rem;
    text-align: left;
}

.ai-response th {
    background: var(--bs-secondary-bg);
    font-weight: 600;
}

.ai-response pre {
    background: var(--bs-secondary-bg);
    padding: .75rem;
    border-radius: .35rem;
    overflow-x: auto;
}

.ai-response code {
    background: var(--bs-secondary-bg);
    padding: .1rem .3rem;
    border-radius: .2rem;
    font-size: .88em;
}

.ai-response pre code {
    background: none;
    padding: 0;
}

.ai-response-plain {
    white-space: pre-wrap;
    font-family: var(--bs-font-monospace);
    font-size: .88rem;
}

/* --- Feld-Builder -------------------------------------------------------- */
.field-row {
    background: #fff;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: .65rem .8rem;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.field-row.dragging {
    opacity: .45;
}

.field-row.drag-over {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .15rem rgba(var(--bs-primary-rgb), .2);
}

.drag-handle {
    cursor: grab;
    color: var(--bs-secondary-color);
    flex: 0 0 auto;
}

.drag-handle:active {
    cursor: grabbing;
}

.field-key-badge {
    font-family: var(--bs-font-monospace);
    font-size: .78rem;
}

/* --- Sonstiges ----------------------------------------------------------- */
.help-inline {
    font-size: .82rem;
    color: var(--bs-secondary-color);
}

.limit-bar {
    height: .4rem;
}

textarea.code-area {
    font-family: var(--bs-font-monospace);
    font-size: .87rem;
    line-height: 1.5;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Fußzeile ------------------------------------------------------------ */
.app-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    padding: .8rem 0;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.app-footer .container-fluid {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
}

@media (min-width: 992px) {
    .app-footer .container-fluid {
        justify-content: flex-start;
    }
}

@media print {
    .app-sidebar, .app-topbar, .no-print { display: none !important; }
    .app-main { width: 100%; display: block; }
    .app-footer { border-top: 1px solid #ccc; }
}
