/**
 * Copyright (c) 2025 Pat McBennett
 * SPDX-License-Identifier: LicenseRef-All-Rights-Reserved
 *
 * This source code is proprietary and confidential.
 * Unauthorized copying, modification, or distribution is strictly prohibited.
 */

/**
 *  Global page-wide settings.
 */

/* Always a good idea. */
* {
  box-sizing: border-box;
}

/* Enable smooth page scrolling when jumping to local page anchors. */
html {
  scroll-behavior: smooth;
}

/*
 * Small reset to CSS to ensure consistent left alignment in both Firefox and Chrome.
 */
ul,
ol {
  margin: 0;
  padding-left: 1.5rem;
  list-style-position: outside;
}

li {
  margin: 0;
  padding: 0;
}

body {
  margin: 0 2px 2px 2px; /* No margin at top due to permanent banner placement there. */
}

table,
th,
td {
  border: 1px solid black; /* draw border */
  border-collapse: collapse; /* collapse double borders into one */
  padding: 8px; /* optional spacing inside cells */
}

thead {
  background-color: lightgrey;
}

.gradient-button {
  background: linear-gradient(90deg, #00008b, #1e90ff);
  border: 4px solid black;
  border-radius: 10px;
  color: white;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}

/**
 * Make a much thicker, bolder <hr>.
 */
.thick-hr {
  border: none; /* remove default border */
  height: 8px; /* make it thick */
  background-color: black; /* color of the line */
  margin: 20px 0; /* optional spacing */
}

/* Make string literals stand out. */
span.https-w3id-org-lit-vocab-lit_core-_render_stringliteral {
  font-weight: bold;
  font-style: italic;
}

a.https-w3id-org-lit-vocab-lit_core-_render_languagetag {
  color: #007bff;
  text-decoration: none;
}

/* For rendering language tag as flags (instead of ISO letter code). */
img.https-w3id-org-lit-vocab-lit_core-_render_languagetagasflag {
  width: 18px;
  height: 13px;
}

/*
* Turn off underscores on all our IRI links, just to reduce visual
* clutter (given we have so many links when rendering a dataset!).
* Note that we don't apply this style to the '<a>' class - just our
* explicitly rendered IRIs and links. 
*/
.https-w3id-org-lit-vocab-lit_core-_render_link {
  color: #007bff;
  text-decoration: none;
}

/*
 * Transformed links need to stand out (as when clicked they actually go
 * 'somewhere else', and so we need to override any other link-related
 * classes.
 */
.https-w3id-org-lit-vocab-lit_core-_render_linktransformed {
  color: darkblue !important;
  text-decoration: underline !important;
}

/*
* Use less vertical spacing when rendering dataset separators.
*/
.https-w3id-org-lit-vocab-lit_core-_render_link_render_separator {
  margin-top: 1px;
  margin-bottom: 1px;
}

/**
*  PMcB55 website banner. 
*/
.banner {
  position: fixed; /* Keeps it in place while scrolling */
  top: 0; /* Stick to top of viewport. */
  left: 0;
  right: 0;
  z-index: 1000; /* Keep it above page content. */

  display: grid;
  grid-template-columns: min-content 1fr min-content;
  align-items: center;
  padding: 12px;
  background: linear-gradient(90deg, #00008b, #add8e6);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-radius: 0 0 16px 16px; /* round only bottom corners since top touches viewport */
}

.banner-preferred-languages {
  font-size: 18px;
}

.title {
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  justify-self: center;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.layout-wrapper {
  overflow-x: hidden;
  font-family: Arial, sans-serif;
}

#sidebar-toggle {
  display: none;
}

/* Menu button for sidebar. */
.menu-label {
  cursor: pointer;
  background-color: lightgrey;
  padding: 8px 12px;
  border-radius: 10px;
  user-select: none;
  transition: background-color 0.2s;
}

.menu-label:hover {
  background-color: #555;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: -450px;
  width: 450px;
  background-color: #444;
  color: white;
  padding: 20px;
  box-sizing: border-box;
  transition: left 0.3s ease;
  z-index: 1100; /* Above overlay. */
  overflow-y: auto; /* Makes sidebar contents scrollable. */
}

/* Sidebar visible when toggled */
#sidebar-toggle:checked ~ .layout-wrapper .sidebar {
  left: 0;
}

/* Overlay visible when sidebar is open */
#sidebar-toggle:checked ~ .layout-wrapper .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Overlay background */
.sidebar-overlay {
  position: fixed;
  left: 0;
  width: 100%;
  height: calc(100% - 60px);
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1050;
}

/* Allow clicking the overlay to close the sidebar. */
.sidebar-overlay-label {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Main content wrapper. */
.main-content {
  transition: margin-left 0.3s ease;
  margin-left: 0;
}

/* When sidebar is open — push main content. */
#sidebar-toggle:checked ~ .layout-wrapper .main-content {
  margin-left: 450px; /* Same as sidebar width */
}

.logo {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 25%;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;

  height: auto; /* Preserve aspect ratio. */
}

.logo img {
  width: 180px;
  border-radius: 25%;

  height: auto; /* Preserve aspect ratio. */
}

.lang-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 18px;
  align-items: center;
}

