:root {
  --base-scale: calc(100vw / 75);
  --baseW: 60em;
  --h2-font-size: max(1em, min(4em, calc(var(--base-scale) * 4)));
  --padding-size: max(0.5em, min(1em, calc(var(--base-scale))));
  --margin-size: max(0.5em, min(1.5em, calc(var(--base-scale) * 2)));
  --border-radius: max(0.25em, min(0.75em, calc(var(--base-scale) * 0.55)));
  --border-radius-small: max(0.125em, min(0.375em, calc(var(--base-scale) * 0.25)));
  --outerPad: clamp(0.25rem, 2vw, 1.5rem);
  --dark-caption: rgb(18, 86, 155);
}

@font-face {
  font-family: bgCyr;
  font-style: normal;
  src: url(SourceSansPro-Regular.ttf.woff2);
}

@font-face {
  font-family: bgCyr;
  font-weight: bold;
  src: url(SourceSansPro-Bold.ttf.woff2);
}

html,body,address,blockquote,div,form,fieldset,caption,h1,h2,
h3,h4,h5,h6,hr,ul,li,ol,ul,dl,dt,dd,table,tr,td,th,p,img {
  margin: 0;
  padding: 0;
  font-family: bgCyr, monospace, "Helvetica", "Arial", sans-serif;
  /* line-height: 1.2; */
}

html,
body {
  background: #ece6e6;
  width: 100%;
  height: 100%;
  font-style: normal;
  font-size: 1em/1.5;
  scrollbar-gutter: stable both-edges;
  /* text-align: center; */
}

body {
  display: flex;
  flex-direction: column;
}

*, *:after, *:before {
  box-sizing: border-box;
}

p,
div {
  text-align: left;
}

nav {
  width: 70%;
  font-size: 1em;
  letter-spacing: 1px;
  align-self: end;
  text-align: end;
}

nav ul{
  text-align: end;
}

nav a {
  margin-left: 8px;
  text-align: right;
}

main {
  background: white;
  margin: 25px auto;
  border-radius: var(--border-radius);
  max-width: var(--baseW);
  padding: 1rem 0 0 0;
  position: relative;
}

.noPadMain {
  padding: 0;
}

#homeMain {
  max-width: 50em;
}

/*  TABLE  */

main table {
  margin: 0 auto 0;
  /* border-collapse:collapse;*/
  border-collapse: separate;
  border-spacing: 0;
  background: #FFF;
  border: solid var(--dark-caption);
  border-width: 0 1px 1px 1px;
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
}

caption {
  padding: 0.4em 0.4em;
  /* font-weight:400;
	font-size:1.1em; */
  background: var(--dark-caption);
  color: #FFF;
  border-width: 1px 1px 0 1px;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
}

th, td {
  padding: 0.25em 0.5em;
  text-align: center;
  border-bottom: 1px solid var(--dark-caption);
}

tbody tr td:first-child,
thead tr th:first-child {
  text-align: left;
}

tbody tr td:last-child {
  text-align: right;
}

main table a{
  text-decoration: none;
}
main table a:visited{
  color: black;
  background-color: transparent;
}
main table a:hover{
  color: black;
  text-decoration: underline;
}

tbody th {
  font-weight: normal;
}

tbody tr:nth-child(even)>* {
  background: #CDE;
}

table tbody tr:last-child td {
  border-bottom: 0px;
}

table tbody tr:last-child td:first-child {
  border-bottom: 0px;
  border-bottom-left-radius: var(--border-radius);
}

table tbody tr:last-child td:last-child {
  border-bottom: 0px;
  border-bottom-right-radius: var(--border-radius);
}

fieldset,
object {
  border: none;
}


#top > div {
  width: 85%;
  border-style: solid;
  border-width: 0 0 1px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 77rem;
  margin: 0 auto;
  padding: 0 0.2rem;
}

h1 {
  font-size: 1.5em;
  letter-spacing: 0;
  padding: 0.25rem 0;
  font-family: bgCyr2;
}

h2 {
  font-family: bgCyr2;
}

/* HOME MENU  */

