/* ---------------------------------------------------------------------------
   Plant Library - the list (View.PlantLibrary), one item (View.PlantItemDetail), the menu-bar
   tractor and the checkout bands on plant rows in the calendar. See PlantLibrary-Design.md
   section 7. Light only, like the rest of the Scheduler.

   Band colour: a slate blue, so a checkout can't be mistaken for the teal on-call band, the
   amber "awaiting work" tint or a job status colour. Status text always says its status in
   words; colour is a second cue.
   --------------------------------------------------------------------------- */
:root {
    --totm-plant: #3F51B5;
    --totm-plant-band: rgba(63, 81, 181, 0.12);
    --totm-plant-ok: #2E7D32;
    --totm-plant-warn: #B26A00;
    --totm-plant-danger: #C62828;
}

/* Menu-bar tractor: sits on the FA glyph's baseline and size. */
#HeaderMiddlePanel button .PlantLibraryTractor {
    display: inline-block;
    vertical-align: -0.125em;
}

/* ── Calendar bands (new engine, then FullCalendar) ───────────────────────────────────────── */

.cal-band.PlantCheckoutBand {
    position: absolute;
    background: var(--totm-plant-band);
    border-top: 1px solid var(--totm-plant);
    border-bottom: 1px solid var(--totm-plant);
    border-left: 3px solid var(--totm-plant);
    pointer-events: none;
    box-sizing: border-box;
}

/* Who has the item, written inside its band on either engine. Cut short with an ellipsis rather
   than wrapping, so a one-hour band in Week view still shows the start of the name. */
.PlantCheckoutBand .cal-band-label {
    display: block;
    padding: 2px 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--totm-plant);
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.PlantCheckoutBand--overdue .cal-band-label {
    color: var(--totm-plant-danger);
}

.cal-band.PlantCheckoutBand--returned {
    border-right: 3px solid var(--totm-plant);
}

.cal-band.PlantCheckoutBand--overdue {
    background: rgba(198, 40, 40, 0.10);
    border-color: var(--totm-plant-danger);
}

.fc-bgevent.PlantCheckoutBand {
    background: var(--totm-plant-band) !important;
    opacity: 1 !important;
    border-top: 1px solid var(--totm-plant);
    border-bottom: 1px solid var(--totm-plant);
    border-left: 3px solid var(--totm-plant);
    box-sizing: border-box;
}

.fc-bgevent.PlantCheckoutBand--returned {
    border-right: 3px solid var(--totm-plant);
}

.fc-bgevent.PlantCheckoutBand--overdue {
    background: rgba(198, 40, 40, 0.10) !important;
    border-color: var(--totm-plant-danger);
}

.user-name-listing.PlantResourceLink {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

/* The "!" after a plant item's name while it has an unresolved issue (View.Calendar
   appendPlantIssueIcon). A filled round badge, so it reads at the row label's small size. */
.PlantIssueFlag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 5px;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    flex: 0 0 auto;
}

.PlantIssueFlag--blocking {
    background: var(--totm-plant-danger);
}

.PlantIssueFlag--warning {
    background: var(--totm-plant-warn);
}

/* ── Status chips ─────────────────────────────────────────────────────────────────────────── */

