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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  padding: 0;
  margin: 0;
}

.screen {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

/* Auth Screen */
.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.auth-container h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.auth-container p {
  margin-bottom: 30px;
  opacity: 0.9;
}

.auth-container input {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* List Screen */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: white;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header h1 {
  font-size: 1.5rem;
  margin: 0;
}

.items-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #999;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item.expired {
  border-left-color: #e53e3e;
  background: #fff5f5;
}

.item.soon {
  border-left-color: #dd6b20;
  background: #fffaf0;
}

.item.ok {
  border-left-color: #38a169;
  background: #f0fff4;
}

.item-info {
  flex: 1;
}

.item-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.item-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 4px;
}

.item-days {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

.item.expired .item-days {
  background: #fed7d7;
  color: #c53030;
}

.item.soon .item-days {
  background: #feebc8;
  color: #c05621;
}

.item.ok .item-days {
  background: #c6f6d5;
  color: #22543d;
}

.item-delete {
  margin-left: 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2rem;
  color: #e53e3e;
}

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

/* Add Item Screen */
.add-item-container {
  padding: 0;
  position: relative;
}

.btn-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 1.2rem;
  cursor: pointer;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  min-height: 100vh;
  justify-content: flex-start;
  padding-top: 70px;
}

.step h2 {
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: visible;
  background: black;
}

#barcodeReader {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

#barcodeReader video {
  width: 100% !important;
  height: auto !important;
  border-radius: 8px;
}

#barcodeReader canvas {
  display: none;
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}

.result {
  margin: 20px 0;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  min-height: 40px;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 300px;
}

input[type="text"] {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 10px 0;
}

/* Buttons */
button {
  padding: 12px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #667eea;
  color: white;
  width: 100%;
  max-width: 300px;
  margin: 10px auto;
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Spinner */
.spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    gap: 12px;
  }

  .header h1 {
    font-size: 1.3rem;
  }

  .btn-primary {
    max-width: 100%;
  }

  input[type="text"] {
    max-width: 100%;
  }
}
