/* httpdocs/public/assets/css/app.css */

/* Sidebar Fixierung für Desktop-Ansichten */
@media (min-width: 992px) {
    .sidebar-wrapper {
        height: calc(100vh - 56px);
        position: sticky;
        top: 56px;
    }

    /* Menü länger als der Bildschirm: eigener Scrollbereich. Bootstrap setzt für .offcanvas-lg .offcanvas-body
       overflow-y: visible -- dann wurden die unteren Menüpunkte abgeschnitten. overscroll-behavior: contain sorgt
       dafür, dass das Mausrad über dem Menü nur das Menü scrollt (auch am Anfang/Ende nicht die Seite), über dem
       Inhalt rechts scrollt wie gewohnt die Seite. */
    .offcanvas-lg .sidebar-wrapper {
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
    }
}

.offcanvas-lg.sidebar-collapsed {
    width: 72px !important;
}

.offcanvas-lg.sidebar-collapsed .offcanvas-body {
    padding: 0.5rem !important;
}

.offcanvas-lg.sidebar-collapsed .offcanvas-title {
    display: none;
}

.offcanvas-lg.sidebar-collapsed .sidebar-collapse-btn {
    display: inline-flex;
}

.sidebar-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.offcanvas-lg.sidebar-collapsed .sidebar-wrapper {
    padding: 0.5rem 0.25rem !important;
}

.offcanvas-lg.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.offcanvas-lg.sidebar-collapsed .nav-link .sidebar-link-text {
    display: none;
}

.offcanvas-lg.sidebar-collapsed .nav-link .bi {
    margin-right: 0 !important;
}

/* Subtiler Hover-Effekt für klickbare Dashboard-Karten mit sauberer Transition */
.card-hover {
    transition: transform 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-2px);
}

body.dark-mode {
    background-color: #101419;
    color: #e8eef5;
}

/* <body class="bg-light"> (templates/header.php): Bootstraps .bg-light setzt den Hintergrund
   mit !important und würde die Regel oben sonst überstimmen. */
body.dark-mode.bg-light {
    background-color: #101419 !important;
}

body.dark-mode .bg-light,
body.dark-mode .bg-body-tertiary,
body.dark-mode .bg-white,
body.dark-mode .card,
body.dark-mode .offcanvas,
body.dark-mode .offcanvas-body,
body.dark-mode .navbar,
body.dark-mode .planner-day-column,
body.dark-mode .planner-entry-card,
body.dark-mode .planner-employee-pool-wrapper,
body.dark-mode .container-fluid,
body.dark-mode .row,
body.dark-mode .card-body,
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode .table,
body.dark-mode .alert,
body.dark-mode .sidebar-wrapper,
body.dark-mode .dropdown-menu {
    background-color: #181f27 !important;
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
}

body.dark-mode .navbar {
    background-color: #12171f !important;
}

body.dark-mode .offcanvas,
body.dark-mode .offcanvas-body,
body.dark-mode .sidebar-wrapper {
    background-color: #141b23 !important;
}

