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

@media only screen and (min-width: 600px) {
  body {
    font-size: 150%;
  }
}

header {
  background-color: #3e3e3e;
  color: #cecece;
}

#settings {
  grid-area: settings;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: #3e3e3e;
  padding: 0.5rem 0;
}

#settings.closed {
  background-color: inherit;
  padding: 0;
}

#settings-button {
  align-self: flex-end;
}

#settings-button .fa-gear {
  display: none;
}

#settings-button .fa-xmark {
  display: block;
}

#settings.closed #settings-button .fa-gear {
  display: block;
}

#settings.closed #settings-button .fa-xmark {
  display: none;
}

#settings.closed #select-or-create-list {
  display: none;
}

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

  display: grid;
  grid-template-areas: "todo-list"
                       "controls";
  grid-template-rows: auto min-content;
  grid-template-columns: 1fr;
  gap: 2rem;
  justify-items: center;
  justify-content: center;
  align-items: flex-start;
}

@media (hover: hover) {
  main {
    grid-template-areas: "controls"
                         "todo-list";
    grid-template-rows: min-content auto;
    padding: 1rem;
  }
}

#controls {
  grid-area: controls;
  background-color: #3e3e3e;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-x: hidden;
}

@media (hover: hover) {
  #controls {
    position: relative;
    background-color: inherit;
    padding: 0;
  }
}

#controls .horizontal-group {
  width: 100%;
  display: flex;
  gap: 0.25rem;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

#controls #new-item {
  width: calc(100% - 3.25rem);
}

#controls > input {
  min-width: 10rem;
}

#controls > button {
  align-self: center;
  justify-self: center;
}

#todo-list {
  grid-area: todo-list;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  gap: 1rem;
  padding: 1rem;
}

.item {
  border: 1px solid #3e3e3e;
  background-color: white;
  color: #3e3e3e;
  
  display: inline-grid;
  gap: 0.5rem;
  min-width: 10rem;
  grid-template-areas: "item-actions item-actions"
                       "item-status item-text"
                       "item-status item-tags";
  padding-bottom: 0.5rem;
  grid-template-columns: 2.5rem auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  transition: all 0.3s cubic-bezier(.25, .8, .25, 1);
}

@media (hover: hover) {
  #todo-list {
    padding: 0;
  }
}

.item:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}

.item.done {
  background-color: rgba(var(--green-components), 20%);
}

.item-status {
  grid-area: item-status;
  padding-top: 0.5rem;
  padding-left: 0.5rem;
}

.item.done .item-status {
  color: #3e3e3e;
}

.item-text {
  grid-area: item-text;
  padding-right: 0.5rem;
  padding-top: 0.5rem;
}

.item-tags {
  grid-area: item-tags;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

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

.item-actions {
  grid-area: item-actions;
  width: 100%;
  display: none;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  background-color: #3e3e3e;
  overflow: hidden;
  padding-left: 0.5rem;
}

.item.selected > .item-actions {
  display: flex;
}

li > label {
  color: #3e3e3e44;
  justify-self: center;
}

li > button {
  justify-self: center;
}

li.done > label {
  color: var(--blue-hex);
}

li.done > .item-content > .note {
  text-decoration: line-through;
}

@media only screen and (max-width: 600px) {
  .tags {
    display: none;
  }
}

.tag {
  -moz-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.item.done .tag {
  border: 1px solid var(--green-hex);
  color: white;
  background-color: var(--green-hex);
}

.tag.status {
  display: none;
}

li.item.done .tag.status {
  display: inline-flex;
} 

.tag.created::before {
  content: "created:";
  padding-right: 0.5em;
}

.tag.last-modified::before {
  content: "last-modified:";
  padding-right: 0.5em;
}

.tag {
  font-size: 50%;

  padding-left: 1em;
  padding-right: 1em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  border-radius: 1em;
  height: 2em;

  border: 1px solid var(--blue-hex);
  color: var(--blue-hex);

  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.error {
  color: var(--red-hex);
}

.error[data-error] {
  position: relative;
}

.error[data-error]:hover::after {
  content: attr(data-error);
  position: absolute;
  top: 1.5em;
  left: 0;
  padding: 0.25rem;
  background-color: var(--red-hex);
  border: 1px dotted #3e3e3e;
  color: white;
  font-size: 75%;
  z-index: 100;
}

.item-actions > * {
  color: white;
}
