/**
* NOTE: Some guidelines for css variables:
* - Try to define as few css colors/variables as possible, don't try to define things that will not be reused globally
* - If defining unique colors for a specific component or unique feature, don't define them here explicitly
* - Keep it simple, complexity ensures it is impossible to take advantage of reuse
* - Use variable names that align with their abstract intent, not their specific meaning
* - It should always be possible to change the value of few main variables (retaining things like contrast for things like colors, of course)
*   and not change a million other things to make the resultant change in the UI a cohesive whole again.
* - If more than, say, 3 shades of grey are defined here, rethink.
* - When naming or finding things with/by markers such as 'border' or 'hover' or 'active' etc., reread the above
* - When adding something to this list of variables and it has the same value as another value, reread the above
*
* For example:
* When coming here to look for some shade of grey for some border or background of a special type of button or such,
* don't call it $esoteric-feature-background|border-color, but simply $light-grey (and re-use it)
*/
:root {
  /* Define a single theme color with variants. Most interaction-elements should make do with these colors. */
  --theme-color: #1579A0;
  --theme-color-light: #D0E5EF;
  /* TODO Perhaps add a theme-color-dark */

  /* TODO: Use an alternative to instead lighten (unselected) or darken (selected) the theme colors */
  --progress-bar-color: #0B5982;
  --progress-bar-color-light: #B5D5E4;

  --text-color: #333;
  --icon-color: var(--dark-grey);
  --back-color: #F5F5F5;
  --hyperlink-color: #1579A0;
  --hyperlink-color-visited: #884488;

  --light-grey: #D4D4D4;
  --lighter-grey: #E8E8E8;
  --dark-grey: #4D4D4D;
  --grey: #888;

  --disabled-color: #888888;
  --notice-color: #fbdd3b;
  --notice-color-light: #fffacc;
  --warning-color: #e67700;
  --warning-color-light: #fae4cc;
  --error-color: #cf1317;
  --error-color-light: #f5d0d1;
  --hint-color: #ffdd00;
  --success-color: #00703C;
  --adjusted-color: #0072BC;

  --light-yellow: #ffdd00;

  /* Separators -- the half-separator is so the border can be split evenly via top/bottom */
  --half-separator: 1px solid white;
  --separator: 2px solid white;

  --row-height: 30px;
  --row-height-generous: 40px;
  --aux-panel-height: 60px;

  --default-radius: 3px;

  /* Panels and other popouts */
  --middle-section-width: 420px;
  --info-panel-width: 400px;
  --search-width: 400px;
  --search-height: var(--row-height-generous);

  --font-size: 13px;
  --font-family: 'Noto Sans TC', Arial, Sans-Serif;

  /* A default spacer, 0.7rem corresponds to about 10px (ordinarily) */
  --large-spacer: 2em;
  --spacer: 0.7rem;
  --half-spacer: 0.5rem;
  --quarter-spacer: 0.25rem;

  /* The optimal text width for a paragraph of text. To be used for the width attribute. */
  --paragraph: clamp(35ch, 100%, 75ch);

  /** Animation time for arbitrary non-critical elements, can be slow for aesthetics **/
  --animation-time: 0.15s;
  /** Animation time for function-critical elements, should be quick; the experience is not as important as the function **/
  --animation-time-primary: 0.1s;

  /* Short-hand */
  --anim: 0.1s ease-out;

  /* Anchors for the map buttons and notification button */
  --anchor-top: 5px;
  --anchor-right: 15px;

  /* Some initial default widths */
  --column-left-width-user-setting: 400px;
  --column-left-min-width: 330px;
  --column-left-max-width: min(1000px, calc(100vw - 120px));
  --column-middle-width: 400px;
  --column-right-width: 810px;
  --column-left-width: clamp(var(--column-left-min-width), var(--column-left-width-user-setting), var(--column-left-max-width));
}

::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
  color: var(--grey);
  opacity: 1; /* Firefox */
}

*:focus {
  z-index: 1;
  outline: 2px dotted var(--theme-color);
  border-radius: var(--default-radius);
  border-color: transparent;

  /* Ensure outline always appears within element (this avoids issues with things like overflows by default -- can be overridden on a per-element basis) */
  outline-offset: -2px;
}

*[tabindex="-1"]:focus {
  /* Don't show outline when tabindex is an explicit -1 (i.e. the element is focusable, but not through keyboard interaction)
   *
   * Note: An element with tabindex=-1 can be given focus programmatically through `.focus()`, this is useful to set the focus point within the DOM, and
   * thus helps the user's intuition with where the focus starts, but without also showing visual clues to this effect. For example when a popup opens up,
   * the popup container can be given tabindex=-1 and .focus()-ed, then when the user tabs through, he will give focus to the first element in the popup,
   * rather than some element in the background, thereby doing what his intuition would expect.
   *
   * Also note: tabindex should never be >1
   */
  outline: 0 !important;
}
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

html {
  height: 100%;
  min-height: 600px;
}

body {
  height: 100%;
  min-width: 800px;
  margin: 0px;
  padding: 0px;
  color: var(--text-color);
  font-size: var(--font-size, 13px);
}
button, input, textarea, select {
  font-size: var(--font-size, 13px);
}

input, textarea, select {
  box-sizing: border-box;
  color: var(--text-color);
  background: white;
  width: 100%;
  border: 1px solid var(--grey);
  border-radius: 3px;
  min-height: var(--row-height);
  transition: all var(--anim);
}
input:focus, textarea:focus,select:focus {
  outline-offset: 2px;
}
input:hover, select:hover, textarea:hover, textarea:active {
  border: 1px solid black;
}
input:focus, select:focus, textarea:focus {
  border: 1px solid transparent;
}
input {
  padding: 0 5px;
}