.PlantStatus {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.PlantStatusAvailable {
    color: var(--totm-plant-ok);
    background: rgba(46, 125, 50, 0.08);
}

.PlantStatusOut {
    color: var(--totm-plant-warn);
    background: rgba(178, 106, 0, 0.08);
}

.PlantStatusOverdue,
.PlantStatusUnavailable {
    color: var(--totm-plant-danger);
    background: rgba(198, 40, 40, 0.08);
}

.PlantIssueCount {
    display: inline-block;
    margin-right: 4px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.PlantIssueCountBlocking {
    color: var(--totm-plant-danger);
    border: 1px solid var(--totm-plant-danger);
}

.PlantIssueCountWarning {
    color: var(--totm-plant-warn);
    border: 1px solid var(--totm-plant-warn);
}

/* ── List ─────────────────────────────────────────────────────────────────────────────────── */

.PlantLibraryFilters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.PlantLibrarySearch {
    min-width: 260px;
    padding: 5px 8px;
}

.PlantLibraryFilter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.PlantLibraryCount {
    margin-left: auto;
    color: #666;
}

.PlantLibraryNotice {
    margin: 6px 0;
    padding: 6px 10px;
    border: 1px solid var(--totm-plant-danger);
    color: var(--totm-plant-danger);
    font-weight: bold;
}

.PlantLibraryTable {
    width: 100%;
}

.PlantLibraryTable tbody tr.PlantLibraryRow {
    cursor: pointer;
}

.PlantLibraryTable tbody tr.PlantLibraryRow:hover,
.PlantLibraryTable tbody tr.PlantLibraryRow:focus {
    background: #F2F4FB;
    outline: none;
}

.PlantLibraryName {
    font-weight: bold;
}

.PlantLibraryCode {
    font-size: 11px;
    color: #666;
}

.PlantLibraryEmpty,
.PlantDetailEmpty {
    padding: 14px;
    color: #666;
    text-align: center;
}

.PlantLibraryActions {
    text-align: right;
}

/* ── Detail ───────────────────────────────────────────────────────────────────────────────── */

.PlantDetailBack {
    margin-bottom: 8px;
}

.PlantDetailSummary {
    padding: 10px 12px;
    border: 1px solid #DDD;
    border-radius: 4px;
    background: #FFF;
}

.PlantDetailTitle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.PlantDetailName {
    font-size: 18px;
    font-weight: bold;
}

.PlantDetailFacts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 2px 14px;
    margin: 8px 0 0 0;
}

.PlantDetailFacts dt {
    color: #666;
    font-weight: bold;
}

.PlantDetailFacts dd {
    margin: 0;
    white-space: pre-wrap;
}

/* Vehicle-detail dates (WOF/COF, rego, service). The text says "(overdue)" too; colour is a second cue. */
.PlantDetailFacts dd.PlantDueOverdue {
    color: var(--totm-plant-danger);
    font-weight: bold;
}

.PlantDetailFacts dd.PlantDueDueSoon {
    color: var(--totm-plant-warn);
    font-weight: bold;
}

.PlantDetailColumns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.PlantDetailHeading {
    margin: 16px 0 6px 0;
    font-size: 14px;
}

.PlantDetailBox {
    margin: 8px 0;
    padding: 8px 10px;
    border: 1px solid #DDD;
    border-radius: 4px;
    background: #FAFAFA;
}

.PlantDetailBox summary {
    cursor: pointer;
    font-weight: bold;
}

.PlantDetailBox > * + * {
    margin-top: 6px;
}

.PlantDetailReturn {
    border-color: var(--totm-plant);
}

.PlantDetailLabel {
    display: block;
    font-weight: bold;
}

.PlantDetailInput,
.PlantDetailText {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 5px 7px;
}

.PlantDetailText {
    resize: vertical;
}

.PlantDetailInline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.PlantDetailPrimary {
    font-weight: bold;
}

.PlantDetailTable {
    width: 100%;
}

.PlantDetailTable td {
    vertical-align: top;
}

.PlantDetailTable .PlantDetailInput {
    min-width: 120px;
}

.PlantIssueRowBlocking > td:first-child {
    border-left: 4px solid var(--totm-plant-danger);
}

.PlantIssueRowWarning > td:first-child {
    border-left: 4px solid var(--totm-plant-warn);
}

.PlantIssueRowResolved {
    color: #777;
}

.PlantIssueRowResolved > td:first-child {
    border-left-color: #CCC;
}

.PlantIssueTitle {
    font-weight: bold;
}

.PlantIssueText,
.PlantDetailNoteText {
    white-space: pre-wrap;
}

.PlantIssueThreadNote {
    margin-top: 3px;
    padding-left: 8px;
    border-left: 2px solid #DDD;
    font-size: 12px;
    color: #555;
    white-space: pre-wrap;
}

.PlantHistoryTable tr.PlantHistoryOpen td {
    background: rgba(63, 81, 181, 0.06);
}

.PlantHistoryNotes div {
    white-space: pre-wrap;
}

.PlantDetailNote {
    padding: 6px 0;
    border-bottom: 1px solid #EEE;
}

.PlantDetailMeta {
    font-size: 12px;
    color: #666;
}

.PlantDetailThumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    margin: 6px 0;
}

.PlantDetailThumb {
    display: block;
    width: 84px;
    height: 84px;
    border: 1px solid #DDD;
    border-radius: 3px;
    overflow: hidden;
    background: #F4F4F4;
}

.PlantDetailThumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.PlantDetailThumbCell {
    position: relative;
}

/* Inside the photo's top-right corner, clear of its edge. Scheduler.css styles every button with
   !important (blue fill, square corners, 5px 10px padding), so those properties need it here. */
.PlantDetailThumbCell button.PlantDetailThumbRemove {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0;
    border-radius: 50% !important;
    background-color: rgba(0, 0, 0, .6) !important;
    color: #FFFFFF !important;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.PlantDetailThumbCell button.PlantDetailThumbRemove:hover,
.PlantDetailThumbCell button.PlantDetailThumbRemove:focus-visible {
    background-color: #C62828 !important;
}

.PlantDetailFile {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.PlantDetailFileLabel {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid #AAA;
    border-radius: 3px;
    background: #FFF;
    cursor: pointer;
    font-weight: bold;
}

.PlantDetailFile:focus-visible + .PlantDetailFileLabel {
    outline: 2px solid var(--totm-plant);
}

/* ── Servicing (PlantServicing-Design.md section 6) ───────────────────────────────────────── */

.PlantStatusDueSoon {
    color: var(--totm-plant);
    background: rgba(63, 81, 181, 0.08);
}

/* The wrench after a plant item's name on the calendar (View.Calendar appendPlantServiceFlag),
   the same round-badge shape as the "!" beside it. */
.PlantServiceFlag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 5px;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 9px;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    flex: 0 0 auto;
}

.PlantServiceFlag--overdue {
    background: var(--totm-plant-danger);
}

.PlantServiceFlag--due {
    background: var(--totm-plant-warn);
}

.PlantServiceRowName {
    font-weight: bold;
}

.PlantServiceMissingForm {
    color: var(--totm-plant-danger);
}

.PlantServiceAdd {
    margin: 6px 0;
}

.PlantServiceWhere {
    margin: 4px 0 12px;
}

.PlantServiceForm {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.PlantServiceForm .PlantDetailHeading {
    margin-top: 0;
}

.PlantServiceFormRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.PlantServiceFormLabel {
    min-width: 110px;
    font-weight: bold;
}

.PlantServiceKinds {
    gap: 16px;
}

.PlantServiceRules {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 0 6px 12px;
    border-left: 3px solid var(--totm-plant-band);
}

.PlantServiceNumber {
    width: 70px;
    padding: 3px 6px;
}

.PlantServiceTemplate,
.PlantServiceName {
    min-width: 260px;
}

.PlantServiceButtons {
    display: flex;
    gap: 8px;
}