.lang-menu a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: white;
  padding: 8px 14px;
  border-radius: 20px;
  transition: background 0.3s ease, transform 0.2s ease;
}

.lang-menu a:hover,
.lang-menu a:focus {
  font-weight: 1000;
}

.d3-node-label {
  font-size: 6px;
  pointer-events: none; /* let drag happen on circle, not text */
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 600;
}

/**
 * Animate the 'jumped-to' element when the user clicks on an anchor
 * reference to help highlight it to the user.
 */
@keyframes doubleFlashHighlight {
  0% {
    background-color: #ff073a;
    box-shadow: 0 0 10px #ff073a, 0 0 20px #ff073a, 0 0 40px #ff073a;
  }
  25% {
    background-color: transparent;
    box-shadow: none;
  }
  50% {
    background-color: #ff073a;
    box-shadow: 0 0 10px #ff073a, 0 0 20px #ff073a, 0 0 40px #ff073a;
  }
  75% {
    background-color: transparent;
    box-shadow: none;
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

.flash-highlight {
  animation: doubleFlashHighlight 3s ease-in-out forwards;
}

/*
* Site-wide warning, with close-able button.
*/
.site-warning {
  grid-column: 1 / -1; /* Span from first to last column. */
  margin: 0 auto;
  margin-top: -20px;

  box-sizing: border-box;
  background: #c62828;
  color: #ffffff;
  display: flex;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 5px 10px;
  font-weight: 600;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue',
    Arial;
  line-height: 1;
  border-radius: 8px;
}

.site-warning__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: black;
}

.site-warning__msg {
  flex: 1 1 auto;
  font-size: 0.95rem;
}

.site-warning__close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.1rem;
  padding: 4px;
  cursor: pointer;
  line-height: 1;
}

.site-warning__close:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/**
*  Pair of LitDataset renderings... 
*/

/* Container that holds multiple panels. */
.multi-element-container {
  display: flex; /* side-by-side layout */
  align-items: stretch; /* ensure children stretch to same height */
  gap: 12px; /* space BETWEEN the panels */
  padding: 12px; /* outer padding around the pair */
}

/* Each panel takes half the available width (accounting for the gap). */
.multi-element-panel {
  flex: 1;
  padding: 14px; /* inner padding */
  background: #f3f4f6;
  border-radius: 8px;
  border: 2px dashed red;
  overflow: auto; /* good practice for long content */
}

/* small visual difference to show they're separate */
.multi-element-panel.alt {
  background: #fffaf0;
  border-color: #f0e6d6;
}

.dataset-renderer textarea {
  flex: 1; /* grow to take all available vertical space */
  field-sizing: content;
  width: 100%;
  min-height: 20em; /* roughly number of text rows, respects font-size */
  padding: 8px; /* inner padding for comfortable text */
  border: none; /* optional: remove its own border */
  outline: none; /* optional: remove blue outline when focused */
  font: inherit; /* match parent font */
}

/* Style the tab. */
.tab {
  overflow: hidden;
  /* border: 1px solid #ccc; */
  background-color: #f1f1f1;
}

/* Style the buttons that are used to open the tab content. */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 5px 20px;
  transition: 0.3s;
  border-radius: 10px 10px 0 0;
}

/* Change background color of buttons on hover. */
.tab button:hover {
  background-color: #ddd;
}

/* Create an active/current 'tablink' class. */
.tab button.active {
  background-color: #ccc;
}

/* Go from zero to full opacity */
@keyframes fadeEffect {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#tooltip {
  display: none;
  width: max-content;
  position: absolute;
  top: 0;
  left: 0;
  background: #222;
  color: white;
  font-weight: bold;
  padding: 5px;
  border-radius: 4px;
  font-size: 90%;
}

#arrow {
  position: absolute;
  background: #222;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
}

/*
 * User selection drop-down.
 */
.user-list-dropdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-bottom: 5px;
  padding-left: 10px;
  /* gap: 0.8rem; */
}

/*
 * Country flag to place beside language tag text.
 */
.language-flag {
  position: relative;
  width: 30px;
  height: 20px;
}

/*
 * Badges (e.g., to show the ordering of language preferences).
 */
.label-with-badge {
  position: relative;
  display: inline-block;
  padding-right: 20px; /* Spacing for badge. */
  /* font-size: 16px; */
}

.badge {
  position: absolute;
  top: -14px;
  right: 0px;
  background: green;
  color: white;
  border-radius: 60%;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  min-width: 20px;
  text-align: center;
}

span.block {
  display: inline-block;
  padding: 5px;
  border: 1px solid black;
  border-radius: 10px;
  color: black;
  background-color: #fffaa0;
  vertical-align: top;
}

