/* DOCUMENTATION */

.td-content .tab-content .highlight {
  margin: 0;
}

//Table Content
.tab-content table{
  border-collapse: separate;
  border-spacing: 6px;
}

div.feature-state-notice {
  background-color: $feature;
  color: #000;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1em;

  font-size: 1.2em;

  > .feature-state-name::before {
    content: 'ⓘ  ';
    color: $primary;
  }
  > .feature-state-name {
    display: inline-block;
    font-size: 0.95em;
    font-weight: bold;
    color: #000;
    background-color: $feature;
  }

  code {
    color: #000;
    font-size: 1em;
    font-family: inherit; // don't treat as actual code
    background-color: $feature;
  }

  margin-right: 2em;
  max-width: 80%;
}

div.api-reference-header-note {
  background-color: $api-infobox-shown;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1em;

  font-size: 1.1em;

  details > summary, details[open] > summary { 
    color: $black;
    font-size: 1rem;
    margin: 0;
  }
  
  ul {
    list-style-type: none;
    > li {
      margin-top: 1rem;

      div:has(> a) {
        font-size: 1.4em;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
      }
      .concept-page-toc ol > li {
        list-style: "";
      }
    }
  }
}

div.api-reference-header-note:not(:has(details[open])) {
  background-color: $api-infobox;
}

div.api-reference-header-note.empty {
  visibility: hidden;
}


.includecode .highlight {
  margin-top: 0;
  margin-bottom: 0;
}


// Customize color for warning callouts

.alert.alert-warning {
  border-color: #d9534f;
  hr {
    border-top-color: #d9534f;
  }
}

// Bootstrap doesn't have a “caution” color. Add this here.

.alert.alert-caution {
  border-color: #f0ad4e;
  hr {
    border-top-color: #f0ad4e;
  }
}

// Make note (aka info) callouts render the heading as if it
// is bold running text.
.alert.alert-info {
  border-color: #428bca;

  h4, h4.alert-heading {
    color: var(--bs-body-color);
    display: block;
    float: initial;
    font-size: 1rem;
    padding: 0;
    padding-right: 0.5rem;
    margin: 0;
    line-height: 1.5; // match paragraph style
  }
}

// Only danger headings need large text (per Docsy)
// For other callouts, use the size of the running text
.alert:not(.alert-danger) h4 {
  font-size: 1em;
}

// All callout headings should be bold
.alert {
  h4 {
    font-weight: bold;
    font-style: initial;
  }
}
.alert:dir(ltr) {
  // color the left border (left-to-right locales)
  border-width: 0 0 0 4px;
}

.alert:dir(rtl) {
  // color the right border (right-to-left locales)
  border-width: 0 4px 0 0;
}

.glossary-tooltip {
  display: inline-block;
  border-bottom: 1px dotted var(--bs-body-color);
  color: var(--bs-body-color);
  background: transparent;
  text-decoration: none !important;
}

/* code samples */
.code-sample > .copy-code-icon {
  cursor: pointer;
  display: flex;
  gap: 1rem;
  justify-content: right;
  padding: 0.2rem;
}

/* CSS for 'figure' full-screen display */

/* Define styles for full-screen overlay */
.figure-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(255, 255, 255, 0.95); /* White background with some transparency */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(5% + 20px);
  box-sizing: border-box;
}

/* CSS class to scale the image when zoomed */
.figure-zoomed {
  transform: scale(1.2);
}

/* Define styles for full-screen image */
.figure-fullscreen-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Maintain aspect ratio and fit within the container */
}

/* Define styles for close button */
.figure-close-button {
  position: absolute;
  top: 1%;
  right: 2%;
  cursor: pointer;
  font-size: calc(min(5vw + 10px, 4rem));
  color: $primary;
  background-color: rgba(255, 255, 255, 0.25);
}

/* Styles for CVE table */
table tr.cve-status-open, table tr.cve-status-unknown {
  > td.cve-item-summary {
    font-weight: bold;
  }
}

