:root {
    --primary-color: #14336a;
    --secondary-color: #ecf0f1;
    --background-color: #f4f7fb;
    --card-background-color: white;
    --card-shadow: rgba(0, 0, 0, 0.1);
    --text-color: #111111;
    --header-color: #14336a;
    --hover-color: #044586;
    --border-color: #dee2e6;
    --focus-ring: rgba(20, 51, 106, 0.25);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}


/* Headings — left-aligned by default */
h1 {
    margin-top: 10px;
    font-size: 2em;
    color: var(--header-color);
}

h2 {
    margin-top: 10px;
    font-size: 1.6em;
    color: var(--header-color);
}

h3 {
    margin-top: 10px;
    font-size: 1.3em;
    color: var(--header-color);
}

/* Links — reset block/center defaults */
a {
    text-decoration: none;
    color: var(--primary-color);
}

a:hover {
    color: var(--hover-color);
}

/* Navigation */
.navbar {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    min-height: 56px;
}

.navbar-brand img {
    height: 24px;
    width: auto;
    max-width: 150px;
}

.navbar-nav .nav-link {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.95rem;
}

/* Active nav-link */
.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

/* Full-width page (für Belegung, Auflagen, Zeitschriften-DB) */
.page-fullwidth {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 1rem !important;
}

/* Scrollable table wrapper */
.table-scroll {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: auto;
    width: 100%;
    max-height: 80vh;
}

/* Data table compact */
.table-data {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    font-size: 0.85rem;
}

.table-data th {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    z-index: 20;
}

.table-data td {
    vertical-align: middle;
}

.table-data th:first-child,
.table-data td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: inherit;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

/* Die Kopfzeile behält ihre Farbe: sonst erbt die erste Spalte das Weiß der
   Seite und die Überschrift steht weiß auf weiß, also unsichtbar. */
.table-data th:first-child {
    background: var(--primary-color);
    z-index: 21;
}

