/*====================
Blok 1 — Card Mobile Barang: mengatur tampilan tabel barang menjadi kartu di HP, termasuk nama barang, SKU, aksi, kategori, status, stok, satuan, dan empty state.
======================*/
@media (max-width: 768px) {

   /* Table Container */

  #barangTableBody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .table-container:has(#barangTableBody) {
    overflow: visible;
    background: transparent;
    border: none;
    box-shadow: none;
  }


  /* Table */

  .table-container:has(#barangTableBody) .data-table {
    display: block;
    width: 100%;
  }

  .table-container:has(#barangTableBody) .data-table thead {
    display: none;
  }

  .table-container:has(#barangTableBody) .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }


  /* Barang Card */

  .barang-table-row {
    position: relative;
    display: grid ;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name actions"
      "sku actions"
      "kategori status"
      "stok satuan";

    gap: 5px 12px;
    width: 100%;
    padding: 15px 16px 15px 18px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;

    box-shadow:
      0 1px 3px rgba(15, 23, 42, 0.04);

    overflow: hidden;
  }

  .barang-table-row:hover {
    background: var(--bg-card, #ffffff);
  }

  .barang-table-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    background: var(--primary, #2563eb);
    border-radius: 0 4px 4px 0;
  }


  /* Hide Number */

  .barang-no {
    display: none;
  }


  /* Nama Barang */

  .barang-name {
    grid-area: name;
    min-width: 0;
    padding: 0 !important;
    border: none;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text-main, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .barang-name strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }


  /* SKU */

  .barang-sku {
    grid-area: sku;
    min-width: 0;
    padding: 0 !important;
    border: none ;
    font-size: 10px;
    line-height: 1.3;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .barang-sku code {
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
  }


  /* Actions */

  .barang-actions {
    grid-area: actions;
    display: flex ;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 4px;
    padding: 0 !important;
    border: none ;
  }

  .barang-actions .btn-action {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 9px;
  }

  .barang-actions .btn-action svg {
    width: 17px;
    height: 17px;
  }


  /* Kategori */

  .barang-kategori {
    grid-area: kategori;
    display: flex ;
    align-items: center;
    min-width: 0;
    padding: 6px 0 0 !important;
    border: none ;
    font-size: 10px;
  }

  .barang-kategori .badge {
    padding: 4px 8px;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
  }


  /* Status */

  .barang-status {
    grid-area: status;
    display: flex ;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 0 0 !important;
    border: none ;
    font-size: 10px;
  }

  .barang-status .badge {
    padding: 4px 8px;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
  }


  /* Stok */

  .barang-stok {
  grid-area: stok;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 0 0 !important;
  border: none ;
  font-size: 10px;
  color: var(--text-muted, #64748b);
}

.barang-stok::before {
  content: "Stok";

  font-size: 10px;
  color: var(--text-muted, #64748b);
}

.barang-stok strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main, #1e293b);
}


  /* Satuan */

  .barang-satuan {
    grid-area: satuan;
    display: flex ;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 4px 0 0 !important;
    border: none ;
    font-size: 10px;
    color: var(--text-muted, #64748b);
  }

  /* Remove Table Borders */

  .table-container:has(#barangTableBody) .data-table tbody td {
    border-bottom: none;
  }


  /* Empty State */

  #barangTableBody tr:not(.barang-table-row) {
    display: block ;
    background: transparent;
    border: none ;
    box-shadow: none;
  }

  #barangTableBody tr:not(.barang-table-row) td {
    display: block ;
    padding: 2rem 1rem ;
    border: none ;
  }
} 
