
/* Apply box-sizing to all elements and pseudo-elements */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Variables! (Use through var()) */
:root {
  --dark-red: #8B0000;
  --down-arrow: '\25BC';
  --right-arrow: '\25B6';
  --up-arrow: '\25B2';
  --button-background: rgb(37, 116, 169);
  --button-background-hover: rgb(13, 64, 90);
  --overlay-z: 50;
}

/* TODO: review */
html {
  line-height: 1.15;
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  /* To make background image work -- care!! */
  position: relative;
  min-height: 100%;
}

body {
  max-width: 100%;
  margin: 0;
  font-family: 'Lato', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /*background-color: #f64545;*/
  background:
    /* opacity layer */
    linear-gradient(rgba(255,255,255,0.8), rgba(255,255,255,0.8)),

    /* actual image */
    url('../resources/img/garden.jpg') center top / 100% auto repeat-y;
}

label[disabled=''] {
  opacity: 0.5;
}

.basic-page {
  width: 90%;
  background-color: white;
  margin: 0 auto;
  border-radius: 0;
  margin-bottom: 2rem;
}

/* Basic support for TEI-XMLGAT CSS*/
supplied::before { 
  content: "[";
}
supplied::after { 
  content: "]";
}

hi[rend="italic"] {
  font-style: italic;
}
hi[rend="bold"] {
  font-weight: bold;
}
hi[rend="underline"] {
  text-decoration-line: underline;
}
hi[rend="strike"] {
  text-decoration-line: line-through;
}
g[ref="ell"]::after {
  content: '...';
}


/*******
* Loader
*******/
#loading_overlay {
  position: fixed;
  inset: 0;                     /* covers the whole screen */
  background: rgba(255,255,255,0.6);
  display: none;                /* hidden unless loading */
  z-index: 100;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid #3498db;
  width: 120px;
  height: 120px;
  -webkit-animation: spin 2s linear infinite; /* Safari (c-check) */
  animation: spin 2s linear infinite;
}
/* Safari (TODO: c-check) */
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Basic button, typically used for searches */
.basic-button {
  background-color: var(--button-background); /* Button background color */
  color: white;           /* Text color */
  border: none;          /* No border */
  padding: 10px 20px;    /* Padding */
  border-radius: 5px;    /* Rounded corners */
  cursor: pointer;        /* Pointer cursor on hover */
  transition: background-color 0.3s; /* Smooth background transition */
}
.basic-button:hover {
  background-color: var(--button-background-hover); /* Darker shade on hover */
}
.basic-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
.basic-button:disabled:hover {
  background-color: var(--button-background);
}



/***********
************
* SECTIONS *
************
***********/

/******
* Title
******/
#logo-container {
  display: grid;
  grid-template-columns: repeat(12, [col-start] 1fr);
  align-items: center;
  width: 100%
}

#logo-container > * {
  grid-column: span 4;
  justify-self: center;
}

#title-container {
  display: flex;
  justify-content: center;
}

.logo-t {
  width: 200px;
  height: auto;
}

#main-title {
  font-family: 'Nanuto', sans-serif;
  font-weight: 900;
  color: var(--dark-red);
  font-size: 4rem;
  margin: 0;
}

#full-title {
  font-size: xx-large;
  text-align: center;
  font-family: 'Nanuto', sans-serif;
}

#full-title .alert {
  color: var(--dark-red);
}

@media (max-width: 700px) {
  .logo-t {
    width: 110px;
  }
  #main-title {
    font-size: 2.2rem;
    margin-top: 1rem;
  }
  #full-title {
    font-size: x-large;
  }
}


/******
* Login
******/
#login {
  text-align: center;
}
#login-parameters {
  padding: 1rem;
}
#login-button {
  margin-bottom: 1rem;
}

/**************
* Search
**************/
#search-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

#search .hidden{
  display: none;
}

#search-container input {
  padding: .55rem;
  margin: .5rem 1px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#search-container .radio-group {
  display: flex;
  flex-direction: column;
  margin-left: 1rem;
}

.radio-group span{
  font-size: smaller;
}

#search-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  justify-items: center;
}

@media (max-width: 700px) {
  #search-container {
    flex-direction: column;
  }
  #search-fields {
    grid-template-columns: repeat(2, 1fr);
  }
  #search-fields input {
    width: 90%;
    justify-self: start;
  }
}

#adv-search-button-container{
    height: 4rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}


/**********
* Text list
**********/
#text-list-container {
  --sticky-add-height: 1.1rem;
  overflow-y: scroll;
  max-height: 60vh;
  transition: max-height 0.4s ease;
}
#text-list-container.close-accordion {
  max-height: 4.2rem;
  overflow-y: hidden;
}

#sticky-add{
/*  top: 0;
  position: sticky;*/
  width: 100%;
  background-color: white;
  height: var(--sticky-add-height);
}
#sticky-add:hover {
  text-shadow: 0 0 1px rgba(0,0,0,0.4);
}
#sticky-add:after {
  padding-left: 1rem;
  content: '[Nascondi lista testi]';
  color: var(--button-background);
  text-decoration: underline;
  font-size: small;
}
#sticky-add.close-accordion:after {
  content: '[Mostra lista testi]';
}

#text-list-table {
  width: 100%;
  border-collapse: collapse;
}

#text-list-header {
  /*top: var(--sticky-add-height);*/
  top: 0;
  position: sticky;
}

#text-list-table tr:hover {
  background-color: #ddd;
}

