/* public/css/responsive.css
 *
 * Tablet- und Handy-Anpassungen für die Web-App (wird global in
 * layouts/sections/styles.blade.php eingebunden).
 *
 * Breakpoints: < 768px Handy, 768–1199px Tablet, ab 1200px Desktop.
 */

/* ---------- Ressourcen-Spalte im Einsatzkalender (Touren) ---------- */
.trl-container {
    font-size: 0.85rem;
    line-height: 1.3;
}

.trl-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.trl-vehicle {
    color: #6c757d;
    font-size: 0.8rem;
}

.trl-block {
    margin-top: 8px;
}

.trl-label {
    font-weight: 600;
    margin-bottom: 2px;
}

.trl-person {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
    padding: 1px 0;
}

.trl-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.trl-badge {
    font-size: 0.65rem;
    padding: 0.2em 0.45em;
    line-height: 1.2;
}

.trl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    width: 100%;
}

.trl-empty {
    color: #adb5bd;
    font-style: italic;
}

.trl-hint {
    margin-top: 6px;
    color: #6c757d;
    font-size: 0.75rem;
}

.trl-change-btn {
    margin-top: 8px;
    font-size: 0.75rem;
    padding: 2px 8px;
}

/* FullCalendar: Ressourcen-Zellen dürfen umbrechen, Events bleiben kompakt */
.fc .fc-datagrid-cell-cushion {
    white-space: normal;
}

/* ---------- Einsätze im Zeitstrahl (Basis) ---------- */
.fc .fc-timeline-event {
    padding: 0;
    overflow: hidden;
}

.fc .fc-timeline-event .fc-event-main {
    overflow: hidden;
}

/* Hinweisfeld am Mauszeiger beim Ziehen/Verlängern */
#drag-time-tip {
    position: fixed;
    z-index: 10000;
    display: none;
    pointer-events: none;
    background: #1f2937;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

#drag-time-tip.visible {
    display: block;
}

/* ---------- Tablet (bis 1199px) ---------- */
@media (max-width: 1199.98px) {
    .job-list-container .job-item {
        width: calc(33.333% - 15px);
        min-width: 160px;
    }

    .job-search-input {
        width: 100%;
    }

    .job-filter-badge {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    #job-filters,
    #type-filters {
        gap: 8px !important;
    }
}

/* ---------- Handy (bis 767px) ---------- */
@media (max-width: 767.98px) {
    /* Seitenköpfe: Titel, Datums-Navigation und Buttons untereinander mit Abstand */
    .content-wrapper .row.mb-4.align-items-center > [class*="col-"] {
        margin-bottom: 0.75rem;
    }

    .content-wrapper .row.mb-4.align-items-center > [class*="col-"]:last-child {
        margin-bottom: 0;
    }

    .content-wrapper .row.mb-4.align-items-center .text-end,
    .content-wrapper .row.mb-4.align-items-center .justify-content-end,
    .content-wrapper .row.mb-4.align-items-center .justify-content-md-end {
        text-align: left !important;
        justify-content: flex-start !important;
    }

    .content-wrapper .btn-group .btn,
    .content-wrapper .btn-group > a > .btn {
        white-space: normal;
    }

    .content-wrapper .btn.me-3 {
        margin-right: 0.5rem !important;
        margin-bottom: 0.5rem;
    }

    /* Auftragsdeck in der Einsatzplanung: zwei Karten pro Zeile */
    .job-list-container {
        max-height: 320px;
        gap: 8px;
        padding: 8px;
    }

    .job-list-container .job-item {
        width: calc(50% - 8px);
        min-width: 0;
        font-size: 0.85rem;
        padding: 8px;
    }

    .job-search-container {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }

    .job-filter-badge {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .job-filter-badge.active {
        transform: none;
    }

    /* Kalender: weniger Innenabstand, horizontales Scrollen für die Zeitachse */
    #calendar {
        padding: 6px !important;
        min-height: 400px !important;
    }

    .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .fc .fc-toolbar-title {
        font-size: 1rem;
        width: 100%;
        text-align: center;
        order: -1;
    }

    .fc .fc-button {
        padding: 0.25em 0.5em;
        font-size: 0.8rem;
    }

    .fc .fc-datagrid-cell-cushion {
        padding: 4px;
    }

    .trl-container {
        font-size: 0.78rem;
    }

    .trl-change-btn {
        width: 100%;
    }

    /* Toasts nicht breiter als der Bildschirm */
    #toast-container {
        min-width: 0 !important;
        max-width: calc(100vw - 2rem) !important;
        width: calc(100vw - 2rem);
    }

    /* Tourdetails: die drei Spalten (Fahrer, Mitarbeiter, Fahrzeug) untereinander */
    #tourDetails table td[style*="width: 33%"],
    #tourDetails table tr > td[style*="vertical-align: top"] {
        display: block;
        width: 100% !important;
        padding-bottom: 6px;
    }

    #tourDetails table tr[style*="height: 10px"] {
        display: none;
    }

    #tourDetails .text-truncate[style*="max-width: 220px"] {
        max-width: 100% !important;
    }

    /* Formulare: volle Breite */
    .content-wrapper .col-xl-10.col-xxl-8 {
        width: 100%;
    }

    /* Modale: Formular-Spalten untereinander */
    .modal-lg .col-lg-7,
    .modal-lg .col-lg-5 {
        width: 100%;
    }
}

