: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-style: bold;
    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,dl,dt,dd,table,tr,td,th,p,img {
    margin: 0;
    padding-top: 0;
    font-family: bgCyr6, 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;
  }
  p {
    margin-bottom:1em;
  }

  ul {
    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);
    min-width: 500px;
    padding: 1rem;
    position: relative;
  }
  
  .noPadMain {
    padding: 0;
  }

  .smallMain {
    max-width: var(--baseW/2);
  }
  
  #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: 1px 1px 1px 1px;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    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 1px 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 >* {
    background: rgb(226, 236, 246);
  }
  
  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;
  }
  
  
  #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;
  }
  
  
  /* #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);
  }

  @font-face {
    font-family: bgCyr5;
    font-style: normal;
    src: url(balezdrov11-Regular.otf);
  }
  
  @font-face {
    font-family: bgCyr6;
    font-style: normal;
    src: url(SvetSans-Regular.otf);
  }
  
  /* 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;
  } */

  input[type="text"],
  input[type="password"] {
    width: 100%;
    font: 1.25rem;
    display: block;
    padding: 0.2em 0.2em;
    margin-bottom: 0.5em;
  }
  