/* 
#homeMenu {
  display: flex;
}
#homeMenu li {
  list-style: none;
  display: inline-block;
  width: calc(100% / 3);
  text-align: center;
  background-color: #00b6db;
  margin: 0.2em;
  padding: 0.3em 0.4em;
  box-sizing:content-box;
  border-radius: var(--border-radius-small);
}

#homeMenu li a {
  display:block;
  text-decoration:none;
	color:white;
  white-space: nowrap;
	transition:color 0.3s, scale 0.2s;
} */

#topContentMenu li,
div.useTemplate div {
  background-color: #00b6db;
  margin: 0.1em;
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius-small);
  list-style: none;
  display: inline;
}

.smallmenu #topContentMenu li {
  display: inherit;
}


#topContentMenu li a,
div.useTemplate span,
div.useTemplate a {
  background-color: #00b6db;
  text-decoration: none;
  color: white;
  white-space: nowrap;
  transition: color 0.3s, scale 0.2s;
  cursor: pointer;
}

#topContentMenu li a:hover,
div.useTemplate span:hover,
div.useTemplate a:hover {
  color: rgb(100, 90, 90);
}

/* MAIN MENU  */

#mainMenu li {
  list-style: none;
  display: inline;
}

#mainMenu li > a {
  text-decoration: none;
  color: #444;
  display: inline-block;
  padding: 0.6rem 0;
  margin-left: 1rem;
  font-size: 1.2rem;
  transition: color 0.3s, scale 0.2s;
}

/* #mainMenu li a:focus, */
#mainMenu li a:hover {
  scale: 1.1;
  color: #176;
}


main>section {
  max-width: 77rem;
  margin: 0 auto;
  padding: 0 1rem 1rem 1rem;
  text-align: center;
}

/* FORMS */

form {
  background: #CDE5;
  border-radius: var(--border-radius);
}

form fieldset {
  padding: 1em var(--outerPad) 0.25em;
}

form input,
form select,
form textarea {
  font-family: bgCyr, monospace, "Helvetica", "Arial", sans-serif;
  width: 100%;
  padding: 0.25em 0.5em;
  margin: 0.125em 0 0.75em;
  border: 1px solid #888;
  border-radius: var(--border-radius-small);
}

form input[type=radio] {
  width: auto;
}

fieldset > label {
  /* margin-bottom: 0.5em; */
  display: block;
  cursor: pointer;
  font-family: bgCyr2;
  font-weight: 700;
  text-indent: 0.1em;
}

form label div {
  font-weight: normal;
}

form input[type=checkbox] {
  width: auto;
  margin-left: 0.4em;
}

form h2 {
  background: #CDE;
  padding: 0.5rem var(--outerPad);
  border-top-right-radius: var(--border-radius);
  border-top-left-radius: var(--border-radius);
  border-bottom: 0.0625rem solid #888;
}


/* #imgGallery + div {
  margin-left: auto;
  align-self: flex-start;
  max-width: 200px;
} */
.galleryParent {
   flex: 1 0 auto;
   vertical-align: middle;
}
.galleryParent button { 
  margin: auto;
  max-width: 50%;
}
/* .break {
  flex-basis: 100%;
  height: 0;
} */

.custom-file-input {
  max-width: 48%;
  cursor: pointer;
}
.custom-file-input::file-selector-button {
  display: none;
}

.custom-file-input::after {
  content: 'Избери';
  float: right;
  padding-left: 0.3em;
  margin: 0.1em 0.6em 0 0;
  display: block;
}


.borders::before{
  border-top: 1px solid black;
  /* border-bottom: 1px solid black; */
  content: ""; /* So that it will show */
  display: block; /* So it can have width */
  width: 100%; /* Make sure position on these elements is relative (or something besides default) */
  height: 1px;
  margin: 0px auto; /* Center the line */
}

#imgGallery {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1em;
  align-items: start;
  padding: 0.2em 0.125em;
}

#imgGallery div {
  position: relative;
}

#imgGallery img {
  cursor: pointer;
  max-width: 120px;
}
#imgGallery div span {
  font-size: 80%;
  word-wrap: break-word;
}

#imgGallery .del {
  cursor: pointer;
  position: absolute;
  color: rgb(251, 129, 129);
  font-weight: 600;
  line-height: 1em;
  top: 4px;
  right: 5px;
  z-index: 10;
  transition: color 0.3s, scale 0.2s;
}

#imgGallery .del:hover {
  color: red;
  top: 1px;
  right: 4px;
  font-size: 140%;
}