/* Styles for general tables */
table td.value-not-applicable {
  text-align: center;
}

// <details> shortcode

details > summary {
  margin-bottom: 1em;
  color: $primary;
  background: transparent;
}

details:not([open]) > summary:after {
  content: '…';
  display: inline-block;
}

// kubectl reference index page
#kubectl-cmd-search {
  width: 50%;
}

.kubectl-reference-index {
  details.kubectl-cmd-entry > summary {
    cursor: pointer;
  }

  details.kubectl-cmd-entry:not([open]) > summary:after {
    content: none;
  }

  .kubectl-cmd-entry.hidden {
    display: none;
  }
}

// glossary

body.glossary {
  main {

    ul.glossary-terms > li {
      list-style-type: none;
      padding: 0.5em;
      padding-bottom: calc(min(1em, 0.25em + 0.25vh ));
      margin: 0;
      margin-top: calc(min(1.5em, 0.2em + 1vh ));
    }

    ul.glossary-terms > li.hide {
      display: none;
    }

    ul.glossary-terms > li:has(.term-anchor:target) {
      border-left: 0.3em solid $primary;
      background: rgba($secondary, 0.2);
    }

    #tag-container {
      float: left;
      max-width: calc(max(80%, 100em));
      border-top: 1px solid $secondary;
      border-bottom: 1px solid $secondary;
      padding-top: 0.5em 0;
      margin: 2em 0;

      > p {
        display: inline-block;
        padding-top: 0.2em;
      }

      .hide {
        display: none;
      }

      .tag-option {
        border-radius: 0.33em;
        padding: 0.75em;
        margin: 1em;
        margin-top: 0.2em;
        float: left;
        font-weight: bold;
      }

      .tag-description {
        margin-left: auto;
        margin-right: auto;
        padding: 0.2em;
        padding-bottom: 0.8em;
        text-align: center;
      }
      .canonical-tag {
        color: white;
        background-color: $secondary;
      }

      .canonical-tag a {
        color: inherit;
        background: transparent;
        text-decoration: none !important;
      }

      .active-tag {
        color: $white;
        background-color: $primary;
      }
    }

    .term-anchor:target + .term-name > span {
      color: $primary;
    }

    .term-anchor:target {
      visibility: initial;
    }

    .glossary-term-name {
      font-weight: bold;
      display: inline-block;
      padding-left: 0.25em;
      padding-right: 0.25em;
    }

    .glossary-aka {
      display: inline-block;
      padding-left: 0.25em;
      padding-right: 0.25em;
      padding-bottom: 0.25em;
    }

    #glossary-details-before {
       margin-top: 3em;
       font-style: italic;
       clear: both;
    }

    .preview-text {
      display: inline-block;
      margin-bottom: 0.2em;
    }

    .preview-text + * {
      margin-top: 0.2em;
    }

    .term-definition {
       margin-left: calc(min(2em, 0.5em + 0.75vw));

       .hide {
          display: none;
       }
    }

    .glossary-aka {
      font-style: italic;
    }

    .preview-text p {
      display: inline;
    }

    .permalink {
      display: inline-block;
      width: 0.9em;
      height: 0.9em;
      padding-left: 0.1em;

      &.hide {
        visibility: hidden;
      }
    }

    .term-anchor {
      display: block;
      position: relative;
      top: -4rem; // adjust scrolling to target
      visibility: hidden;
    }


    .invisible {
      visibility: hidden;
    }

  }
}

/* Table content */
.tab-content table{
  border-collapse: separate;
  border-spacing: 6px;
}

.tab-pane {
  border-radius: 0.25rem;
  padding: 0 16px 16px;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.02);
  border: none;

  &:first-of-type.active {
    border-top-left-radius: 0;
  }
}

// Special color for third party content disclaimers
.alert.third-party-content { border-left-color: #222 };

// Highlight disclaimer when targeted as a fragment

#third-party-content-disclaimer {
  color: #000;
  background: #f8f9fa;
  transition: all 0.5s ease;
}

