/* MIT License

Copyright (c) 2023 PurpleAir

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
/*
select{
  position: relative;
  outline: none;
  transition: var(--transition-time);
  color: white;
  background-color: #222;
  font-size: 16px;
  margin-bottom: 28px;
  top: 5px;
  
  &:invalid {
  color: red;
  };
  &:hover {
  box-shadow: 10px 0 0 50px #aaaaaa1a;
  };
  &:focus {
  box-shadow: 0 0 0 3px #aa44aa;
  }
}*/

:root {
  --primary-purple: #cb58cb;
  --secondary-gray: #aaa;
  --brighter-purple: #ff5aff;

  /*--darker-grey: #4e4853;*/
  /*--darker-grey: #403c44;*/
  --darker-grey: #524f54;

  --softer-white: rgb(233, 224, 225);

  --transition-time: 0.1s;
}

body {
  font-family: "Figtree";
  margin: 0;
  color: white;
  overflow-x: hidden;
  overflow-y: hidden;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(250px, 15%) auto;
}

a {
  color: var(--brighter-purple);
}

.gone {
  display: none !important;
}

.menu-section {
  background-color: #222;
  width: 100%;
  height: 100vh;
  z-index: 1;
  box-shadow: 0 0 3px 2px rgba(0, 0, 0, 0.1);
  overflow-x: hidden;
  overflow-y: auto;
}

.menu-title {
  font-size: 20px;
  font-weight: bold;
  position: relative;
  letter-spacing: 1.5px;
  top: 4px;
  left: 20px;
}