#imgGallery div {
  max-width: 120px;
}

#imgFrame {
  cursor: pointer;
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vw;
  min-height: 100px;
  min-width: 200px;
  margin: auto;
  background-color: rgb(0, 0, 0, 0.1);
  text-align: center;
  z-index: 20
}


#imgFrame img {
  max-width: 100%;
  max-height: 100%;
}
form footer {
  display: flex;
  align-items: end;
  padding: 0 var(--outerPad) 1rem;
  margin-top: 1em;
}

form footer button:last-child {
  margin-left: auto;
  align-self: end;
}


/* */

.btn {
  background: #F0F0F0 none repeat scroll 0 0;
  border: 1px solid #b9b9c1;
  color: black;
  text-align: center;
  outline: medium none;
  padding: 0.14em 0.28em;
  border-radius: 5px;
  user-select: none;
  text-decoration: none;
  font-size: 80%;
  width: fit-content;
  margin: auto;
  /* line-height: 80%; */
  font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", Roboto, "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
}

.btn:hover {
  Background-color: #d4d4d4;
}

.btn:active {
  Background-color: #bcb7b7;
}

.tooltip {
  text-align: center;
  color: #176;
  width: 100%;
  font-size: 120%;
  /* The desired time (2 seconds) before the animation starts */
  animation-delay: 10s;
  animation-duration: 1s;
  animation-fill-mode: both;
  animation-name: fadeOut;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.cntr {
  text-align: center;
}

.fakeInput {
  font-weight: normal;
  padding: 0.1em 0.3em 0 0.3em;
  min-height: 1.75em;
  background-color: #e7e7e7;
  border: 1px solid #777;
  border-radius: var(--border-radius-small);
}

.internalBtn::after {
  content: "Търси";
  display: block;
  color: #444;
  /* background: url('/img/breadcrumb-icon.png') no-repeat; */
  border-left: 1px solid black;
  /* border-radius: var(--border-radius-small); */
  height: 20px;
  float: right;
  /*icon on the left*/
  padding-left: 0.3em;
  margin: 0.1em 0.6em 0 0;
  /*margin on the right so there is a gap between your icon and link*/
}

.normalFont {
  font-size: 1em;
}


/* #choosePmntFrame {
  cursor: pointer;
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: var(--base-width);
  max-height: 20em;
  min-height: 100px;
  min-width: 200px;
  margin: auto;
  background-color: rgb(0, 0, 0, 0.1);
  text-align: center;
  z-index: 20
} */

/* TEST */

.bg1 {
  font-family: bgCyr;
}

.bg2 {
  font-family: bgCyr2;
}

.bg3 {
  font-family: bgCyr3;
}

.bg4 {
  font-family: bgCyr4;
}

.bg1b {
  font-weight: 700;
  font-family: bgCyr;
}

.bg2b {
  font-weight: 700;
  font-family: bgCyr2;
}

.bg3b {
  font-weight: 700;
  font-family: bgCyr3;
}

.bg4b {
  font-weight: 700;
  font-family: bgCyr4;
}


@font-face {
  font-family: bgCyr2;
  font-style: normal;
  src: url(Overpass-Regular.woff2);
}

@font-face {
  font-family: bgCyr3;
  font-style: normal;
  src: url(npoekmu_me-os_bg-Regular.woff2);
}

@font-face {
  font-family: bgCyr4;
  font-style: normal;
  src: url(Veleka-Regular.woff2);
}

/*  */

ul {
  margin-left: 0.75em;
  text-align: left;
}

#partnerForm fieldset,
#protocolForm fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  width: 100%;
  /* margin-bottom: 1em; */
  justify-content: center;
}

#paymentForm fieldset > * {
  margin-bottom: 1em;
}

#partnerForm fieldset label,
#protocolForm fieldset label {
  width: 34%;
  flex: 1 0 auto;
}

#protocolForm fieldset > div {
  width: 45%;
  flex: 1 0 auto;
}

#protocolForm table {
  width: 100%;
}

#searchForm {
  display: none;
  margin: 0.6em 0 1em;
  padding: 0.8em;
  border: solid #888;
  border-width: 1px;
  border-radius: var(--border-radius);
  font-size: 80%;
  box-shadow: 0 10px 6px -6px #777;
  /* box-shadow: 4px 4px 4px lightblue; */
}

