/* Quick Add Truck board (Carrier Dashboard).
   Theme colours come from Bootstrap classes set in the markup / JS (bg-primary, border-primary,
   bg-primary-text-color); the app themes don't define --bs-primary, so don't use it here.
   Neutral tints use rgba(0,0,0,x) so they sit on light and dark themes alike. */

/* ---------- Sections ---------- */

.qat-board fieldset.qat-section {
    border: 1px solid rgba(0, 0, 0, .1) !important;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    padding: 10px 12px 12px !important;
    margin-bottom: 10px !important;
}

.qat-board fieldset.qat-section > legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    opacity: .85;
}

    .qat-board fieldset.qat-section > legend .bi {
        font-size: 14px;
        opacity: .7;
    }

.qat-board fieldset.qat-notes ul {
    padding-left: 18px;
    line-height: 1.6;
}

.qat-board fieldset.qat-notes kbd {
    padding: 1px 5px;
    font-size: 11px;
    border-radius: 3px;
}

/* ---------- Fields ---------- */

.qat-board .form-group > label {
    margin-bottom: 3px;
    font-size: 12px;
    font-weight: 500;
    opacity: .8;
}

.qat-board .form-control-sm {
    height: 30px;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .qat-board .form-control-sm:focus {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
    }

    .qat-board .form-control-sm[readonly] {
        background-color: rgba(0, 0, 0, .04);
        font-weight: 600;
    }

.qat-board .invalid {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .15);
}

.qat-board input[type=number]::-webkit-outer-spin-button,
.qat-board input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qat-board input[type=number] {
    -moz-appearance: textfield;
}

.qat-board .qat-date-input {
    max-width: 160px;
}

.qat-board [data-qat="search"] {
    height: 30px;
    padding-left: 4px;
    padding-right: 4px;
    white-space: nowrap;
}

/* ---------- Calendar entry look (shared by entries, truck card and its drag ghost) ----------
   Not scoped to .qat-board: FullCalendar clones the card onto <body> while dragging. */

/* background / border / text colour come from bg-primary, border-primary and bg-primary-text-color */
.fc-daygrid-event.qat-event,
.qat-preview.qat-ready {
    border-left: 4px solid var(--qat-type-color, transparent) !important;
}

.qat-entry {
    padding: 1px 3px;
    line-height: 1.3;
    overflow: hidden;
}

.qat-entry-title {
    font-weight: 600;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qat-entry-sub {
    font-size: 11px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Truck card (drag source) ---------- */

.qat-preview {
    display: block;
    width: 100%;
    margin: 0 !important;
    border-radius: 6px !important;
    user-select: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

    .qat-preview .qat-entry {
        padding: 10px 12px;
    }

    .qat-preview .qat-entry-title {
        font-size: 14px;
        padding-right: 30px;
    }

    .qat-preview .qat-entry-sub {
        margin-top: 2px;
        font-size: 12px;
    }

    .qat-preview .qat-grip {
        float: right;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        margin: -2px -4px 0 0;
        border-radius: 999px;
        background-color: rgba(255, 255, 255, .18);
        font-size: 15px;
        line-height: 1;
    }

    /* incomplete form: a drop-placeholder look instead of a faded button */
    .qat-preview.qat-preview-empty {
        background-color: transparent !important;
        background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .025) 0 8px, transparent 8px 16px);
        border: 1px dashed rgba(0, 0, 0, .25) !important;
        color: inherit;
        opacity: .65;
        cursor: not-allowed;
    }

        .qat-preview.qat-preview-empty .qat-grip {
            background-color: rgba(0, 0, 0, .06);
        }

    .qat-preview.qat-ready {
        cursor: grab;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
    }

        .qat-preview.qat-ready:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
        }

        .qat-preview.qat-ready:active {
            transform: none;
            box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
        }

    .qat-preview:focus-visible {
        outline: 2px solid rgba(0, 0, 0, .35);
        outline-offset: 2px;
    }

/* ---------- Drag ghost (QuickAddTruckCalender.js → DragGhost) ----------
   Appended to <body>, so not scoped to .qat-board. Colours come from theme classes set in JS. */

/* FullCalendar's own floating clone is replaced by the ghost while dragging */
body.qat-dragging > .fc-event {
    opacity: 0 !important;
}

body.qat-dragging,
body.qat-dragging * {
    cursor: grabbing !important;
    user-select: none;
}