#text-list-table tr.selected {
  background-color: #ccc;
}

#text-list-table th.default-sorted-ascending::after {
  content: var(--up-arrow);
  opacity: 0.5;
}
#text-list-table th.default-sorted-descending::after {
  content: var(--down-arrow);
  opacity: 0.5;
}
#text-list-table th.sorted-ascending::after {
  content: var(--up-arrow);
  opacity: 1;
}
#text-list-table th.sorted-descending::after {
  content: var(--down-arrow);
  opacity: 1;
}

#text-list-table th, #text-list-table td {
  padding: 1rem;
  text-align: left;
  border: 1px solid #ddd;
  border-left: 0px solid;
  border-right: 0px solid;
  color: #646464;
}

#text-list-table th {
  padding-top: 0.5rem;
}

#text-list-table th {
  background-color: #fafafa;
  font-weight: bold;
}


/*********
* The text
*********/
#the-text {
  --text-bib-col-width: 45%;
  --space-left-right: 5%;
}

#text-information-body {
  display: flex;
  overflow: auto;
}

@media (max-width: 700px) {
  .text-header {
    display: none;
  }
  #text-information-body {
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    margin: 2rem;
  }
}

.text-info-h2 {
  font-weight: bold;
  text-transform: uppercase;
  margin: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ccc;
}

/***********************
* The text - Actual text
***********************/
.text-header {
  font-size: x-large;
  padding: 1rem 5%;
  margin: 0;
  top: 0;
  position: sticky;
  background-color: white;
  width: 100%;
}

#actual-text {
  border: 1px solid #ddd;
  border-radius: .5rem;
  padding: 0 2rem;
  max-height: 90vh;
  overflow: auto;
  font-family: Cambo;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
}

#actual-text.associated-text {
  grid-template-columns: repeat(2, 1fr);
}

.associated-text-controller {
  display: none;
}

@media (max-width: 700px) {
  #actual-text.associated-text {
    grid-template-columns: repeat(1, 1fr);
  }
  .associated-section-text {
    padding-left: 1.2rem;
    height: 0px;
    overflow: hidden;
    transition: height 0.4s ease;
  }
  .associated-text-controller {
    display: block;
    padding-left: 1.7rem;
    font-weight: bold;
  }
}

#actual-text .par-header {
  font-weight: bold;
  text-transform: capitalize;
  padding-top: .5rem;
}

#actual-text th {
  text-align: left;
}

#actual-text td {
  padding-right: .5rem;
  text-align: left;
  white-space: pre-wrap;
}

.bottom-spacer {
  height: 2rem;
}
.bottom-spacer.hidden {
  display: none;
}

/* TODO: possibly compact a bit */
/************************
* The text - Bibliography
************************/
#text-bibliography>div, #text-bibliography>table {
  padding: .1rem .8rem;
}

#text-bibliography {
  max-width: var(--text-bib-col-width);
  flex-basis: var(--text-bib-col-width);
  margin-left: var(--space-left-right);
}

#bib-body {
  max-height: 20rem;
  overflow-y: scroll;
  transition: max-height 0.4s ease;
}

@media (max-width: 700px) {
  #text-bibliography {
    max-width: 100%;
    position: relative;
  }
  #bib-body.closed-accordion {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }
  #bib-header::after {
    content: "−";
    position: absolute;
    right: 0;
    font-size: 1.5rem;
    transform: translateY(-25%);
}
  #bib-header.closed-accordion::after {
    content: '+';
  }
}

.bib-keys {
  font-weight: bold;
  margin: 0;
  padding: 0;
  padding-right: 1.5rem;
}
.bib-keys::after {
  content: ':';
}

#bib-content tr {
  vertical-align: text-top;
}

/*********************
* The text - Text refs
*********************/
#text-refs {
  --text-ref-col-width: 45%;
}

#text-refs {
  max-width: var(--text-ref-col-width);
  flex-basis: var(--text-ref-col-width);
  margin: 0 var(--space-left-right);
}

#text-refs>div {
  padding: .1rem .8rem;
}

#text-refs-content {
  max-height: 20rem;
  overflow-y: scroll;
  transition: max-height 0.4s ease;
}

@media (max-width: 700px) {
  #text-refs {
    max-width: 100%;
    position: relative;
    margin-right: 0;
  }
  #text-refs-content.closed-accordion {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }
  #refs-header::after {
    content: "−";
    position: absolute;
    right: 0;
    font-size: 1.5rem;
    transform: translateY(-25%);
}
  #refs-header.closed-accordion::after {
    content: '+';
  }
}

#text-refs-content .single-ref {
  text-transform: capitalize;
}
#text-refs-content .single-ref.untitled::after {
  content: '[senza titolo]';
}

#text-refs-content .single-ref:hover {
  text-decoration: underline;
}

#text-refs-content .single-ref::before {
  content: 'Sezione: '
}


/**********
* TLIO menu
**********/

#tlio-menu {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}
#tlio-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#tlio-menu li {
    padding: 10px 15px;
    cursor: pointer;
}
#tlio-menu li:hover {
    background-color: #e0e0e0;
}

/*************************
* TLIO menu - TLIO results
*************************/

#tlio-results {
  position: fixed;
  top: 50vh;
  left: 60vw;
  width: 30vw;
  height: 30vh;
  border: 1px solid black;
  z-index: var(--overlay-z);
  background-color: white;
}

#tlio-results.hidden {
  display: none;
}