body.dark-mode .table {
    background-color: #181f27 !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

body.dark-mode .table-light,
body.dark-mode .table-light th,
body.dark-mode .table-light td,
body.dark-mode .table th,
body.dark-mode .table td {
    background-color: transparent !important;
    color: #eef4ff !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

body.dark-mode .table thead th {
    background-color: #1f2b37 !important;
    color: #f7fbff !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

.time-tracking-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.75);
}

.time-tracking-status-dot-success {
    background-color: #198754;
}

.time-tracking-status-dot-warning {
    background-color: #ffc107;
}

.time-tracking-status-dot-secondary {
    background-color: #6c757d;
}

body.dark-mode .table tbody tr {
    background-color: #181f27 !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode .table th,
body.dark-mode .table td {
    border-color: rgba(255, 255, 255, 0.18) !important;
}

body.dark-mode .table .btn,
body.dark-mode .table a {
    color: #f8fbff !important;
}

body.dark-mode .card,
body.dark-mode .card-body,
body.dark-mode .card-header,
body.dark-mode .card-footer,
body.dark-mode .alert,
body.dark-mode .alert-light,
body.dark-mode .bg-white,
body.dark-mode .bg-light,
body.dark-mode .bg-body-tertiary,
body.dark-mode .list-group-item,
body.dark-mode .list-group-item-action,
body.dark-mode .planner-entry-card,
body.dark-mode .planner-card-header,
body.dark-mode .planner-card-meta,
body.dark-mode .planner-card-works,
body.dark-mode .planner-card-workers,
body.dark-mode .planner-card-footer,
body.dark-mode .planner-day-list,
body.dark-mode .planner-card-no-workers {
    background-color: #171f28 !important;
    color: #eef4ff !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode .planner-card-worker-chip,
body.dark-mode .badge.text-bg-light,
body.dark-mode .badge.bg-light,
body.dark-mode .badge.text-bg-secondary,
body.dark-mode .badge.bg-secondary {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #f8fbff !important;
    border-color: rgba(255, 255, 255, 0.20) !important;
}

body.dark-mode .table thead th,
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .table tbody tr,
body.dark-mode .table-striped tbody tr:nth-of-type(odd),
body.dark-mode .table-hover tbody tr:hover {
    background-color: transparent !important;
}

body.dark-mode .table tbody tr {
    background-color: #171f28 !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.10) !important;
}

body.dark-mode .text-muted,
body.dark-mode .planner-employee-note,
body.dark-mode .planner-entry-meta,
body.dark-mode .planner-card-kfz,
body.dark-mode .planner-card-works,
body.dark-mode .form-text {
    color: #a1acbe !important;
}

body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom,
body.dark-mode .border-start,
body.dark-mode .border-end,
body.dark-mode .card.border-0,
body.dark-mode .card.shadow-sm,
body.dark-mode .alert {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode .form-control,
body.dark-mode .form-control:focus,
body.dark-mode .form-select,
body.dark-mode .form-select:focus {
    background-color: #1b232d !important;
    color: #eef4ff !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    box-shadow: none !important;
}

body.dark-mode .table thead th {
    background-color: #1f2b37 !important;
}

body.dark-mode .card-shaded,
body.dark-mode .card.shadow-sm {
    background-color: #171f28 !important;
}

body.dark-mode .planner-entry-card {
    border-color: rgba(255, 255, 255, 0.10) !important;
    box-shadow: none !important;
}

.employee-matrix-table th.sticky-left,
.employee-matrix-table td.sticky-left {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8f9fa;
}

.employee-matrix-table thead th.sticky-top {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8f9fa;
}

.employee-matrix-table th.sticky-left.sticky-top {
    z-index: 4;
}

/*
 * Mitarbeiterliste (Qualifikationsmatrix): Kopfzeile bleibt beim vertikalen Scrollen sichtbar UND die
 * horizontale Scrollleiste liegt am unteren Rand des sichtbaren Bereichs. Beides setzt voraus, dass die
 * Tabelle in einem EIGENEN, in der Höhe begrenzten Scrollcontainer liegt: Ein position:sticky-Kopf klebt
 * nur am nächsten Scrollcontainer, und .table-responsive (overflow-x:auto) war bisher ohne Höhenbegrenzung
 * -> nie vertikal scrollbar, der Kopf klebte nicht. Nur Desktop (die mobile Kartenansicht bleibt unverändert).
 * Der Kopf ist in Hell- und Dunkelmodus deckend (siehe .employee-matrix-table thead th und body.dark-mode ...).
 */
@media (min-width: 992px) {
    .employee-matrix-scroll {
        max-height: calc(100vh - 7rem);
        overflow: auto;
    }
}

.employee-matrix-table .employee-matrix-header-cell {
    vertical-align: top;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.employee-matrix-table .employee-matrix-cell-valid {
    background-color: #e8f5e9;
}

.employee-matrix-table .employee-matrix-cell-expiring {
    background-color: #fff8e1;
}

.employee-matrix-table .employee-matrix-cell-expired {
    background-color: #f8d7da;
}

.employee-matrix-table .employee-matrix-cell-missing {
    background-color: #f8f9fa;
}

.employee-matrix-table .employee-matrix-cell-editable:hover {
    outline: 2px solid rgba(13, 110, 253, .35);
    outline-offset: -2px;
}

.employee-matrix-table .btn-outline-primary,
.employee-matrix-table .btn-outline-warning {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .planner-card-note,
body.dark-mode .planner-card-time,
body.dark-mode .planner-card-customer,
body.dark-mode .planner-card-kfz {
    color: #eef4ff !important;
}

body.dark-mode .planner-card-note.text-muted,
body.dark-mode .planner-card-kfz.text-muted {
    color: #a1acbe !important;
}

body.dark-mode .badge.text-bg-light,
body.dark-mode .badge.bg-light {
    color: #edf2ff !important;
}

body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-success,
body.dark-mode .btn-outline-danger,
body.dark-mode .btn-outline-info {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-success:hover,
body.dark-mode .btn-outline-danger:hover,
body.dark-mode .btn-outline-info:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode .nav-link,
body.dark-mode .navbar-brand,
body.dark-mode .text-body,
body.dark-mode .text-muted,
body.dark-mode .planner-employee-note,
body.dark-mode .planner-entry-meta,
body.dark-mode .planner-entry-title,
body.dark-mode .planner-card-actions a,
body.dark-mode .planner-employee-chip,
body.dark-mode .dropdown-item,
body.dark-mode .form-label,
body.dark-mode .card-title,
body.dark-mode .card-text,
body.dark-mode .badge,
body.dark-mode .list-group-item,
body.dark-mode .planner-card-header,
body.dark-mode .planner-card-meta,
body.dark-mode .btn {
    color: #e8eef5 !important;
}

body.dark-mode .text-muted,
body.dark-mode .planner-employee-note,
body.dark-mode .planner-entry-meta,
body.dark-mode .planner-card-meta,
body.dark-mode .form-text {
    color: #a5adba !important;
}

body.dark-mode .btn-outline-light {
    color: #f2f7fb;
    border-color: rgba(255, 255, 255, 0.32);
    background-color: transparent;
}

body.dark-mode .btn-outline-light:hover,
body.dark-mode .btn-outline-light:focus,
body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-secondary:focus,
body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-primary:focus,
body.dark-mode .btn-outline-danger:hover,
body.dark-mode .btn-outline-danger:focus,
body.dark-mode .btn-outline-success:hover,
body.dark-mode .btn-outline-success:focus,
body.dark-mode .btn-outline-info:hover,
body.dark-mode .btn-outline-info:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-danger,
body.dark-mode .btn-outline-success,
body.dark-mode .btn-outline-info,
body.dark-mode .btn-outline-dark {
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    background-color: rgba(255, 255, 255, 0.03) !important;
}

body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-dark {
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.32) !important;
    background-color: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-secondary:focus {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.42) !important;
}

body.dark-mode .planner-employee-chip {
    background: #1e262f !important;
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-mode .planner-entry-workers {
    background: #182028 !important;
}

body.dark-mode .planner-drop-empty {
    background: rgba(13, 110, 253, 0.14) !important;
    border-color: rgba(13, 110, 253, 0.5) !important;
    color: #c8dbf !important;
}

body.dark-mode .form-control,
body.dark-mode .form-control:focus,
body.dark-mode .form-select,
body.dark-mode .form-select:focus {
    background-color: #1b232c !important;
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: none !important;
}

body.dark-mode .form-control::placeholder,
body.dark-mode .form-control::-webkit-input-placeholder,
body.dark-mode .form-control::-moz-placeholder,
body.dark-mode .form-control:-ms-input-placeholder,
body.dark-mode .form-control::-ms-input-placeholder,
body.dark-mode textarea::placeholder,
body.dark-mode textarea::-webkit-input-placeholder,
body.dark-mode textarea::-moz-placeholder,
body.dark-mode textarea:-ms-input-placeholder,
body.dark-mode textarea::-ms-input-placeholder {
    color: rgba(232, 238, 245, 0.75) !important;
    opacity: 1 !important;
}

body.dark-mode .form-select {
    background-color: #1b232c !important;
    color: #e8eef5 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-mode .form-select option {
    color: #e8eef5 !important;
    background-color: #1b232c !important;
}

body.dark-mode .btn-outline-dark:hover,
body.dark-mode .btn-outline-dark:focus {
    background-color: rgba(255, 255, 255, 0.10) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
    color: #ffffff !important;
}

body.dark-mode .table .btn,
body.dark-mode .table a {
    color: #e8eef5 !important;
}

/* ─── Matrix Drag-and-Drop ───────────────────────────────────────────────── */

/* Grip-Icons als Handles – sanft sichtbar, deutlich beim Hover */
.employee-matrix-table th[draggable="true"] .bi-grip-vertical,
.employee-matrix-table th[draggable="true"] .bi-grip-horizontal {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}
.employee-matrix-table th[draggable="true"]:hover .bi-grip-vertical,
.employee-matrix-table th[draggable="true"]:hover .bi-grip-horizontal {
    opacity: 0.85;
}
.employee-matrix-table th[draggable="true"] {
    user-select: none;
}

/* Während Drag: Cursor + Textauswahl global sperren */
body.matrix-is-sorting,
body.matrix-is-sorting * {
    cursor: grabbing !important;
    user-select: none !important;
}

/* ── Zeilen-Drag ─────────────────────────────────────────────────────────── */

/* Original-Zeile während des Ziehens: feste Hintergrundfarbe, kein Durchscheinen */
.employee-matrix-table tr.matrix-row-dragging > th,
.employee-matrix-table tr.matrix-row-dragging > td {
    background-color: #e8eeff !important;
    outline: 1px dashed rgba(13, 110, 253, 0.45);
    outline-offset: -1px;
}

/* Drop-Position: saubere blaue Linie oberhalb der Zielzeile */
.employee-matrix-table tr.matrix-row-drop-before > th,
.employee-matrix-table tr.matrix-row-drop-before > td {
    border-top: 3px solid #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.06) !important;
}

/* ── Spalten-Drag ────────────────────────────────────────────────────────── */

/* Quellspalte: feste Hintergrundfarbe, kein Durchscheinen */
.employee-matrix-table th.matrix-col-dragging,
.employee-matrix-table td.matrix-col-dragging {
    background-color: #e8eeff !important;
    outline: 1px dashed rgba(13, 110, 253, 0.45);
    outline-offset: -1px;
}

/* Zielspalte: blaue linke Kante an allen Zellen */
.employee-matrix-table th.matrix-col-drop-before,
.employee-matrix-table td.matrix-col-drop-before {
    border-left: 3px solid #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.06) !important;
}

/* ── Globales Feedback-System ────────────────────────────────────────────── */
.feedback-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1045; /* unter Bootstrap-Modal (1055), über normalem Seiteninhalt */
    border-radius: 50px;
    padding: 0.55rem 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

.feedback-toast-container {
    position: fixed;
    bottom: 90px; /* oberhalb des .feedback-fab, keine Überlagerung */
    right: 20px;
    z-index: 1080;
}

.feedback-dropzone {
    border: 2px dashed #adb5bd;
    border-radius: .5rem;
    padding: 1.25rem;
    text-align: center;
    color: #6c757d;
    cursor: pointer;
    font-size: .9rem;
    transition: background-color .15s ease, border-color .15s ease;
}

.feedback-dropzone.dragover {
    background-color: rgba(13, 110, 253, .08);
    border-color: #0d6efd;
}

.feedback-preview-thumb {
    position: relative;
    width: 72px;
    height: 72px;
}

.feedback-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: .375rem;
    border: 1px solid #dee2e6;
}

.feedback-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
}

.feedback-attachment-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    cursor: pointer;
}

@media (max-width: 575.98px) {
    .feedback-fab {
        bottom: 16px;
        right: 16px;
        padding: 0.6rem 0.75rem;
    }
    .feedback-toast-container {
        bottom: 78px;
        right: 16px;
        left: 16px;
    }
}

body.dark-mode .feedback-dropzone {
    border-color: #495057;
    color: #adb5bd;
}
body.dark-mode .feedback-dropzone.dragover {
    background-color: rgba(99, 149, 255, .12);
    border-color: #6395ff;
}

/* ── Dark-Mode-Anpassungen ───────────────────────────────────────────────── */

/* Linke sticky Schulungsspalte: deckender Hintergrund im Dark Mode.
   Überschreibt body.dark-mode .table th/td { background-color: transparent !important }
   und das inline style="background:#f8f9fa" aus dem PHP-Template.
   Spezifität (0,3,2) schlägt Basisregel (0,2,2). */
body.dark-mode .employee-matrix-table th.sticky-left,
body.dark-mode .employee-matrix-table td.sticky-left {
    background-color: #1f2b37 !important;
}

body.dark-mode .employee-matrix-table tr.matrix-row-dragging > th,
body.dark-mode .employee-matrix-table tr.matrix-row-dragging > td {
    background-color: #1a2742 !important;
    color: #eef4ff !important;
    outline: 1px dashed rgba(99, 149, 255, 0.55) !important;
    outline-offset: -1px;
}
body.dark-mode .employee-matrix-table tr.matrix-row-drop-before > th,
body.dark-mode .employee-matrix-table tr.matrix-row-drop-before > td {
    border-top-color: #6395ff !important;
    background-color: rgba(99, 149, 255, 0.09) !important;
}
body.dark-mode .employee-matrix-table th.matrix-col-dragging,
body.dark-mode .employee-matrix-table td.matrix-col-dragging {
    background-color: #1a2742 !important;
    outline-color: rgba(99, 149, 255, 0.5);
}
body.dark-mode .employee-matrix-table th.matrix-col-drop-before,
body.dark-mode .employee-matrix-table td.matrix-col-drop-before {
    border-left-color: #6395ff !important;
    background-color: rgba(99, 149, 255, 0.09) !important;
}

/* Text auf höchstens zwei Zeilen begrenzen (z.B. Anlagenbezeichnung); der volle Text steht im title-Tooltip. */
.text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