.qat-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 3000;
    width: 250px;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(-9999px, -9999px, 0);
    will-change: transform;
    font-size: 13px;
    line-height: 1.3;
}

    .qat-ghost.is-visible {
        opacity: 1;
        transition: opacity .12s ease;
    }

        .qat-ghost.is-visible .qat-ghost-card {
            animation: qat-ghost-in .16s ease-out;
        }

.qat-ghost-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid;
    border-left: 4px solid var(--qat-type-color, transparent) !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .28), 0 2px 6px rgba(0, 0, 0, .14);
    transition: opacity .12s ease, filter .12s ease;
}

.qat-ghost-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .2);
    font-size: 15px;
}

.qat-ghost-body {
    min-width: 0;
}

.qat-ghost-title {
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qat-ghost-sub {
    margin-top: 1px;
    font-size: 12px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* the "what happens on release" chip */
.qat-ghost-target {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    transition: background-color .12s ease;
}

.qat-ghost[data-state="blocked"] .qat-ghost-card {
    opacity: .7;
    filter: grayscale(.5);
}

@keyframes qat-ghost-in {
    from {
        transform: scale(.94);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

/* calendar hints while something is being dragged */
.qat-board.qat-drop-active .fc .fc-scrollgrid {
    outline: 2px dashed rgba(0, 0, 0, .18);
    outline-offset: 3px;
}

.qat-board.qat-drop-active .fc .qat-day-past {
    opacity: .55;
}

@media (prefers-reduced-motion: reduce) {
    .qat-ghost.is-visible .qat-ghost-card {
        animation: none;
    }
}

.qat-board [data-qat="preview-hint"] {
    margin-top: 6px !important;
    font-size: 12px;
}

/* ---------- Toolbar: filter, trailer types, counts ---------- */

.qat-board .qat-toolbar {
    padding-bottom: 10px;
    margin-bottom: 10px !important;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.qat-board .qat-filter {
    max-width: 260px;
    padding-left: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 9px center;
    background-size: 13px 13px;
}

.qat-board .qat-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    transition: opacity .15s ease, background-color .15s ease;
}

    .qat-board .qat-type:not(.active) {
        opacity: .5;
    }

        .qat-board .qat-type:not(.active) .qat-type-dot {
            background: transparent;
            box-shadow: inset 0 0 0 2px var(--qat-type-color);
        }

.qat-board .qat-type-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--qat-type-color);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}

.qat-board .qat-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

    .qat-board .qat-count > span {
        font-size: 12px;
        font-weight: 700;
    }

/* ---------- Calendar ---------- */

.qat-board .fc {
    --fc-border-color: rgba(0, 0, 0, .08);
    --fc-today-bg-color: rgba(255, 193, 7, .1);
    --fc-highlight-color: rgba(0, 0, 0, .06);
    --fc-neutral-bg-color: rgba(0, 0, 0, .03);
    --fc-list-event-hover-bg-color: rgba(0, 0, 0, .03);
}

    /* toolbar */
    .qat-board .fc .fc-toolbar.fc-header-toolbar {
        margin-bottom: 12px;
        gap: 8px;
    }

    .qat-board .fc .fc-toolbar-title {
        font-size: 1.05rem;
        font-weight: 600;
    }

    .qat-board .fc .fc-toolbar .btn {
        display: inline-flex;
        align-items: center;
        height: 30px;
        padding: 0 12px;
        font-size: 12px;
    }

    .qat-board .fc .fc-toolbar .fc-prev-button,
    .qat-board .fc .fc-toolbar .fc-next-button {
        padding: 0 8px;
    }

    .qat-board .fc .fc-toolbar .fc-today-button {
        margin-left: 8px;
    }

    /* grid */
    .qat-board .fc .fc-scrollgrid {
        border: 1px solid rgba(0, 0, 0, .1);
        border-radius: 6px;
        overflow: hidden;
    }

    .qat-board .fc .fc-col-header-cell {
        background-color: rgba(0, 0, 0, .03);
        padding: 8px 0;
    }

    .qat-board .fc .fc-col-header-cell-cushion {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .06em;
        text-decoration: none;
        color: inherit;
        opacity: .65;
    }

    .qat-board .fc .fc-daygrid-day-frame {
        min-height: 100px;
        transition: background-color .15s ease;
    }

    .qat-board .fc .fc-day-sat,
    .qat-board .fc .fc-day-sun {
        background-color: rgba(0, 0, 0, .015);
    }

    .qat-board .fc .fc-daygrid-day:not(.qat-day-past):hover .fc-daygrid-day-frame {
        background-color: rgba(0, 0, 0, .025);
    }

    .qat-board .fc .fc-daygrid-day-top {
        padding: 4px 4px 0;
    }

    .qat-board .fc .fc-daygrid-day-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 5px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 500;
        text-decoration: none;
        color: inherit;
    }

    .qat-board .fc .fc-day-other .fc-daygrid-day-number {
        opacity: .4;
    }

    .qat-board .fc .fc-day-today .fc-daygrid-day-number {
        font-weight: 700;
        background-color: rgba(0, 0, 0, .07);
    }

    .qat-board .fc .qat-day-past {
        background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .03) 0 6px, transparent 6px 12px);
    }

        .qat-board .fc .qat-day-past .fc-daygrid-day-number {
            opacity: .5;
        }

    /* drop target while dragging */
    .qat-board .fc .fc-highlight {
        box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25);
        border-radius: 4px;
        outline: 1px dashed rgba(0, 0, 0, .35);
        outline-offset: -5px;
    }

    /* entries */
    .qat-board .fc .fc-daygrid-event-harness {
        margin: 0 4px 3px;
    }

    .qat-board .fc .fc-daygrid-event.qat-event {
        margin: 0 !important;
        padding: 2px 4px;
        border-radius: 4px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
        cursor: pointer;
        white-space: normal;
        transition: transform .15s ease, box-shadow .15s ease;
    }

        .qat-board .fc .fc-daygrid-event.qat-event:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, .2);
        }

        .qat-board .fc .fc-daygrid-event.qat-event:focus-visible {
            outline: 2px solid rgba(0, 0, 0, .4);
            outline-offset: 1px;
        }

    .qat-board .fc .fc-event-mirror.qat-event {
        opacity: .8;
        box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
    }

    .qat-board .fc .qat-event-past {
        opacity: .65;
        box-shadow: none !important;
    }

    /* "+N more" and its popover */
    .qat-board .fc .fc-daygrid-more-link {
        margin: 0 4px;
        padding: 1px 6px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 600;
        text-decoration: none;
        color: inherit;
        opacity: .75;
    }

        .qat-board .fc .fc-daygrid-more-link:hover {
            background-color: rgba(0, 0, 0, .06);
            opacity: 1;
        }

    .qat-board .fc .fc-popover {
        border: 1px solid rgba(0, 0, 0, .12);
        border-radius: 6px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
        overflow: hidden;
    }

    .qat-board .fc .fc-popover-header {
        padding: 6px 10px;
        font-size: 12px;
        font-weight: 600;
    }

    .qat-board .fc .fc-popover-body {
        min-width: 220px;
        padding: 6px 0;
    }

    /* list view: plain rows, no colour block */
    .qat-board .fc .fc-list {
        border: 1px solid rgba(0, 0, 0, .1);
        border-radius: 6px;
        overflow: hidden;
    }

    .qat-board .fc .fc-list-day-cushion {
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
    }

        .qat-board .fc .fc-list-day-cushion a {
            text-decoration: none;
            color: inherit;
        }

    .qat-board .fc .fc-list-event.qat-event {
        border-left: 0 !important;
        background-color: transparent !important;
        color: inherit !important;
        cursor: pointer;
    }

        .qat-board .fc .fc-list-event.qat-event td {
            padding: 8px 12px;
            vertical-align: middle;
        }

    .qat-board .fc .fc-list-event .qat-entry-sub {
        white-space: normal;
        opacity: .65;
    }

    .qat-board .fc .fc-list-event-dot {
        border-color: var(--qat-type-color, currentColor);
    }

    .qat-board .fc .fc-list-empty {
        background-color: transparent;
        padding: 40px 0;
        opacity: .6;
    }

/* ---------- Modals (same close button as the rest of the app) ---------- */

.qat-board .modal-content {
    border: 0;
    border-radius: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.qat-board .modal-footer {
    background-color: rgba(0, 0, 0, .03);
    border-top: 1px solid rgba(0, 0, 0, .08);
    padding: 10px 16px;
}

.qat-board .header-btn-close {
    outline: 0;
    transform: translate(0.5rem, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 1.5rem;
    height: 1.5rem;
    margin: unset;
    padding: unset;
    opacity: unset;
    color: inherit;
    background-color: transparent;
    border: 0;
}

    .qat-board .header-btn-close:hover,
    .qat-board .header-btn-close:active,
    .qat-board .header-btn-close:focus {
        border-radius: 50%;
        border: 0;
        outline: 0;
        filter: brightness(0.5);
    }

.qat-board .btn-close-image {
    width: 16px;
    height: 16px;
    fill-opacity: 0.6;
}
