@import url('/css/utils.css');

main {
  width: 100%;
  max-width: 100vw;
  margin-left: auto;
  margin-right: auto;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

input, input:focus, select, select:focus {
  outline: none;
  min-width: 10rem;
  padding: 0.5rem;
  background-color: white;
  color: #3e3e3e;
  border: 1px solid #3e3e3e;
}

.settings-group {
  padding-top: 1rem;
  padding-bottom: 1rem;
  width: 100%;
}

.settings-group > h2 {
  font-size: 1.5rem;
}

.settings-group > * {
  padding-bottom: 1rem;
}

#storage-value {
  padding: 1rem;
  white-space: pre;
  font-family: 'Roboto Mono', 'Courier', monospace;
  font-size: 75%;
}

#application-info {
  width: 100%;
}

#application-info th {
  width: 40%;
  max-width: 15em;
}

#cache-elements * {
  padding: 1rem;
  font-family: 'Roboto Mono', 'Courier', monospace;
  font-size: 75%;
}

#cache-elements li {
  width: 100%;
  padding: 0.5em;
}

#cache-elements li:hover {
  font-weight: bold;
}

#cache-elements li:nth-child(even) {
  background-color: #ececec;
}

#select-conversion-input {
  width: 100%;
}

button {
  padding: 0.5rem;
  background-color: #3e3e3e;
  border: 1px solid #3e3e3e;
  color: white;
}

label.file-upload-button {
  display: inline-block;
  cursor: pointer;
  font-size: 100%;

  padding: 0.5rem;
  border: 1px solid #3e3e3e;
  border-radius: 0.125rem;
  font-variant-caps: inherit;
  text-transform: none;

  background-color: #3e3e3e;
  color: white;
}

label.file-upload-button:hover {
  background-color: var(--blue-hex);
  color: white;
}

label.file-upload-button:active {
  background-color: var(--blue-hex);
  color: #3e3e3e;
}

input[type=file] {
  display: none;
}

#all-used-warning {
  display: none;
  color: var(--orange-hex);
  font-size: 75%;  
  text-align: center;
  width: 100%;
}

#add-controls > * {
  opacity: 75%;
  outline: none;
}

#add-controls:hover > * {
  opacity: 100%;
}

#add-controls:active > * {
  opacity: 100%;
}

#add-button:hover {
  background-color: var(--blue-hex);
}

#add-button:active {
  background-color: var(--red-hex);
}

#conversions {
  font-family: 'Roboto Mono', 'Consolas', monospace;
  font-size: 100%;
  width: 100%;

  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;

  padding-top: 2rem;
  padding-bottom: 2rem;
  gap: 0.5rem;
  margin: 0 auto;
}

.conversion {
  border: 1px solid #3e3e3e;
  background-color: white;
  color: #3e3e3e;

  display: inline-grid;
  gap: 0.5rem;
  min-width: 10rem;
  grid-template-areas: "actions actions"
                       "from-value from-unit"
                       "to-value to-unit";
  padding-bottom: 0.5rem;                                                                       
}

/* Landscape phone and bigger */
@media only screen and (min-width: 600px) {
  main {
    grid-template-areas: "enter-amount-controls"
                         "conversions"
                         "add-conversion-controls";
  }

  #controls {
    position: inherit;
    padding: 0;
    background-color: inherit;
  }

  #add-controls {
    position: inherit;
    padding: 0;
    background-color: inherit;
  }

  #controls,
  #add-controls,
  #conversions {
    width: 100%;
  }

  #controls,
  #add-controls {
    max-width: 30rem;
  }

  #controls>* {
    opacity: 75%;
    outline: none;
  }
  
  #controls:hover>* {
    opacity: 100%;
  }

  #conversions {
    max-width: 90%;
    margin: 0 auto;
    display: inline-grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, min-content));
    justify-items: stretch;
    align-items: stretch;    
  }

  .conversion {
    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.35);
  }
}

.conversion > * {
  min-width: 0px;
}

.from-value {
  grid-area: from-value;
}

.from-unit {
  grid-area: from-unit;
}

.to-value {
  grid-area: to-value;
}

.to-unit {
  grid-area: to-unit;
}

.equal-sign {
  grid-area: none;
}

.actions, 
.conversion-title {
  grid-area: actions;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background-color: #3e3e3e;
  overflow: hidden;
}

.conversion-title {
  color: white;
  padding: 0.25rem;
  text-align: center;
  justify-content: space-around;
  align-items: center;
}

.actions {
  visibility: hidden;
  padding-left: 0.5rem;
}

.conversion.selected > .actions {
  visibility: visible;
}

.conversion.selected > .conversion-title {
  visibility: hidden;
}

.from-value, .to-value, .actions {
  justify-self: end;
  text-align: end;
}

.from-unit, .to-unit {
  justify-self: start;
  text-align: start;
}

.equal-sign {
  justify-self: center;
  text-align: center;
  display: none;
}

.from-value, .to-value, .from-unit, .to-unit, .equal-sign {
  white-space: pre;
}

.actions > button.icon-button {
  font-size: 1em;
}

.actions>*[draggable] {
  color: white;
}

.actions > button[data-action="delete"] {
  border-radius: 50%;
  color: white;
  background-color: inherit;
  border: none;
}

.actions > button[data-action="delete"]:active,
.actions>button[data-action="delete"]:active * {
  color: var(--red-hex);
}

.conversion > .actions > *[draggable]:hover,
.conversion > .actions > *[data-action]:hover {
  animation: tilt-shaking 0.15s infinite;
}