.menu-items-container {
  width: 100%;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu-item {
  position: relative;
  color: #898989;
  background: transparent;
  border: none;
  width: 100%;
  height: 50px;
  transition: var(--transition-time);
  font-size: 16px;
  font-weight: bold;
  border-left: transparent 5px solid;
  border-right: transparent 5px solid;
  text-align: left;
  cursor: pointer;
  padding: 0 15px;
}

.menu-item i {
  margin-left: 20px;
}

.menu-item p {
  position: absolute;
  top: 0px;
  left: 16px;
}

.menu-item:hover {
  border-left: white 5px solid;
  background-color: #00000022;
  color: white;
}

.menu-item.selected {
  border-left: var(--brighter-purple) 5px solid;
  color: var(--brighter-purple);
}

.content-section {
  background-color: #333;
  width: 100%;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.page-container {
  display: flex;
  flex-direction: column;
  width: 80%;
  margin: 30px auto;
  padding-bottom: 50px;
}

.page-title {
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 3px;
  color: white;
  margin-bottom: 20px;
  margin-top: 0px
}

.page-header {
  font-size: large;
  color: var(--brighter-purple);
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 35px;
}

.whats-new {
  background-color: #222;
  padding: 10px;
  border-radius: 6px;
  margin-top: 20px
}

.whats-new p {
  margin: 0;
}

.user-input[type=text],
.user-input[type=number],
.user-input[type=date],
.user-input[list] {
  position: relative;
  padding: 5px;
  width: calc(100% - 10px);
  border: none;
  border-radius: 2px;
}

.user-input {
  outline: none;
  transition: var(--transition-time);
  background-color: #222;
  color: white;
  font-size: 16px;
  margin-bottom: 28px;
  top: 5px;
}

select.user-input {
  /*appearance: none;*/
  width: 100%;
  text-align: justify;
}

input:invalid {
  color: red;
}

input:hover {
  box-shadow: 0 0 0 5px #aaaaaa1a;
}

input:focus {
  box-shadow: 0 0 0 3px #aa44aa;
}

input[type=checkbox] {
  margin-top: 10px;
  border-radius: 2px;
}

input[type=checkbox]:hover {
  outline: 5px solid #484848;
}

input[type=checkbox]:focus {
  outline: 3px solid #aa44aa;
}

::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.primaryButton {
  position: relative;
  padding: 5px;
  width: 100%;
  border: none;
  border-radius: 2px;
  outline: none;
  transition: var(--transition-time);
  background-color: var(--primary-purple);
  color: white;
  font-size: 16px;
  top: 5px;
  cursor: pointer;
}

.primaryButton:hover,
.primaryButton:focus {
  background-color: #d25fd2;
  box-shadow: 0 0 0 5px #aaaaaa1a;
}

.secondaryButton {
  position: relative;
  padding: 5px;
  width: 100%;
  border: none;
  border-radius: 2px;
  outline: none;
  background-color: #999;
  color: white;
  font-size: 16px;
  top: 5px;
  cursor: pointer;
  transition: var(--transition-time);
  margin-bottom: 25px;
}

.secondaryButton:hover,
.secondaryButton:focus {
  background-color: var(--secondary-gray);
  box-shadow: 0 0 0 5px #aaaaaa1a;
}

label {
  color: #9b9b9b;
  font-style: italic;
  position: relative;
}

label.required::after {
  content: " *";
}

.tooltip-icon {
  background-image: url("/assets/tooltip-icon.png");
  background-size: contain;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;

  background-color: transparent;
  border: none;
  position: absolute;
  left: -24px;
  top: 1px;
  color: inherit;
  transition: var(--transition-time);
}

.tooltip-icon:hover {
  box-shadow: 0 0 0 5px #aaaaaa1a;
}

/* relative position anchor 
   this allows us to absolute position
   based on the current element's position
   (this is because absolute uses the parent elements position to start with)
*/
.download-history-hoverable > div {
  position: relative;
  overflow:visible !important;
}

/*
.download-history-hoverable > div > p,
.hoverable-content {
  font-family: "Figtree";
  font-weight: normal;
  position: absolute;
  background-color: white;
  width: 20000px;
  height:10000px;
  overflow:visible;
  height: auto;
  white-space: normal;
  /* top: 0px; * /
  top:-3em;

  /* cover info on the right * /
  left:90%;

  padding: 10px;
  border-radius: 4px;
  z-index: 5000000;
  color: black;
  text-transform: none;
  display: none;
  box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
  cursor: auto;
}
*/

.tooltip-icon p {
  font-family: "Figtree";
  font-weight: normal;
  position: absolute;
  background-color: white;
  width: 50vw;
  height: auto;
  top: 0px;
  padding: 10px;
  border-radius: 4px;
  z-index: 5;
  color: black;
  text-transform: none;
  display: none;
  box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
  cursor: auto;
  word-break: break-word;
}

.tooltip-icon:hover p,
.download-history-hoverable:hover p,
.tooltip-icon p:hover {
  animation: tooltip-entry 0.3s ease;
  display: block;
}

.correction-popup {
  background-color: white;
  color: black;
  position: absolute;
  left: 0;
  top: 54px;
  width: 210px;
  max-height: 210px;
  border-radius: 2px;
  border-top-left-radius: 0;
  z-index: 4;
  box-shadow: 0 0 3px 5px rgba(0, 0, 0, 0.2);
  display: none;
  padding: 10px;
}

.correction-popup:focus-within,
input:invalid:focus+.correction-popup {
  animation: tooltip-entry 0.3s ease;
  display: block;
}

@keyframes tooltip-entry {
  0% {
    transform: translateY(-5px);
    background-color: transparent;
    color: transparent;
  }

  100% {
    transform: translateY(0px);
  }
}

.action-buttons-container {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 10px;
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
}

.action-button-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
}

.action-button {
  position: absolute;
  background-color: transparent;
  cursor: pointer;
  right: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 50%;
  transition: 0.2s;
}

.action-button:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

.action-button:hover+.action-button-tooltip,
.action-button-tooltip:hover {
  animation: tooltip-entry 0.3s ease;
  display: block;
}

.action-button-error-alert {
  position: absolute;
  top: 0;
  right: 0;
  background-color: transparent;
  pointer-events: none;
}

.action-button-error-alert::after {
  content: "!";
  position: absolute;
  top: -4px;
  right: 0;
  width: 12px;
  height: 12px;
  color: red;
  text-align: center;
  font-size: large;
  font-weight: bold;
  pointer-events: none;
}

.action-button-tooltip {
  box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
  position: absolute;
  right: 0;
  top: calc(25% + 8px);
  background-color: white;
  color: black;
  z-index: 10;
  width: 40vw;
  border-radius: 4px;
  display: none;
  padding: 10px;
}

span:focus-within .field-menu,
.field-menu:hover {
  animation: tooltip-entry 0.3s ease;
  display: grid;
}

.field-menu {
  position: absolute;
  left: 0;
  top: 54px;
  width: 210px;
  max-height: 210px;
  background-color: white;
  border-radius: 2px;
  border-top-left-radius: 0;
  z-index: 4;
  box-shadow: 0 0 3px 5px rgba(0, 0, 0, 0.2);
  display: none;
  padding: 10px 10px 2px 10px;
  grid-template-columns: 24px 1fr;
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: all;
}

.field-menu input {
  margin: 0;
  padding: 0;
}

.field-menu label {
  position: relative;
  top: -4px;
  font-style: normal;
  color: black;
  margin-bottom: 0;
}

.loader {
  position: absolute;
  bottom: 10px;
  right: 12px;
  animation: loader 3s infinite ease;
  height: 30px;
}

@keyframes loader {
  40% {
    transform: rotate(0deg);
  }

  70% {
    transform: rotate(-375deg);
  }

  90% {
    transform: rotate(-360deg);
  }

  99% {
    transform: rotate(-360deg);
  }

  99.001% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

/* ===== Progress Bar ===== */

.progress-section-wrapper {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-section-wrapper > button {
  width: 80%;
}

#progress-bar-text {
  display: flex;
  width: 75%;
  flex-direction: row;
  justify-content: space-between;
  gap: 20px;
}

.progress-bar-container {
  position: relative;
  width: 80%;
  height: 2rem;
  background-color: #222;
  border-radius: 100px;
}

.progress-bar-container img {
  position: absolute;
  top: -40px;
  left: calc(50% - 15px);
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: max(2rem, 1%);
  height: 100%;
  border-radius: 100px;

  background-image: linear-gradient(45deg, #a4a 25%, var(--primary-purple) 25%, var(--primary-purple) 50%, #a4a 50%, #a4a 75%, var(--primary-purple) 75%, var(--primary-purple));
  font-size: 30px;
  background-size: 1em 1em;
  box-sizing: border-box;
  animation: barStripe 1s linear infinite;

  transition: 0.7s ease-in-out;
}

@keyframes barStripe {
  0% {
    background-position: 1em 0;
  }

  100% {
    background-position: 0 0;
  }
}

.progress-logs {
  width: 100%;
  height: 40vh;
  min-height: 15rem;
  overflow-x: hidden;
  overflow-y: auto;
  background-color: #222;
  margin: 20px auto;
  border-radius: 2px;
  line-height: 19px;
  font-size: 16px;
}

.progress-logs-label {
  top: 17px;
  margin-bottom: auto;
  width: 100%;
  text-align: left;
}

#reveal-directory-span {
  margin-left:10%;
  margin-right:10%;
}

.button-abort {
  height: 1.5rem;
  background-color: #c52c2c;
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: var(--transition-time);
  margin-top: 30px;
  font-size: 16px;
}

.button-abort:hover {
  background-color: #d33636;
  box-shadow: 0 0 0 5px #aaaaaa1a;
}

.version-text {
  position: absolute;
  bottom: 0;
  right: 16px;
}

.version-text div {
  position: absolute;
  bottom: 24px;
  right: 0;
  background-color: white;
  color: black;
  border-radius: 4px;
  border-bottom-right-radius: 0;
  display: none;
  box-shadow: 0 1px 3px 3px rgba(0, 0, 0, 0.1);
  padding: 10px;
  font-style: italic;
}

.version-text:hover div {
  animation: tooltip-entry 0.3s ease;
  display: block;
}

.error-box {
  position: relative;
  color: white;
  background-color: rgba(255, 0, 0, 0.2);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  margin: 0;
}

.error-box::before {
  content: "!";
  padding: 0 10px;
  position: relative;
  right: 4px;
  font-size: larger;
  font-weight: bold;
  color: #f62a2a;
}


.loading-spinner {
  border: 16px solid #f3f3f3;
  /* Light grey */
  border-top: 16px solid #3498db;
  /* Blue */
  border-radius: 50%;
  width: 120px;
  height: 120px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

table {
  /* table-layout: auto; */
}

td {
  white-space: nowrap;
  width: 0.1%;
  padding-bottom: 0.2em;
}



.download-history-status {
  margin:auto;

  min-width: 100%;
}


.download-history-status-successful {
  /*background-color: green;*/
  background-color: rgb(1, 113, 1);
}

.download-history-status-paused {
  background-color: var(--darker-grey);
}

.download-history-status-failure {
  /*background-color: red;*/
  background-color: rgb(242, 8, 8);
}

#download-history-table {
  border-radius: 2px;
}

#download-history-table th td {
} 

#download-history-table-wrapper {
  overflow-x: scroll;
}

