/* Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f0f4f8, #d9e2ec);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 40px 20px;
  color: #333;
}

.container {
  width: 100%;
  max-width: 600px;
  background-color: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.3s ease;
}

.container:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.16);
}

h2 {
  margin-bottom: 30px;
  font-weight: 700;
  font-size: 2rem;
  color: #222;
  text-align: center;
  letter-spacing: 1.2px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #444;
}

input,
select {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 20px;
  border: 1.8px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.25s ease;
  outline-offset: 2px;
}

input:focus,
select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 6px rgba(0, 123, 255, 0.4);
}

.button-container {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
}

.button-container button {
  flex: 1;
  padding: 14px 0;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  transition: background-color 0.3s ease, transform 0.15s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button-container button:disabled {
  background-color: #ccc !important;
  cursor: not-allowed;
  box-shadow: none;
}

#addButton {
  background: linear-gradient(45deg, #28a745, #1e7e34);
}

#addButton:hover:not(:disabled) {
  background: linear-gradient(45deg, #218838, #19692c);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(33, 136, 56, 0.6);
}

#generateButton {
  background: linear-gradient(45deg, #007bff, #0056b3);
}

#generateButton:hover:not(:disabled) {
  background: linear-gradient(45deg, #0056b3, #003f7f);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 86, 179, 0.6);
}

#resetButton {
  background: linear-gradient(45deg, #ffa500, #cc8400);
}

#resetButton:hover:not(:disabled) {
  background: linear-gradient(45deg, #ff8c00, #995c00);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 140, 0, 0.6);
}

#items-list {
  margin-top: 20px;
}

#items-list h2 {
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 15px;
  border-bottom: 2px solid #007bff;
  padding-bottom: 5px;
  color: #007bff;
}

ul {
  padding-left: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fafafa;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

li {
  list-style: none;
  padding: 12px 15px;
  border-bottom: 1px solid #e1e4e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  color: #444;
}

li:last-child {
  border-bottom: none;
}

.delete-btn {
  padding: 6px 12px;
  background-color: #dc3545;
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.25s ease;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.5);
}

.delete-btn:hover {
  background-color: #c82333;
  box-shadow: 0 4px 10px rgba(200, 35, 51, 0.7);
}

.delete-btn:active {
  transform: scale(0.95);
}

#totals {
  font-weight: 700;
  margin-top: 25px;
  font-size: 1.1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  color: #222;
}

#totals > div {
  background: #e9f0fb;
  border-radius: 8px;
  padding: 12px 15px;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.7);
  text-align: center;
  user-select: none;
}

#scanner-preview {
  display: none;
  width: 100%;
  max-width: 400px;
  height: 300px;
  border-radius: 12px;
  border: 2px solid #007bff;
  margin-top: 12px;
  background: #000;
  box-shadow: 0 6px 18px rgba(0, 123, 255, 0.3);
  position: relative;
  overflow: hidden;
}

#barcode-scanner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
  gap: 8px;
}

#barcode-scanner-container button {
  width: 48%;
  padding: 12px 0;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, transform 0.15s ease;
}

#start-scan {
  background: linear-gradient(45deg, #17a2b8, #117a8b);
}

#start-scan:hover:not(:disabled) {
  background: linear-gradient(45deg, #117a8b, #0c515e);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(17, 122, 139, 0.6);
}

#stop-scan {
  background: linear-gradient(45deg, #dc3545, #a71d2a);
}

#stop-scan:hover:not(:disabled) {
  background: linear-gradient(45deg, #a71d2a, #7f151f);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(167, 29, 42, 0.6);
}

.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 14px;
  color: #6b7280;
}

.footerLink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footerLink:hover {
  color: #111827;
}

.githubIcon {
  width: 20px;
  height: 20px;
  filter: grayscale(100%);
  transition: filter 0.2s ease;
}

.footerLink:hover .githubIcon {
  filter: none;
}

@media (max-width: 640px) {
  .container {
    width: 90%;
    padding: 20px;
  }

  #barcode-scanner-container {
    flex-direction: column;
  }

  #barcode-scanner-container button {
    width: 100% !important;
  }

  .button-container {
    flex-direction: column;
  }

  .button-container button {
    width: 100% !important;
    margin-bottom: 12px;
  }
}