div.context {
  margin: 0 auto;
  text-align: center;
  max-width: 75%;
  padding: 5px;
  border: 1px solid black;
  border-radius: 10px;
  background-color: lightblue;
}

/*
* CSS for a 'Copy to clipboard' link.
*/
.copy-container {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.copy-link {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  color: #aaa;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.copy-link:hover {
  color: #666;
}

.copy-link svg {
  width: 16px;
  height: 16px;
  margin-left: 5px;
  fill: currentColor;
  transition: fill 0.2s;
}

/* Green flash when copied. */
.copy-link.copied {
  color: #28a745;
}

/*
* Style a container and button used to open and close an accordion panel. 
*/
.accordion-container {
  border: 4px solid black;
  max-width: 75%;
  margin: 0 auto;
  border-radius: 0 0 10px 10px;
}

.accordion-button {
  background: #eee;
  color: #444;
  cursor: pointer;
  padding: 18px;
  width: 100%;
  text-align: center;
  border: none;
  outline: none;
  transition: 0.4s;
  border-radius: 0 0 10px 10px;
}

/* Style the accordion panel. */
.accordion-panel {
  padding: 0 18px;
  background-color: white;
  text-align: left;
  border-radius: 0 0 10px 10px;
  margin: 0 auto;
  white-space: nowrap;
  overflow: auto;
}

.accordion-button:after {
  content: '(Click to Open)'; /* Unicode character for "plus" sign (+) */
  font-size: 13px;
  color: #777;
  float: right;
  margin-left: 5px;
}

.accordion-button_active:after {
  content: '(Click to Close)'; /* Unicode character for "minus" sign (-) */
}

/* Add a background color to the button if it's clicked or hovered over. */
.accordion-button_active,
.accordion-button:hover {
  background-color: #ccc;
}

/*
 * Styling for clickable 'info' icon.
 */
.info-link {
  text-decoration: none;
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-link:hover {
  color: #fff;
}

.info-icon {
  width: 24px;
  height: 24px;
}

/**
  * WebSocket message.
  */
.websocket-message {
  grid-column: 1 / -1; /* Span from first to last column. */
  margin: 0 auto;
  text-align: center;
  color: black;
  background-color: #77dd77;
  /* width: 75%; */
  font-weight: 600;
  border: 2px solid black;
  border-radius: 10px;

  margin-top: 10px;
  padding: 5px 20px; /* Applies to top+bottom and left+right. */

  transition: background-color 0.8s ease;
  transition: color 0.8s ease;
}

.websocket-message.flash {
  background-color: red; /* Highlight briefly. */
  color: white; /* Highlight briefly. */
}

/**
 * Admin panel box.
 */
.box {
  position: relative;
  border: 2px solid #ccc;
  padding: 20px;
  margin-top: 20px;
  border: 2px solid black;
  border-radius: 10px;
  background: #fff;

  background-color: #edf7ed;
  padding: 5px 20px;
}

.box-label {
  position: absolute;
  top: -0.8em; /* lift it onto the border */
  left: 50%; /* place at middle */
  transform: translateX(-50%); /* shift back by half its width */
  background: #fff; /* match box background */
  padding: 0 6px;
  font-weight: bold;
  font-size: 1.2em;
  color: #333;
  white-space: nowrap; /* keep text on one line */
}

/**
 *
 */
.welcome-links {
  margin: 0 auto;
  width: 600px;
  border: solid 3px black;
  border-radius: 10px;
}

.lit-description {
  width: 600px;
  display: block;
  text-align: center;
  margin: 0 auto;
  border: solid 3px black;
}

.lit-d3-visualization svg {
  width: 90%;
  /* margin: 10px; */
  /* border: 2px solid red; */
  border-radius: 10px;
  background-color: #7ec8ff;
}

/* 
 * Responsive on small screens (always put last!). 
 */
@media (max-width: 650px) {
  body {
    margin: 0;
    padding: 0;
  }

  .welcome-links,
  .lit-description {
    width: 370px;
  }

  .banner,
  .title {
    /* grid-template-columns: 1fr; */
    text-align: center;
    row-gap: 6px;

    /* font-size: 0.6rem; */
    font-size: 24px;
  }

  .language-flag {
    left: -30px;
    top: 20px;

    width: 10px;
    height: 7px;
  }

  .badge {
    top: -7px;
    right: 0px;
    font-size: 6px;
    min-width: 10px;
  }

  .label-with-badge {
    font-size: 8px;
  }

  .logo,
  .logo img {
    margin-top: 5px;
    justify-self: center;
    max-width: 80px;
  }

  .lang-menu {
    margin-top: 5px;
    justify-self: center;
    max-width: 80px;
    transform: translateX(50px);
  }

  .lang-menu ul {
    justify-content: right;
    /* flex-wrap: wrap; */
    gap: 2px;
  }

  .websocket-message {
    font-size: 12px;
  }
}
/* 
 * END - Responsive on small screens (always put last!). 
 */