#download-history-table-header th {
  /*background-color: #6e6e6e;*/
  /*background-color: #32384b;*/
  /*background-color: #6c378b;*/
  /* background-color: #3f4047 */

  /* grey with just a tinge of purple */
  /*background-color: #564d5b*/
  /*background-color: #49444d;*/
  background-color: var(--darker-grey);

 }

.download-history-reveal-button {
  display:block;

  width:20%;
  margin: auto;
  margin-top: 10%;
  margin-bottom: 10%;

  min-width: 3.5em;

  background-color: var(--softer-white);
  border-radius: 6px;
 }


/* https://stackoverflow.com/questions/17779293/css-text-overflow-ellipsis-not-working */
#download-history-table td {
  /* This CSS is all required for the ellipses to work properly
     when truncating text in the table */
  max-width: 100px;
  min-width: 3em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /******************/
  
  padding-top:0.0em;
  padding-bottom:0.0em;

  padding-left:0.4em;
  padding-right:0.4em;

  background-color: #222;


  /*display:inline-block;
  width:200px;*/

  /* width: 10%; */
/*
  white-space: nowrap;

  text-overflow:ellipsis;
  overflow:hidden;

  max-width: 100px;*/
}

/* Increase spacing for nested bullets */
ul > ul > li {
  margin: 0.4em 0;
}