/* Layer range slider */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  min-height: 4px;
  margin: 10px 0;
  padding: 0;
  background: var(--dark-grey);
  outline: 0;
  cursor: pointer;
  border: none;
  transition: background var(--anim);
}
input[type=range]:hover {
  background: var(--theme-color);
}
input[type=range]:active {
  background: var(--theme-color);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 20px;
  cursor: pointer;
  background: white;
  border: 2px solid var(--dark-grey);
  transition: border var(--anim);
}
input[type=range]::-moz-range-thumb {
  -moz-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 20px;
  cursor: pointer;
  background: white;
  border: 2px solid var(--dark-grey);
  transition: border var(--anim);
}
input[type=range]:hover::-webkit-slider-thumb {
  border: 2px solid var(--theme-color);
}
input[type=range]:active::-webkit-slider-thumb {
  border: 2px solid var(--theme-color);
}
input[type=range]::-moz-range-thumb:hover {
  border: 2px solid var(--theme-color);
}
input[type=range]::-moz-range-thumb:active {
  border: 2px solid var(--theme-color);
}
input[type=range]:focus::-webkit-slider-thumb {
  outline: 2px dotted var(--theme-color);
  outline-offset: 2px;
}
input[type=range]:focus::-moz-range-thumb:focus {
  outline: 2px dotted var(--theme-color);
  outline-offset: 2px;
}

/* Checkbox input, in this stylesheet because :after is not parsed well by the vue-gwt templating engine. **/
input[type=checkbox] {
  opacity: 0;
}
input[type=checkbox]:not(:checked):not(:disabled) + .checkmark {
  background-color: white !important;
  border: 1px solid var(--grey);
}
input[type=checkbox]:checked + .checkmark:before {
  color: var(--theme-color);
  content: "\e91b";
}
input[type=checkbox]:not(:checked):disabled + .checkmark:before {
  content: "\e9dc";
}
input[type=checkbox]:not(:checked):disabled + .checkmark:before,
input[type=checkbox]:checked + .checkmark:before {
  font-family: 'icoaerius' !important;
  font-size: 18px;
  display: grid;
  place-items: center;
}
input[type=checkbox]:disabled + .checkmark:before {
  color: var(--grey);
}
input[type=checkbox]:not(:checked):hover + .checkmark {
  border-color: #222;
}
input[type=checkbox]:focus + .checkmark {
  outline: 2px dotted var(--theme-color);
  outline-offset: 2px;
}
input[type=checkbox]:hover + .checkmark {
  border-color: black;
}

textarea {
	font-size: 13px;
}

select {
  padding-top: .2em;
  padding-bottom: .2em;
  text-indent: 1px;
  background: white;
}

h1, h2 {
  margin: 8px 0px;
  font-size: 22px;
  font-weight: normal;
  color: var(--text-color);
}
h3 {
  margin: 8px 0px;
  font-size: 16px;
  font-weight: 400;
}
h4 {
  font-size: 13px;
  font-weight: 700;
}
h5 {
  margin: 0px;
  font-size: 1em;
}

em {
  color: var(--theme-color);
  font-weight: bold;
  font-style: normal;
}
p {
  margin: 0px;
  line-height: 1.7em;
}
a {
  color: var(--hyperlink-color);
}

a:visited {
  color: var(--hyperlink-color-visited);
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* Input overrides */

.notice-input input:not(:focus),
.notice-input select:not(:focus),
.notice-input textarea:not(:focus),
.warning-input input:not(:focus),
.warning-input select:not(:focus),
.warning-input textarea:not(:focus),
.error-input input:not(:focus),
.error-input select:not(:focus),
.error-input textarea:not(:focus) {
  border-bottom-left-radius: 0px;
  border-bottom-right-radius: 0px;
  border-color: var(--border-color);
  border-bottom: 1px solid transparent;
}

.notice-input {
  --border-color: var(--theme-color);
}

.warning-input {
  --border-color: var(--warning-color);
}

.error-input {
  --border-color: var(--error-color);
}

.hotKeyContainer::backdrop {
  backdrop-filter: blur(3px) opacity(1);
}

.detail-label {
  font-weight: 300;
}

.detail-grid-row {
  display: grid;
  grid-template-columns: 15fr 23fr;
}

.detail-grid-row-right {
  display: grid;
  grid-template-columns: 15fr 15fr 16fr;
}

.detail-grid-row-full {
  display: grid;
  grid-template-columns: 30fr 15fr 15fr 16fr;
}

.detail-emission-container {
	display: grid;
  grid-template-columns: 15fr 23fr;
}

.detail-emission-subcontainer {
  display: grid;
  grid-template-columns: 15fr 15fr 16fr;
}

.detail-emission-substance {
  display: flex;
  flex-direction: column;
}

/** TODO - @PR Reviewer, these should be removed before the feature branch merge */
.placeholder-1, .placeholder-2, .placeholder-3 {
  border: 5px solid;
  box-sizing: border-box;
}

.placeholder-1 {
  border-color: #EF7A7D;
}

.placeholder-2 {
  border-color: #77DD77;
}

.placeholder-3 {
  border-color: #87CEFA;
}
/* Deep selection */
.met-select option {
  padding: var(--quarter-spacer);
  cursor: pointer;
}
.met-select option:hover {
  background: var(--theme-color-light);
}
.menu-collapse i {
  transform: rotate(180deg);
  transition: transform var(--anim) !important;
}
.collapsed .menu-collapse i {
  transform: rotate(0);
}

.met-select option:checked {
	background: var(--theme-color);
	color: white;
}
