﻿:root {
  --zoom: 100%;
  --scale: 1;
  --spacing: 8px;
  --adjust-landscape: 1;
}

* {
  padding: 0;
  margin: 0;
}

body {
  font-family: Arial, sans-serif;
}

.container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  position: fixed;
  top: 0;
  width: 100vw;
}

button {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 10px 20px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  cursor: pointer;
  width: 60px;
  height: 40px;
}

button[disabled] {
  cursor: not-allowed;
}

#buttonPrint {
  padding-top: 12px;
}

@media (min-device-width: 1281px) {
  
  #buttonPrint {
    padding-top: 5px;
  }
  
}

input[type="search"] {
  width: calc(100% - 180px);
  height: 40px;
  padding: 10px;
  border: 1px solid #4CAF50;
  outline: none;
}

ul {
  list-style-type: none;
  padding: 0;
  margin: 4px 2px;
  width: calc(100% - 26px);
  margin-top: 42px;
}

li {
  border: 1px solid #ccc;
  border-bottom: 0px;
  padding: 10px;
  cursor: pointer;
  width: 100%;
}

li:last-child {
  border-bottom: 1px solid #ccc;
}

li.selected {
  color: #999;
  text-decoration: line-through;
}

li:hover {
  background-color: #f9f9f9;
}

#result,
#price,
.result-header {
  display: none;
}

.result-header {
  font-weight: bold;
  margin-bottom: 10px;
}

.grid-container {
  display: grid;
  grid-gap: 5px 0px;
  margin-top: 10px;
}

@media print {
  .container,
  #nameList  {
    display: none;
  }
  #result,
  .result-header {
    display: block;
  }
  body {
    transform: scale(var(--scale));
    transform-origin: top left;
  }
  #result {
    zoom: var(--zoom);
  }
  .grid-item.footer {
    min-width: 70px;
  }
}

@media print and (orientation: landscape) {
  body {
    transform: unset;
    transform-origin: unset;
  }
  .grid-item {
    padding-left: calc(var(--spacing) / 2);
    padding-right: calc(var(--spacing) / 2);
  }
  #result {
    zoom: calc(var(--zoom) * var(--scale) * var(--adjust-landscape));
  }
}

.grid-header,
.grid-footer {
  padding: var(--spacing);
  font-weight: bold;
  display: flex;
  align-items: center;
  background-color: #f2f2f2;
}

.grid-header {
  margin-bottom: var(--spacing);
}

.grid-footer {
  margin-top: var(--spacing);
}

.grid-header:nth-child(1),
.grid-item.date,
.grid-item.sum {
  text-align: right;
  padding-right: 20px;
  justify-content: center;
}

.grid-header:nth-child(1) span
  margin-left: auto;
}

.grid-header:nth-child(n+2),
.grid-footer:nth-child(n+2) {
  text-align: center;
}

.grid-header:nth-child(n+2) span,
.grid-footer:nth-child(n+2) span {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  margin-left: auto;
  margin-right: auto;
}

.grid-item {
  padding-top: 6px;
  border-top: 1px solid #ccc;
  white-space: nowrap;
  text-align: center;
}

.grid-item:nth-child(1) {
  background-color: #ccc;
}

.grid-item.first {
  border: 0px;
}

.grid-item.odd {
  background-color: #fdfdfd;
}

.grid-item.last {
  border: 0px;
}

.grid-item.footer {
  border: 0px;
  margin-top: 20px;
}

.grid-item.footer:not(.sum) {
  margin-left: auto;
  margin-right: auto;
}