/* Special CSS for BalticAnalytica */

/*
  Icon-only Bootstrap buttons.
  Used for comment/bookmark buttons.
*/

.btn.ba-btn-icon {
  width: 2.375rem;
  height: 2.375rem;
  min-width: 2.375rem;
  min-height: 2.375rem;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  line-height: 1;
}

.btn.ba-btn-icon .bi {
  display: inline-block;
  font-size: 1.15rem;
  line-height: 1;
}

/*
  Sidebars (templates/sidebars/).
  All icons are Bootstrap Icons font tags (<i class="bi bi-...">),
  and every section heading is shown in capitals.
*/

/* The grey sidebar always reaches the bottom of the window, even on short pages. */
@media (min-width: 768px) {
  .sidebar {
    min-height: calc(100vh - var(--ba-navbar-height, 56px));
  }
}

.sidebar .nav-link .bi {
  font-size: 1rem;
  margin-right: .25rem;
}

.sidebar-heading {
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sidebar-heading .bi {
  font-size: 1rem;
}

/*
  BalticAnalytica content links.
  Used for object links inside comments, tables, list groups and cards.
  Not intended for navbar, sidebar or buttons.
*/

.ba-content-link {
  color: var(--bs-secondary-color);
  text-decoration: none;
  font-weight: 500;
}

.ba-content-link:hover,
.ba-content-link:focus {
  color: var(--bs-secondary-color);
  text-decoration: underline;
  font-weight: 600;
}
/*
  Links in the «Arkiv» section: same look as links in tables (below).
*/
#archive-section a:not(.btn) {
  color: inherit;
  text-decoration: none;
}

#archive-section a:not(.btn):hover,
#archive-section a:not(.btn):focus {
  color: inherit;
  text-decoration: underline;
  font-weight: bold;
}

/*
  "Change graph" menu: the button sits at the right edge of the page
  header, so anchor the menu to the button's right edge instead of
  letting it run off screen.
*/
#chartDropdown {
  top: 100%;
  right: 0;
  left: auto;
}

/*
  Grey links outside tables (archive saksgang, «Koble til sak» and friends): the same look as the
  links in tables below. base_sidebars.html has a copy of this rule, since it does not load this file.
*/
a.link-plain:not(.btn) {
  color: inherit;
  text-decoration: none;
}

a.link-plain:not(.btn):hover,
a.link-plain:not(.btn):focus {
  color: inherit;
  text-decoration: underline;
  font-weight: bold;
}

/*
  Links in tables: plain text until they get hover or focus, then bold and
  underlined. Controls that happen to sit in a table keep their own look.
*/
table a:not(.btn):not(.dropdown-item):not(.page-link):not(.nav-link) {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

table a:not(.btn):not(.dropdown-item):not(.page-link):not(.nav-link):hover,
table a:not(.btn):not(.dropdown-item):not(.page-link):not(.nav-link):focus {
  color: inherit;
  text-decoration: underline;
  font-weight: bold;
}

/*
  Grey pagination. Bootstrap paints page links and the current page blue; add
  .pagination-neutral to the <ul class="pagination"> to keep them grey like the other buttons.
*/
.pagination-neutral {
  --bs-pagination-color: #6c757d;
  --bs-pagination-hover-color: #495057;
  --bs-pagination-hover-bg: #e9ecef;
  --bs-pagination-focus-color: #495057;
  --bs-pagination-focus-bg: #e9ecef;
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.25);
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: #6c757d;
  --bs-pagination-active-border-color: #6c757d;
}

/*
  Tender phase (tenders/tenders/_phase.html): a coloured dot and plain text.
*/
.ba-phase {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.ba-phase::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--ba-phase-color, #8794a1);
}

.ba-phase-active { --ba-phase-color: #60c78d; }
.ba-phase-awarded { --ba-phase-color: #3ca5ec; }
.ba-phase-cancelled { --ba-phase-color: #ea3e4f; }
.ba-phase-expired { --ba-phase-color: #8794a1; }

/*
  Tables in comments. CKEditor shrinks a table to its content and centres it
  (figure.table { display: table; margin: .9em auto }); in a comment a table should start at the
  left edge and fill the line like the text around it.
  Editor: the selector is more specific than CKEditor's own rules, which load after this file.
  A table pasted from Word comes with an inline width (<figure style="width:390pt">); !important
  beats it, so the editor looks like the saved comment, where the sanitizer has dropped every style.
  View (.comment-body): the stored HTML is a bare <table> without CKEditor's styles, so it gets
  grey borders here. A table wider than the page scrolls inside .comment-body.
*/
.ck-content.ck-editor__editable figure.table:not(.layout-table) {
  display: block;
  width: 100% !important;
  margin: 0.9em 0;
}

.ck-content.ck-editor__editable figure.table:not(.layout-table) > table {
  width: 100%;
}

.comment-body {
  overflow-x: auto;
}

.comment-body table {
  width: 100%;
  margin: 0.9em 0;
  border-collapse: collapse;
}

.comment-body th,
.comment-body td {
  padding: 0.4rem 0.6rem;
  border: 1px solid #dee2e6;
  vertical-align: top;
}

.comment-body th {
  background: #f8f9fa;
  font-weight: 600;
  text-align: left;
}