.radio-btns {
  display: flex;
  gap: 1em;
  flex-grow: 1;
}

.radio-btns div {
  flex: 1 0;
}

.radio-btns div label{
  display: inline;  
  margin-left: 0.2em;
}

.radio-btns div input {
  width: auto;
}

#searchForm input[type="radio"] {
  display: inline;
}

#searchResults {
  font-size: 120%;
}

#searchResults .line {
  display: flex;
  gap: 1em;
  width: 100%;
  margin-top: 0.2em;
  padding: 0.2em;
  border-top: 1px solid #777;
}

#searchResults .line span {
  align-self: end;
  width: 75%;
  white-space: nowrap; 
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

#searchResults .line .btn {
  align-self: end;
  font-size: 100%;
}

#searchResults .line span .partnerTooltip,
.fakeInput2 .partnerTooltip{
  position: absolute;
  z-index: 1;
  visibility: hidden;
  background-color: rgb(21, 21, 21);
  color: white;
  padding: 0.3em;
  width: auto;
  border-radius: var(--border-radius-small);
}

#searchResults .line span:hover .partnerTooltip,
.fakeInput2:hover .partnerTooltip{
  visibility: visible;
}


#searchResults .line:first-of-type {
  border: none;
}

#searchForm input[type=checkbox] {
  margin-right: 0.7em;
}

#searchResults table {
  border-width: 1px 1px 1px 1px;
  border-radius: var(--border-radius);
}

#searchResults table thead {
  padding: 0.4em 0.4em;
  font-size: 80%;
  color: #FFF;
}
#searchResults table thead tr * {
  background: var(--dark-caption);
}

#searchResults table thead tr th:first-child  {
  border-top-left-radius: var(--border-radius);
}

#searchResults table thead tr td:last-child  {
  border-top-right-radius: var(--border-radius);
}

#sellerAlias {
  user-select: none;
  /* pointer-events: none; */
}

/* DIALOG */

dialog form {
  padding: 1em;
}

dialog form .buttons {
  margin-top: 1em;
  display:flex;
  flex-direction: row;
  gap: 1em;
  justify-content: center;
}

/* top bar above forms*/
.smallmenu {
  margin: 1em 0.3em 0.5em 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
}

#contextMenu {
  background-color: white;  
  position: fixed;
  top: 5em;
  right:1em;
  /* left: calc( var(--baseW) + (100vw - var(--baseW))/2 + 0.3em); */
  min-width: 8em;
  /* min-height: 100px; */
  padding: 0.4em;
  border: 1px solid #777;
  border-radius: var(--border-radius-small);
  display: none;
  gap: 0.2em;
  flex-direction: column;  
}

#ctxParent {
  position: absolute;
  /* right: -5px; */
}

#contextMenu span {
  /* margin-top:0.2em; */
  font-size: 80%;
}

#countLabel {
  font-size: 1em !important;
}

/* .flexMain {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
} */

#chooseProtoDialog #searchResults {
  font-size: 80%;
  margin-bottom: 0.5em;
  background-color: white;
  padding: 0.2em;
  border-radius: var(--border-radius-small);
}

#chooseProtoDialog .radio-btns label {
  font-size: 80%;
}

#settingsBtn {
  text-align: end;
  margin: auto;
  cursor: pointer;
}
#settingsBtn img {
  vertical-align: middle;
}

#settingsRow {
  display:none;
  font-size: 80%;
}

/* Template page */
#templateForm table td {
  padding: 0.35em 0.5em;
}
td input, td select {
  margin:unset;
}

.fakeInput2 {
  font-weight: normal;
  font-size: 90%;
  padding: 0.1em 0.3em 0 0.3em;
  min-height: 1.75em;
  background-color: #e7e7e7;
  border: 1px solid #777;
  text-align: center;
  cursor: pointer;
  border-radius: var(--border-radius-small);
}

/*  Dropdown menu  */

.dropdown {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
  font-size: 1.2rem;
  color: #444;
}

.dropdown-content {
  left:0;
  display: none;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

.dropdown-content a {
  font-size: small;
  text-align: left;
  color: black;
  padding: 0.5rem 0.6rem;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {background-color: #ddd;}

.dropdown:hover .dropdown-content {display: block;}