/* -------- Layout / Page shell -------- */

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f4f5f7;
  color: #111827;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: #111827;
  color: #f9fafb;
  gap: 1rem;
}

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

.inventory-header-left p {
  margin: 0;
  font-size: 0.9rem;
  color: #d1d5db;
}

.inventory-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.inventory-search-input {
  border-radius: 999px;
  border: 1px solid rgba(249, 250, 251, 0.25);
  background: rgba(15, 23, 42, 0.75);
  padding: 0.4rem 0.9rem;
  color: #f9fafb;
  min-width: 260px;
  font-size: 0.9rem;
}

.inventory-search-input::placeholder {
  color: #9ca3af;
}

.inventory-search-input:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(15, 23, 42, 0.9);
}

/* Add Item Type button in header */
.inventory-add-type-btn {
  border-radius: 999px;
  padding-inline: 0.9rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.inventory-main {
  max-width: 1200px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.5rem;
}

/* -------- Table card -------- */

.inventory-table-card {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.inventory-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.inventory-table-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.inventory-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #4b5563;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 0.25rem;
}

.in-stock-dot {
  background: #22c55e;
}

.signed-out-dot {
  background: #f97316;
}

.on-order-dot {
  background: #0ea5e9;
}

.damaged-dot {
  background: #ef4444;
}

/* -------- Filters -------- */

.inventory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.inventory-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8rem;
}

.inventory-filter-group label {
  color: #4b5563;
}

.inventory-filter-group select {
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  background: #f9fafb;
}

/* -------- Table -------- */

.inventory-table-wrapper {
  overflow-x: auto;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.inventory-table thead {
  background: #f3f4f6;
}

.inventory-table th,
.inventory-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.inventory-table th {
  font-weight: 600;
  color: #374151;
}

.inventory-table tbody tr.item-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.inventory-table tbody tr.item-row:hover {
  background: #f9fafb;
}

.inventory-table tbody tr.item-row.expanded {
  background: #eff6ff;
}

/* Actions cell: Add Item(s) button + expand arrow */

.actions-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.actions-cell .add-item-btn {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

.expand-icon {
  font-size: 0.9rem;
  color: #6b7280;
}

/* -------- Damage pill -------- */

.damage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.damage-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.damage-good {
  background: #ecfdf3;
  color: #166534;
}

.damage-good .damage-dot {
  background: #22c55e;
}

.damage-low {
  background: #fefce8;
  color: #854d0e;
}

.damage-low .damage-dot {
  background: #eab308;
}

.damage-medium {
  background: #fef2f2;
  color: #b91c1c;
}

.damage-medium .damage-dot {
  background: #f97316;
}

.damage-high {
  background: #fef2f2;
  color: #b91c1c;
}

.damage-high .damage-dot {
  background: #ef4444;
}

/* -------- Details row and status cards -------- */

.item-details-row.hidden {
  display: none;
}

.item-details-cell {
  padding: 0;
  background: #f9fafb;
}

.details-container {
  padding: 0.75rem 0.75rem 0.9rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.status-card {
  flex: 1 1 180px;
  min-width: 0;
  background: #ffffff;
  border-radius: 0.7rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease,
    border-color 0.1s ease, background 0.1s ease;
}

.status-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  border-color: #93c5fd;
}

.status-card.active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.status-card-title {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.status-card-count {
  font-size: 1.2rem;
  font-weight: 600;
  color: #111827;
}

.status-card-label {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Status color accents */

.status-in_stock .status-card-count {
  color: #16a34a;
}

.status-signed_out .status-card-count {
  color: #ea580c;
}

.status-on_order .status-card-count {
  color: #0284c7;
}

.status-items-container {
  margin-top: 0.5rem;
}

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

.status-items-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.status-items-header span {
  font-size: 0.8rem;
  color: #6b7280;
}

.status-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #ffffff;
  border-radius: 0.5rem;
  overflow: hidden;
}

.status-items-table th,
.status-items-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.status-items-table th {
  background: #f3f4f6;
  font-weight: 600;
}

.inventory-hint {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #6b7280;
}

/* -------- Modals -------- */

.inv-modal.hidden {
  display: none;
}

.inv-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
}

.inv-modal-content {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  max-width: 640px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.inv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.inv-modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.inv-modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.inv-modal-body {
  margin-top: 0.5rem;
}

.inv-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.inv-form-field-full {
  grid-column: 1 / -1;
}

.inv-form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.inv-form-field input,
.inv-form-field textarea,
.inv-form-field select {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.inv-modal-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.inv-modal-footer-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.inv-modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inv-upload-btn {
  font-size: 0.8rem;
}

.inv-upload-hint {
  font-size: 0.7rem;
  color: #6b7280;
}

/* -------- Responsive tweaks -------- */

@media (max-width: 768px) {
  .inventory-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inventory-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .inventory-search-input {
    width: 100%;
  }

  .inventory-main {
    padding: 0 1rem;
  }

  .inventory-table-card {
    padding-inline: 1rem;
  }

  .inv-form-grid {
    grid-template-columns: 1fr;
  }

  .inv-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .inv-modal-footer-right {
    justify-content: flex-end;
  }
}

