@use "ct-card.scss";
@use "page.scss";
@import "global-variables";
// For pf-v5-line-clamp
@import "@patternfly/patternfly/sass-utilities/mixins.scss";
// For pf-u-disabled-color-100
@import "@patternfly/patternfly/utilities/Text/text.css";

#app .pf-v5-c-card.containers-containers, #app .pf-v5-c-card.containers-images {
    @extend .ct-card;
}

.pf-v5-c-modal-box__title-text {
    white-space: break-spaces;
}

#containers-images, #containers-containers {
    // Decrease padding for the image/container toggle button list
    .pf-v5-c-table.pf-m-compact .pf-v5-c-table__toggle {
        padding-inline-start: 0;
    }

    // don't make the columns too narrow
    th .pf-v5-c-table__text {
        min-inline-size: fit-content;
    }
}

@media screen and (max-width: 768px) {
    // Badges should not stretch in mobile mode
    .pf-v5-c-table [data-label] > .pf-v5-c-badge {
        justify-self: start;
    }
}

.container-block {
    display: flex;
    flex-direction: column;
    word-break: break-all;
}

.container-block small {
    @include pf-v5-line-clamp("1");
    color: var(--pf-v5-global--Color--200);
}

.container-name {
    font-size: var(--pf-v5-global--FontSize--lg);
    font-weight: 400;
}

.containers-run-onbuildvarclaim input {
    max-inline-size: 15em;
}

.pf-v5-c-alert__description {
    overflow-wrap: anywhere;
}

.listing-action {
    inline-size: 100%;
    display: flex;
    justify-content: space-around;
}

.ct-badge-container-running, .ct-badge-pod-running {
  background-color: var(--pf-v5-global--info-color--100);
  color: white;
}

.ct-badge-container-healthy {
  background-color: var(--pf-v5-global--success-color--100);
  color: white;
}

.ct-badge-container-unhealthy {
  background-color: var(--pf-v5-global--danger-color--100);
  color: white;
}

.ct-badge-toolbox {
    background-color: var(--pf-v5-global--palette--purple-100);
    color: var(--pf-v5-global--palette--purple-600);

    .pf-v5-theme-dark & {
        background-color: var(--pf-v5-global--palette--purple-500);
        color: white;
    }
}

.ct-badge-distrobox {
    background-color: var(--pf-v5-global--palette--gold-100);
    color: var(--pf-v5-global--palette--gold-600);

    .pf-v5-theme-dark & {
        background-color: var(--pf-v5-global--palette--gold-500);
        color: white;
    }
}

.green {
    color: var(--pf-v5-global--success-color--100);
}

.red {
  color: var(--pf-v5-global--danger-color--100);
}

// Hide the header nav from the expandable rows - this should be better done with JS but the current cockpit-listing-panel implementation does not support this variant
#containers-images .ct-listing-panel-head {
    display: none;
}

.ct-grey-text {
   color: var(--pf-v5-global--Color--200);
}

// HACK: PF should offer that: https://github.com/patternfly/patternfly/issues/6572
.ct-numeric-column {
    text-align: end;

    .pf-v5-c-table__button {
        // right-justify the button inside of the th
        flex-direction: row-reverse;
        margin-inline-start: 0;
    }
}

.content-action {
    text-align: end;
    white-space: nowrap !important;
}

// Remove doubled-up padding and borders on nested tables in mobile
.ct-listing-panel-body .ct-table tr {
    --pf-v5-c-table-tr--responsive--PaddingTop: 0;
    --pf-v5-c-table-tr--responsive--PaddingRight: 0;
    --pf-v5-c-table-tr--responsive--PaddingBottom: 0;
    --pf-v5-c-table-tr--responsive--PaddingLeft: 0;
}

@media (max-width: $pf-v5-global--breakpoint--md - 1) {
    .show-only-when-wide {
        display: none;
    }
}

@media (min-width: $pf-v5-global--breakpoint--md) {
    .show-only-when-narrow {
        display: none;
    }

    // Add  borders to no pod containers list and images list
    .container-pod.pf-m-plain tbody,
    .containers-images tbody {
        border: var(--pf-v5-c-card--m-flat--BorderWidth) solid var(--pf-v5-c-card--m-flat--BorderColor);
    }
}

// Override table padding on mobile
@media (max-width: $pf-v5-global--breakpoint--md) {
    .health-logs.pf-m-grid-md.pf-v5-c-table tr:where(.pf-v5-c-table__tr):not(.pf-v5-c-table__expandable-row) {
        padding: 0;
    }
}
