@import "../lib/table.css";
@import "../lib/journal.css";
@import "./system-global.scss";
@import "../../node_modules/@patternfly/patternfly/components/FormControl/form-control.css";
@import "../../node_modules/@patternfly/patternfly/components/Toolbar/toolbar.scss";

// https://github.com/patternfly/patternfly-react/issues/5993
.pf-c-popover.pf-m-width-auto {
    --pf-c-popover--MaxWidth: min(300px, 90%);
}

#journal {
    grid-template-rows: auto 1fr;

    .cockpit-log-panel {
        border: none;
    }

    .pf-c-page__main {
        // Constrain page to viewport height, so journal can overflow
        max-height: 100vh;
    }

    // Static width for the service selector as it likes to resize a lot while loading
    #journal-identifier-menu ul.pf-c-select__menu {
        width: 10rem;
    }

    // Long names without spaces do not wrap; triggers overflow and overlaps with check icon
    #journal-identifier-menu .pf-c-select__menu-item {
        white-space: normal;
    }
}

#log-details {
    .pf-l-gallery {
        --pf-l-gallery--GridTemplateColumns: 1fr;
    }

    .pf-c-page__main-breadcrumb {
        padding: var(--pf-global--gutter);
    }

    /* Do not break labels */
    .info-table-ct td:first-child {
        word-break: keep-all;
    }

    .pf-c-card__title,
    .multiline,
    .info-table-ct td:not(:first-child) {
        word-break: break-all;
        white-space: pre-wrap !important;
        font-family: monospace, monospace;
    }

    .pf-l-split {
        padding-bottom: var(--pf-global--gutter);
        align-items: center;
    }

    .info-table-ct > thead > tr > th {
        padding-left: 1rem;
    }
}

#journal-box {
    flex: auto;

    .panel-heading {
        position: sticky;
        top: 0;
        color: var(--pf-global--Color--300);
        background-color: var(--pf-global--BackgroundColor--100);
        border: none;
        font-size: var(--pf-global--FontSize--md);
        font-family: var(--pf-global--FontFamily--heading--sans-serif);
        font-weight: var(--pf-global--FontWeight--semi-bold);
        padding: var(--pf-global--spacer--lg) var(--pf-global--spacer--lg) var(--pf-global--spacer--sm);
    }
}

/* Set min width for services in the journal view */
#journal .cockpit-logline {
    --log-service-min: 8rem;
}

#accordion-markup {
    margin-bottom: 0px;
}

.pf-c-toolbar {
    --pf-c-toolbar--BackgroundColor: var(--pf-c-page__main-section--BackgroundColor);

    // Make toolbar stretch to all the available space and wrap up to two lines
    --pf-c-toolbar--PaddingTop: 0;
    --pf-c-toolbar--PaddingBottom: 0;

    .pf-c-toolbar__group.pf-m-toggle-group.pf-m-show-on-md {
        flex-grow: 1;
        flex-wrap: wrap;
    }

    .pf-c-toolbar__group {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .pf-c-toolbar__group:nth-child(3) {
        flex-grow: 1;
    }

   // Make text filter stretch to all the available space
   .pf-c-toolbar__item.text-search, #journal-grep {
       flex-grow: 1;
   }

   .text-help {
       padding-left: var(--pf-global--spacer--xs);
   }

   // Hide filters from advanced search dropdown entries which already exist in the toolbar
   #journal-grep .pf-c-search-input__menu-body {
       .pf-c-form__group:nth-child(5), .pf-c-form__group:nth-child(6) {
           display: none;
       }
   }

    .pf-c-toolbar__expandable-content.pf-m-expanded .pf-c-divider {
        display: none;
   }

   // HACK: Not possible to specify text, so needs some hacks, see https://github.com/patternfly/patternfly-react/issues/6140
   .pf-c-toolbar__toggle {
       .pf-c-button.pf-m-plain {
            color: unset;
        }

       svg {
           color: var(--pf-c-button--m-plain--Color);
       }
   }
}
