@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0f172a;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --danger: #dc2626;
  --success: #15803d;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.25), transparent 55%), var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: auto;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.page {
  width: min(1000px, 100%);
}

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.35);
  padding: 3rem;
}

@media (max-width: 640px) {
  body {
    padding: 0;
    display: block;
  }
  .page {
    width: 100vw;
    min-height: 100vh;
    padding: 0;
  }
  .card {
    padding: 1rem;
    border-radius: 0;
    min-height: 100vh;
    width: 100%;
    box-shadow: none;
  }
  header.top {
    flex-direction: column;
    gap: 1rem;
  }
  table {
    font-size: 0.85rem;
  }
  th,
  td {
    padding: 0.55rem;
  }
  td img,
  .photo-btn img {
    width: 56px;
    height: 56px;
  }
  .inventory-actions,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .lookup-btn {
    width: 100%;
    justify-content: center;
  }
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

input,
textarea,
select {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

button,
.button {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.6rem;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 15px 35px rgba(37, 99, 235, 0.35);
}

.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.35);
}

.ghost.small {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.lookup-btn {
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.35rem;
}

.status {
  min-height: 1.5rem;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.video-wrapper {
  background: #020617;
  border-radius: 18px;
  overflow: hidden;
  min-height: 360px;
  position: relative;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.45);
}

.video-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  pointer-events: none;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none;
}

#scanner,
#scanner > div {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

#scanner video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border: none !important;
  border-radius: 18px;
}

.preview img {
  width: 100%;
  margin-top: 1rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

th[data-sort] {
  cursor: pointer;
  color: var(--primary);
}

td img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.photo-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.photo-btn img {
  display: block;
}

.badge {
  display: inline-flex;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.inventory-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.file-input {
  cursor: pointer;
}

.file-input input {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #0f172a;
  border-radius: 18px;
  padding: 1rem;
  max-width: min(90vw, 900px);
  width: 100%;
  color: white;
  position: relative;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.modal-content img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}