@keyframes disclaimer-highlight {
  from { background: #f8f922; color: #000; }
  50% { background: #f8f944; color: #000; }
  to { background: #f8f9cb; color: #000; }
}

#third-party-content-disclaimer:target {
  color: #000;
  animation: disclaimer-highlight 1.25s ease;
  background: #f8f9cb;
}

// Docs landing page styles
body.docs-portal {
  .td-content > h1:first-child {
    text-align: center;
    color: $primary;
    padding-top: 0;
  }

  .launch-cards {
    padding: 0;
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    row-gap: 0.5rem;
    column-gap: 0.5rem;

    .launch-card {
      border-radius: 0.75rem;
      padding: 0.25rem 0.75rem;
      display: flex;

      .card-content {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        margin: 0;

        row-gap: 1em;

        h2 {
          font-size: 1.5em;
          padding: 0.5em 0;
          margin: 0;
          a {
            display: none;
          }
        }

        p {
          margin: 0;
        }

        > ul {
          list-style: none;
          height: fit-content;
          line-height: 1.6;
          padding: 0;
          padding-left: 1rem;
          margin-block-end: auto;

          > li:last-child {
            margin-bottom: 1rem;
          }
        }

        button {
          min-width: 75%;
          align-self: center;
          background: $primary;
          color: $white;
          border: 0;
          font-weight: bold;
          border-radius: 0.5rem;
          height: min-content;
          width: auto;
          padding: .5em 1em;
          cursor: pointer;
          box-sizing: border-box;
          margin-bottom: 0.25rem;
        }
      }
    }

    .launch-card:has(button) {
      background: var(--bs-secondary-bg);
      color: var(--bs-body-color);
    }

    .launch-card:hover {
      background: var(--bs-tertiary-bg);
    }

    .launch-card:has(button:hover) {
      outline: 0.2rem solid $primary;
      button, button:hover {
        background: $primary;
        color: $white;
      }
    }

    .launch-card button:hover {
      outline: 0.2rem solid white;
    }

    grid-template-columns: repeat(1, 1fr);

    @include media-breakpoint-up(xl) {
      margin-left: auto;
      margin-right: auto;
      row-gap: 1rem;
      column-gap: 1rem;
      .launch-card {
        max-width: calc(min(80vw, 40em));
        padding: 0.75rem;
      }
    }
    @media (max-width: 60rem) {
      row-gap: 0.75rem;
      .launch-card {
        border-radius: 0.333rem;
      }
    }
    @media (min-width: 60rem) {
      grid-template-columns: repeat(2, 1fr);
    }
    @media (min-width: 120rem) {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}

/* SCSS related to the list of metrics in Kubernetes */
main {

  // Look & Feel , Aesthetics
  div.metric:nth-of-type(odd) {
    background-color: var(--bs-tertiary-bg);
  }

  div.metrics {
    .metric {
      div:empty{
        display: none;
      }

      display: flex;
      flex-direction: column;
      flex-wrap: wrap;
      gap: .75em;
      padding:.75em .75em .75em .75em;

      .metric_name{
        font-family: $font-family-monospace;
        font-size: large;
        font-weight: bold;
        word-break: break-word;
      }

      label {
        font-weight: bold;
        margin-right: .5em;
      }
      ul {
        li:empty{
          display: none;
        }
        display: flex;
        flex-direction: column;
        gap: .75em;
        flex-wrap: wrap;
        li.metric_labels_varying{
          span{
                display: inline-block;
                background-color: var(--bs-secondary-bg);
                padding: 0 0.5em;
                margin-right: .35em;
                font-family: monospace;
                border: 1px solid var(--bs-border-color);
                border-radius: 5%;
                margin-bottom: .35em;
          }
        }
      }
    }
  }
}

/* Math overflow scroll fix */
.math .katex .base {
  overflow-x: scroll;
  width: 100%;
}