/* ---------- Touch-Geräte allgemein ---------- */
@media (hover: none) and (pointer: coarse) {
    .job-item {
        cursor: default;
    }

    .job-item:active {
        cursor: default;
    }

    /* größere Trefferflächen für Buttons im Kalender */
    .fc .fc-button {
        min-height: 36px;
    }

    .close-button {
        font-size: 18px !important;
        padding: 4px;
    }
}

/* ======================================================================
   Auftragskarten (Deck) und Einsätze (Kalender) – modernes Kartendesign
   Farbe des Auftragstyps als Akzentstreifen + leichte Tönung (--card-color)
   ====================================================================== */
.job-list-container .job-item.job-card,
.fc .job-item.job-event {
    position: relative;
    background: var(--card-color, #f0f0f0);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    color: #1f2937;
    padding: 10px 12px;
    box-sizing: border-box;
    transition: box-shadow 0.15s ease;
}

.job-list-container .job-item.job-card {
    cursor: grab;
}

.job-list-container .job-item.job-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

.job-list-container .job-item.job-card:active {
    cursor: grabbing;
}

.job-list-container .job-item.job-locked {
    background: #f3f4f6;
    border-style: dashed;
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.job-card-head,
.job-event-head {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.job-card-title,
.job-event-title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.25;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.job-card-meta,
.job-event-meta {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.job-card-line,
.job-event-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    line-height: 1.3;
    color: #374151;
    min-width: 0;
}

.job-card-line i,
.job-event-line i {
    flex: 0 0 14px;
    width: 14px;
    text-align: center;
    color: #374151;
    font-size: 0.75rem;
}

.job-card-line span,
.job-event-line span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.job-card-customer {
    color: #6b7280;
}

.job-card-foot,
.job-event-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.job-card-chip,
.job-event-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
}

.job-card-chip i,
.job-event-chip i {
    color: #374151;
    font-size: 0.7rem;
}

.job-card-flag,
.job-event-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    white-space: nowrap;
}

.job-card-flag-recurring,
.job-event-flag-recurring {
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(255, 255, 255, 0.7);
    color: #1f2937;
    font-size: 0.95rem;
}

.job-card-flag-overdue,
.job-event-flag-overdue {
    background: #dc2626;
    color: #fff;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-left: auto;
}

/* alte absolute Positionierung der Badges aufheben */
.job-card .badge-overdue,
.job-card .icon-recurring {
    position: static;
    bottom: auto;
    right: auto;
    top: auto;
}

/* ---------- Einsätze im Kalender ---------- */
.fc .job-item.job-event {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow: hidden;
}

.fc .job-event-compact {
    padding: 3px 7px;
}

.fc .job-event-title {
    font-size: 0.85rem;
    white-space: nowrap;
    display: block;
    -webkit-line-clamp: unset;
}

.fc .job-event-compact .job-event-title {
    font-size: 0.8rem;
}

.fc .job-event-meta {
    margin-top: 3px;
}

.fc .job-event-foot {
    margin-top: 4px;
}

.fc .job-event-dayof {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 600;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    padding: 2px 6px;
}

.fc .job-event-flag-recurring {
    width: 18px;
    height: 18px;
    font-size: 0.85rem;
}

.fc .job-event-flag-recurring i {
    line-height: 1;
}

.fc .job-event-flag-small {
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 0;
}

.fc .fc-timeline-event {
    background: transparent;
    border: none;
}

.fc .fc-timeline-event:hover .job-event {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.fc .job-event-dragging {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    outline: 2px solid #1f2937;
}

.fc .job-event .close-button {
    position: static;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    color: #dc2626;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    margin-left: 1px;
}

.fc .job-event .close-button:hover {
    background: #dc2626;
    color: #fff;
}

/* Deck: Karten gleichmäßig, Abstand */
.job-list-container {
    gap: 12px;
}

/* ---------- Info-Popup für Einsätze ---------- */
.eim .modal-header {
    padding-bottom: 0.75rem;
}

.eim-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: #adb5bd;
}

.eim-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1rem;
}

.eim-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: none;
    letter-spacing: 0;
    background: #eef0f3;
    color: #374151;
}

.eim-chip-status {
    background: var(--chip-color, #7f7f7f);
    color: #fff;
}

.eim-chip-danger {
    background: #fde8e8;
    color: #b42318;
}

.eim-chip-info {
    background: #e8f0fe;
    color: #1d4ed8;
}

.eim-chip-muted {
    background: #eef0f3;
    color: #4b5563;
}

.eim-grid {
    display: grid;
    grid-template-columns: minmax(130px, 36%) 1fr;
    row-gap: 8px;
    column-gap: 16px;
    font-size: 0.92rem;
}

.eim-label {
    color: #6b7280;
    text-transform: none;
    letter-spacing: 0;
    padding-top: 1px;
}

.eim-value {
    color: #111827;
    word-break: break-word;
}

@media (max-width: 575.98px) {
    .eim-grid {
        grid-template-columns: 1fr;
        row-gap: 2px;
    }

    .eim-label {
        margin-top: 8px;
        font-size: 0.78rem;
    }
}
