* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  overflow-x: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

.container {
  padding: 20px;
  max-width: 500px;
  margin: 0 auto;
}

/* Typography */
h1 {
  font-size: 28px;
  text-align: center;
  margin: 40px 0 30px;
  color: #1a73e8;
}

h2 {
  font-size: 18px;
  font-weight: 600;
}

h3 {
  font-size: 16px;
  color: #555;
  margin-bottom: 12px;
}

h4 {
  font-size: 14px;
  color: #666;
  padding: 8px 16px;
}

/* Form elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: #1a73e8;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
  padding: 14px 24px;
}

.btn-primary:active {
  background: #1557b0;
}

.btn-success {
  background: #34a853;
  color: #fff;
  padding: 14px 24px;
}

.btn-success:active {
  background: #2d8f47;
}

.btn-large {
  width: 100%;
  padding: 16px;
  font-size: 18px;
}

.btn-large:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-back {
  background: none;
  color: #1a73e8;
  padding: 10px 16px;
  font-size: 16px;
}

.btn-outline {
  background: #fff;
  color: #1a73e8;
  border: 2px solid #1a73e8;
  padding: 14px 24px;
}

.btn-outline:active {
  background: #e8f0fe;
}

/* Header bar */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ddd;
}

.date-badge {
  font-size: 13px;
  color: #666;
  background: #e8eaed;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Category list */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.btn-category {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border: 2px solid #e8eaed;
  border-radius: 12px;
  text-align: left;
  font-size: 16px;
  width: 100%;
}

.btn-category:active {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.cat-icon {
  font-size: 24px;
  width: 36px;
  text-align: center;
}

.cat-name {
  flex: 1;
  font-weight: 600;
}

.cat-count {
  background: #e8eaed;
  color: #555;
  font-size: 14px;
  font-weight: 700;
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 14px;
}

.cat-count.has-items {
  background: #1a73e8;
  color: #fff;
}

/* Scanner screen */
.scanner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 4px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 10;
}

.scanner-header h3 {
  margin: 0;
  flex: 1;
}

#scanner-container {
  background: #000;
  position: relative;
}

#reader {
  width: 100%;
}

#reader video {
  width: 100% !important;
  border: none !important;
}

/* Hide the default html5-qrcode UI elements we don't need */
#reader__dashboard_section_csr button {
  background: #1a73e8 !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  margin: 4px !important;
}

#reader__dashboard_section_swaplink {
  color: #1a73e8 !important;
  text-decoration: none !important;
}

.scanner-controls {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.scanner-controls .form-group {
  margin-bottom: 8px;
}

.scanner-controls input[type="text"] {
  padding: 10px 14px;
  font-size: 15px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

.input-row .btn {
  white-space: nowrap;
  border-radius: 10px;
}

/* Scanned items list */
.scanned-list-container {
  background: #fff;
  flex: 1;
}

#scannedList {
  list-style: none;
}

#scannedList li {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

#scannedList li .item-number {
  color: #999;
  font-size: 12px;
  width: 28px;
  flex-shrink: 0;
}

#scannedList li .item-serial {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  flex: 1;
}

#scannedList li .item-desc {
  color: #666;
  font-size: 13px;
  margin-left: 8px;
  max-width: 120px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#scannedList li .item-delete {
  color: #ea4335;
  background: none;
  border: none;
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
  margin-left: 8px;
}

/* Review screen */
#reviewContent {
  margin: 16px 0;
}

.review-section {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}

.review-section-header {
  padding: 12px 16px;
  background: #1a73e8;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
}

.review-item {
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  display: flex;
  gap: 12px;
}

.review-item .serial {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  min-width: 100px;
}

.review-item .desc {
  color: #666;
}

/* Bottom actions */
.bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #34a853;
}

.toast.error {
  background: #ea4335;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

/* Review customer info */
.review-info {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.review-info p {
  font-size: 15px;
  margin-bottom: 4px;
}

.review-info strong {
  color: #333;
}

/* Saved collections list */
#savedCollections {
  margin-top: 24px;
}

.saved-header {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.saved-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid #e8eaed;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}

.saved-item:active {
  background: #e8f0fe;
  border-color: #1a73e8;
}

.saved-item .saved-info {
  flex: 1;
}

.saved-item .saved-name {
  font-weight: 600;
  font-size: 15px;
}

.saved-item .saved-meta {
  font-size: 13px;
  color: #666;
  margin-top: 2px;
}

.saved-item .saved-count {
  background: #1a73e8;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 14px;
  padding: 0 8px;
}

.saved-item .saved-delete {
  color: #ea4335;
  background: none;
  border: none;
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
}