/* Zebra stripes for data tables */
.table-data tbody tr:nth-child(odd) td { background: #f8f9fa; }
.table-data tbody tr:nth-child(even) td { background: #e9ecef; }
.table-data tbody tr:hover td { background: #dee2e6; }
.table-data tbody tr:nth-child(odd) td:first-child { background: #f0f2f4; }
.table-data tbody tr:nth-child(even) td:first-child { background: #e4e7ea; }
.table-data tbody tr:hover td:first-child { background: #d5d8db; }

/* Filter bar */
.filter-bar {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

.filter-bar label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 0;
    white-space: nowrap;
}

.filter-bar select,
.filter-bar input[type="text"] {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    transition: border-color 0.2s;
    max-width: 180px;
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

/* Form page layout */
.form-page {
    max-width: 700px;
}

/* Cell content (Belegungsübersicht) */
.cell-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cell-content a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    display: inline;
    text-align: left;
    margin: 0;
}

.cell-content a:hover {
    text-decoration: underline;
}

.cell-content small {
    font-size: 0.7rem;
    color: #6c757d;
    display: block;
    text-align: left;
}

/* Filter hint (empty state) */
.filter-hint {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.filter-hint i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    color: #adb5bd;
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

/* Fieldsets */
fieldset, .form-section {
    background-color: #f8f9fa;
    padding: 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

/* Required field marker */
.required-field label::after,
label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: 600;
}

/* Cards */
.filiale-card, .card {
    background-color: var(--card-background-color);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.filiale-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.filiale-header {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--header-color);
    margin-bottom: 15px;
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.9rem;
}

.table td {
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Buttons — consistent styling */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--hover-color);
    border-color: var(--hover-color);
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    color: #fff;
}

/* Werbegebiete */
.werbegebiete { margin-top: 20px; }
.werbegebiet {
    margin-bottom: 15px;
    padding: 10px;
    background-color: var(--secondary-color);
    border-radius: 5px;
}
.werbegebiet-header {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}
.werbegebiet p { font-size: 1em; color: #7f8c8d; margin: 5px 0; }

/* Action links */
.action-links {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--primary-color);
}
.action-links a {
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.action-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* Color boxes */
.farb-box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 8px;
}

/* Nav-tabs override */
ul.nav-tabs {
    display: flex !important;
    flex-direction: row !important;
    padding-left: 0;
}
ul.nav-tabs .nav-item {
    flex: 1 1 auto !important;
    text-align: center;
}
ul.nav-tabs .nav-link {
    width: 100% !important;
}

/* Home page card grid */
.home-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.home-card {
    background: var(--card-background-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.home-card .card-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.home-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.home-card p {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0;
}

.home-card a {
    display: inline;
    font-size: 1rem;
    text-align: left;
    margin: 0;
}

/* Filialen container */
.filialen-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 20px;
}

.filiale-card {
    width: 300px;
    padding: 20px;
}

/* Static line (secondary navbar) */
.static-line {
    background-color: #f8f9fa;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.static-line .navbar-nav { justify-content: center; }
.static-line .nav-item { padding: 0 15px; }
.static-line .nav-link {
    font-size: 1em;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}
.static-line .nav-link:hover { color: #0056b3; }

/* Wizard styles */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
    counter-reset: step;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.wizard-step .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.wizard-step.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.wizard-step.completed .step-number {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.wizard-step .step-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
}

.wizard-step.active .step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 1.6em; }

    .filiale-card { width: 90%; }

    .home-card-grid {
        grid-template-columns: 1fr;
    }

    /* Wizard bleibt horizontal — nur Labels ausblenden */
    .wizard-step .step-label { display: none; }
}

@media (max-width: 400px) {
    .wizard-step .step-number { width: 32px; height: 32px; font-size: 0.8rem; }
}


/* =========================================
   BELEGUNGSÜBERSICHT TABLE
   ========================================= */
.belegung-table { border-collapse: separate; border-spacing: 0; width: max-content; font-size: 12px; }
.belegung-table th, .belegung-table td { padding: 0.5rem 0.4rem; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--border-color); background-clip: padding-box; }
.belegung-table thead tr:first-child th { position: sticky; top: 0; background: var(--primary-color); color: #fff; font-weight: 600; z-index: 30; border-bottom: 2px solid #1d4a96; }
.belegung-table thead tr:nth-child(2) th { position: sticky; top: 2.25rem; background: #1d4a96; color: #fff; font-weight: 500; z-index: 29; border-bottom: 2px solid #2560bf; }
/* Sticky left 4 columns */
.belegung-table thead tr:first-child th:nth-child(1), .belegung-table thead tr:nth-child(2) th:nth-child(1), .belegung-table tbody td:nth-child(1) { position: sticky; left: 0; z-index: 40; min-width: 90px; max-width: 90px; }
.belegung-table thead tr:first-child th:nth-child(2), .belegung-table thead tr:nth-child(2) th:nth-child(2), .belegung-table tbody td:nth-child(2) { position: sticky; left: 90px; z-index: 40; min-width: 110px; max-width: 110px; }
.belegung-table thead tr:first-child th:nth-child(3), .belegung-table thead tr:nth-child(2) th:nth-child(3), .belegung-table tbody td:nth-child(3) { position: sticky; left: 200px; z-index: 40; min-width: 130px; max-width: 130px; }
.belegung-table thead tr:first-child th:nth-child(4), .belegung-table thead tr:nth-child(2) th:nth-child(4), .belegung-table tbody td:nth-child(4) { position: sticky; left: 330px; z-index: 40; min-width: 70px; max-width: 70px; }
.belegung-table thead tr:first-child th:nth-child(-n+4) { background: var(--primary-color); color: #fff; z-index: 41; }
.belegung-table thead tr:nth-child(2) th:nth-child(-n+4) { background: #1d4a96; color: #fff; z-index: 40; }
.belegung-table tbody td:nth-child(-n+4) { z-index: 10; }
/* Trennlinie nur an der rechten Kante der 4. (letzten) Freeze-Spalte */
.belegung-table thead tr:first-child th:nth-child(4),
.belegung-table thead tr:nth-child(2) th:nth-child(4),
.belegung-table tbody td:nth-child(4) { box-shadow: 4px 0 8px rgba(0,0,0,0.15); border-right: 2px solid rgba(0,0,0,0.12); }
/* Zebra */
.belegung-table tbody tr:nth-child(odd) td { background: #f8f9fa; }
.belegung-table tbody tr:nth-child(even) td { background: #e9ecef; }
.belegung-table tbody tr:nth-child(odd) td:nth-child(-n+4) { background: #f0f2f4; }
.belegung-table tbody tr:nth-child(even) td:nth-child(-n+4) { background: #e4e7ea; }
.belegung-table tbody tr:hover td { background: #dee2e6; }
.belegung-table tbody tr:hover td:nth-child(-n+4) { background: #d5d8db; }
/* KW group borders */
.belegung-table td:nth-child(4n+5), .belegung-table thead th:nth-child(4n+5) { border-left: 2px solid rgba(20, 51, 106, 0.35); }
/* Cell status badges — als kompakte Kacheln (KEIN display:block!) */
.no-schaltung { background: #ffeeba; color: #856404; padding: 0.3rem; border-radius: 4px; font-style: italic; font-size: 0.75rem; }
.keine-ausgabe { background: #f8d7da; color: #721c24; padding: 0.3rem; border-radius: 4px; font-style: italic; font-size: 0.75rem; }
.schaltung { background: #d1d8f1; color: #0c5460; padding: 0.3rem; border-radius: 4px; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schaltung.mit-bestellung { background: #c3e6cb; color: #155724; }
.schaltung.no-ausgabe { background: #f5c6cb; color: #721c24; }

/* Belegungsübersicht Legende (verbunden mit .table-scroll darunter) */
.belegung-legend {
    background: #fff;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 1rem;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* =========================================
   DASHBOARD & CARDS (Neu)
   ========================================= */

/* Abrundung und weicher Schatten für alle neuen Container */
.dash-card, .panel-card {
    border-radius: 12px;
    background-color: var(--card-background-color);
}

/* Hover-Effekt für die 3 Hauptkarten oben */
.dash-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.dash-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(20, 51, 106, 0.15) !important;
}

/* Styling für die Listen im Schnellzugriff */
.custom-list-group .list-group-item {
    border: none;
    border-bottom: 1px solid #f0f2f4;
    padding: 1rem 0.5rem;
    background-color: transparent;
    transition: padding-left 0.2s ease, background-color 0.2s ease;
}

.custom-list-group .list-group-item:last-child {
    border-bottom: none;
}

/* Leichter Einrück-Effekt beim Hover (sieht sehr modern aus) */
.custom-list-group .list-group-item:hover {
    padding-left: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Feinere Navbar */
.navbar {
    padding-top: 0.8rem !important;
    padding-bottom: 0.8rem !important;
}
.navbar-brand {
    letter-spacing: 0.5px;
    font-size: 1.25rem;
}

:root{
  --card-bg: #fff;
  --border: #eef1f4;
}

/* Karten / Panels */
.panel-card{ border-radius:12px; background:var(--card-bg); }
.dash-card{ border-radius:12px; }

/* Breadcrumb kompakter */
.breadcrumb{ margin-bottom:.25rem; }

/* Info-Leiste als flexibles Grid ohne Lücken */
.info-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:16px;
}
.info-item{
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px 16px;
}
.info-item .label{ color:#6c757d; font-size:.8rem; margin-bottom:.25rem; }
.info-item .value{ font-weight:700; color:#1f2d3d; }
.info-item .sub{ color:#6c757d; font-size:.8rem; }

/* Tabellen springen nicht in der Breite */
.table-fixed{ table-layout:fixed; width:100%; }
.text-truncate-2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }


/* =========================================
   ANZEIGEN-AMPEL
   =========================================
   Vier Stufen: geprüft (grün) – zur Prüfung (gelb) – im Eingang (orange) –
   fehlt (rot). Farben im Vokabular der Belegungsübersicht oben, damit im
   Portal nicht zwei Ampelsprachen nebeneinander stehen. */
.ampel {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}
.ampel-gruen  { background: #c3e6cb; color: #155724; }
.ampel-gelb   { background: #ffeeba; color: #856404; }
.ampel-orange { background: #ffe0c2; color: #8a4b08; }
.ampel-rot    { background: #f8d7da; color: #721c24; }

/* Punkt-Variante für enge Tabellenzellen (Schaltungsliste) */
.ampel-punkt {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    vertical-align: middle;
}
.ampel-punkt.ampel-gruen  { background: #28a745; }
.ampel-punkt.ampel-gelb   { background: #e0a800; }
.ampel-punkt.ampel-orange { background: #e8730c; }
.ampel-punkt.ampel-rot    { background: #dc3545; }

/* Zeile, die über ?anzeige=<Datei> angesprungen wurde.
   Die Farbe muss auf die Zellen: Bootstrap malt td weiß über das tr. */
.anzeige-zeile.hervorgehoben > td {
    background: #fff3cd;
}
.anzeige-zeile.hervorgehoben > td:first-child {
    box-shadow: inset 3px 0 0 #e0a800;
}

/* Icon-Variante für enge Zellen (Schaltungsliste) */
.ampel-text-gruen  { color: #198754; }
.ampel-text-gelb   { color: #c69500; }
.ampel-text-orange { color: #e8730c; }
.ampel-text-rot    { color: #dc3545; }
